Re: [SQL] How To Recover Deleted Data

2003-05-30 Thread Brian Knox
Do you have a backup of the data?

Brian Knox
Senior Systems Programmer
Web Infrastructure and Security
x51613
[EMAIL PROTECTED]

On Thu, 29 May 2003, Abdul Wahab Dahalan wrote:

> I've accidentally deleted the data in my table. So How to recover it back.
>
>
> ---(end of broadcast)---
> TIP 2: you can get off all lists at once with the unregister command
> (send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])
>

---(end of broadcast)---
TIP 6: Have you searched our list archives?

http://archives.postgresql.org


[SQL] "record" datatype - plpgsql

2003-05-30 Thread Brian Knox
Given a variable of the "record" data type in pl/pgsql, is it possible to
get the names of the columns ( attributes ) of that record?

eg, given record "NEW" for table "foo", is there a way to get information
concerning the columns that make up that record?

Brian Knox

---(end of broadcast)---
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html


Re: [SQL] "record" datatype - plpgsql

2003-05-30 Thread Brian Knox

That's not what I was asking. I know I can access the values of each
column using NEW.columnname. What I was asking is if there's anyway to use
the NEW record to get a list of the columnnames in it without knowing them
beforehand.

Brian Knox

On Thu, 29 May 2003, George Weaver wrote:

> Hi Brian;
>
> Assuming "NEW" has been declared as   foo%rowtype,  you can access the
> columns thus
>
> NEW.xxx where xxx is the column name
>
> HTH.
> George
>
> - Original Message -
> From: "Brian Knox" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Thursday, May 29, 2003 11:11 AM
> Subject: [SQL] "record" datatype - plpgsql
>
>
> > Given a variable of the "record" data type in pl/pgsql, is it possible to
> > get the names of the columns ( attributes ) of that record?
> >
> > eg, given record "NEW" for table "foo", is there a way to get information
> > concerning the columns that make up that record?
> >
> > Brian Knox
> >
> > ---(end of broadcast)---
> > TIP 5: Have you checked our extensive FAQ?
> >
> > http://www.postgresql.org/docs/faqs/FAQ.html
> >
>

---(end of broadcast)---
TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]


Re: [SQL] DISTINCT ON troubles

2004-02-19 Thread Brian Knox
( sorry if this is a repeat, my mail server is being wonky today )

I'm looking for a way, within SQL, given a starting date and an ending 
date, to get back the number of months between the start and end date. 
If I "SELECT end_date - start_date", I get back an interval in days; I 
need months.

Thanks for any suggestions,
Brian
---(end of broadcast)---
TIP 7: don't forget to increase your free space map settings


Re: [SQL] Date Foo.

2004-02-20 Thread Brian Knox
Sorry, Not looking for a way to extract a month from a timestamp. I'm 
looking for a way to convert an interval from days to months. I'm not 
sure after digging into it that there is a way to handle it in SQL, as 
the interval that results from subtracting one timestamp from another is 
not away of what months the interval spans, so there'd be no proper way 
to take month lengths into account.

I gave up on the sql and used Date::Calc from Perl. Thanks for your 
answer anyway.

scott.marlowe wrote:
On Thu, 19 Feb 2004, Brian Knox wrote:


( sorry if this is a repeat, my mail server is being wonky today )

I'm looking for a way, within SQL, given a starting date and an ending 
date, to get back the number of months between the start and end date. 
If I "SELECT end_date - start_date", I get back an interval in days; I 
need months.


Maybe date_part?

select date_part('month','2004-08-02 12:00:00'::timestamp) - 
date_part('month','2004-05-01 12:00:00'::timestamp);

---(end of broadcast)---
TIP 4: Don't 'kill -9' the postmaster


[SQL] Convert INT to INTERVAL?

2004-02-27 Thread Brian Knox
Is it possible within pl/pgsql, to convert an integer to an interval in 
months? IE, if num_months is an INT set to 48, can it be converted to an 
interval?

Thanks,
Brian
---(end of broadcast)---
TIP 7: don't forget to increase your free space map settings