Re: [SQL] Get the max(value1, value2, value3) from a table

2008-01-07 Thread Erik Jones
On Jan 7, 2008, at 4:43 PM, Scott Marlowe wrote: On Jan 7, 2008 4:38 PM, Josh Williams <[EMAIL PROTECTED]> wrote: On Mon, 2008-01-07 at 17:03 -0500, Emi Lu wrote: select ?max?(col1, col2, col3) as result; will return result --- 5 8 12 (3 rows) 8.1 (I believe?) introduced GREATEST(), w

Re: [SQL] Get the max(value1, value2, value3) from a table

2008-01-07 Thread Scott Marlowe
On Jan 7, 2008 4:53 PM, Emi Lu <[EMAIL PROTECTED]> wrote: > >>> select ?max?(col1, col2, col3) as result; > >>> will return > >>> > >>> result > >>> --- > >>> 5 > >>> 8 > >>> 12 > >>> > >>> (3 rows) > >> 8.1 (I believe?) introduced GREATEST(), which does precisely what you're > >> looking for.

Re: [SQL] Get the max(value1, value2, value3) from a table

2008-01-07 Thread Emi Lu
select ?max?(col1, col2, col3) as result; will return result --- 5 8 12 (3 rows) 8.1 (I believe?) introduced GREATEST(), which does precisely what you're looking for. How would greatest give him three rows like that? Maybe I'm misunderstanding what the OP was asking for... IF 8.1, "sel

Re: [SQL] Get the max(value1, value2, value3) from a table

2008-01-07 Thread Scott Marlowe
On Jan 7, 2008 4:38 PM, Josh Williams <[EMAIL PROTECTED]> wrote: > On Mon, 2008-01-07 at 17:03 -0500, Emi Lu wrote: > > select ?max?(col1, col2, col3) as result; > > will return > > > > result > > --- > > 5 > > 8 > > 12 > > > > (3 rows) > > 8.1 (I believe?) introduced GREATEST(), which does pre

Re: [SQL] Get the max(value1, value2, value3) from a table

2008-01-07 Thread Scott Marlowe
On Jan 7, 2008 4:37 PM, Emi Lu <[EMAIL PROTECTED]> wrote: > > > > >> select max(col1) from table > >> union all > >> select max(col2) from table > >> union all > >> select max(col3) from table > No, this is not what I prefer; it makes complicate query. Generally speaking when you have to make comp

Re: [SQL] Get the max(value1, value2, value3) from a table

2008-01-07 Thread Josh Williams
On Mon, 2008-01-07 at 17:03 -0500, Emi Lu wrote: > select ?max?(col1, col2, col3) as result; > will return > > result > --- > 5 > 8 > 12 > > (3 rows) 8.1 (I believe?) introduced GREATEST(), which does precisely what you're looking for. But if 8.0 is a must, you'll probably have to create yo

Re: [SQL] Get the max(value1, value2, value3) from a table

2008-01-07 Thread Emi Lu
select max(col1) from table union all select max(col2) from table union all select max(col3) from table No, this is not what I prefer; it makes complicate query. Would the following work also? SELECT MAX( GREATEST( col1, col2, col3 ) ) FROM TABLE; I would prefer this func. Unfortunat

Re: [SQL] Get the max(value1, value2, value3) from a table

2008-01-07 Thread Scott Marlowe
On Jan 7, 2008 4:27 PM, Richard Broersma Jr <[EMAIL PROTECTED]> wrote: > --- On Mon, 1/7/08, Scott Marlowe <[EMAIL PROTECTED]> wrote: > > > select max(col1) from table > > union all > > select max(col2) from table > > union all > > select max(col3) from table > > Would the following work also? > >

Re: [SQL] Get the max(value1, value2, value3) from a table

2008-01-07 Thread Richard Broersma Jr
--- On Mon, 1/7/08, Scott Marlowe <[EMAIL PROTECTED]> wrote: > select max(col1) from table > union all > select max(col2) from table > union all > select max(col3) from table Would the following work also? SELECT MAX( GREATEST( col1, col2, col3 ) ) FROM TABLE; Regards, Richard Broersma Jr. -

Re: [SQL] Get the max(value1, value2, value3) from a table

2008-01-07 Thread Scott Marlowe
On Jan 7, 2008 4:03 PM, Emi Lu <[EMAIL PROTECTED]> wrote: > Greetings, > > Version: PostgreSQL 8.0.13 on i686-pc-linux-gnu > > I have a table test(col1, col2, col3) > > For each row, I'd like to get the "max"(col1, col2, col3). > > For example, test(1, 5, 2) > test(8, 1, 3) >

[SQL] Get the max(value1, value2, value3) from a table

2008-01-07 Thread Emi Lu
Greetings, Version: PostgreSQL 8.0.13 on i686-pc-linux-gnu I have a table test(col1, col2, col3) For each row, I'd like to get the "max"(col1, col2, col3). For example, test(1, 5, 2) test(8, 1, 3) test(12, 1, 1) select ?max?(col1, col2, col3) as result; will return

Re: [SQL] reading WAL files in python

2008-01-07 Thread gherzig
> > On Jan 7, 2008, at 7:19 AM, Gerardo Herzig wrote: > >> Hi all. Im having some fun trying to write my own replication >> system using python. I will use the postgres own WAL archiving to >> write the files, then my app will read them and do some stuff. As >> im not a C programmer, im stuck in t

Re: [SQL] reading WAL files in python

2008-01-07 Thread Erik Jones
On Jan 7, 2008, at 7:19 AM, Gerardo Herzig wrote: Hi all. Im having some fun trying to write my own replication system using python. I will use the postgres own WAL archiving to write the files, then my app will read them and do some stuff. As im not a C programmer, im stuck in the missio

Re: [SQL] Cheers for DISTINCT ON

2008-01-07 Thread Andrew Sullivan
On Mon, Jan 07, 2008 at 12:51:19PM -0500, Chris Browne wrote: > I have heard that Gabriel has, at different conferences at different > times, taken and argued opposite positions on this; he has both argued > "Worse is Better" and that "Worse isn't Better." Yes. That history is actually outlined b

Re: [SQL] Cheers for DISTINCT ON

2008-01-07 Thread Chris Browne
[EMAIL PROTECTED] (Andrew Sullivan) writes: > On Mon, Jan 07, 2008 at 05:02:27PM +0100, Peter Kovacs wrote: >> I just wanted to give my cheers for DISTINCT ON. It is a great >> feature, I've just found a really good use for it. I am just wondering >> why it didn't make it into the standards. > > Li

Re: [SQL] Cheers for DISTINCT ON

2008-01-07 Thread Chris Browne
[EMAIL PROTECTED] (Bruce Momjian) writes: > Peter Kovacs wrote: >> I just wanted to give my cheers for DISTINCT ON. It is a great >> feature, I've just found a really good use for it. I am just wondering >> why it didn't make it into the standards. >> >> On a slightly unrelated note, I had the opp

Re: [SQL] Cheers for DISTINCT ON

2008-01-07 Thread Bruce Momjian
Peter Kovacs wrote: > I just wanted to give my cheers for DISTINCT ON. It is a great > feature, I've just found a really good use for it. I am just wondering > why it didn't make it into the standards. > > On a slightly unrelated note, I had the opportunity to work with EQUEL > for a short period

Re: [SQL] Cheers for DISTINCT ON

2008-01-07 Thread Andrew Sullivan
On Mon, Jan 07, 2008 at 05:02:27PM +0100, Peter Kovacs wrote: > I just wanted to give my cheers for DISTINCT ON. It is a great > feature, I've just found a really good use for it. I am just wondering > why it didn't make it into the standards. Likely because neither Oracle Corp nor IBM nor (at the

[SQL] Cheers for DISTINCT ON

2008-01-07 Thread Peter Kovacs
I just wanted to give my cheers for DISTINCT ON. It is a great feature, I've just found a really good use for it. I am just wondering why it didn't make it into the standards. On a slightly unrelated note, I had the opportunity to work with EQUEL for a short period of time some 15 years ago before

Re: [SQL] reading WAL files in python

2008-01-07 Thread Gerardo Herzig
C. Bergström wrote: On Mon, 2008-01-07 at 10:19 -0300, Gerardo Herzig wrote: Hi all. Im having some fun trying to write my own replication system using python. I will use the postgres own WAL archiving to write the files, then my app will read them and do some stuff. As im not a C program

Re: [SQL] reading WAL files in python

2008-01-07 Thread C.
On Mon, 2008-01-07 at 10:19 -0300, Gerardo Herzig wrote: > Hi all. Im having some fun trying to write my own replication system > using python. I will use the postgres own WAL archiving to write the > files, then my app will read them and do some stuff. As im not a C > programmer, im stuck in

[SQL] reading WAL files in python

2008-01-07 Thread Gerardo Herzig
Hi all. Im having some fun trying to write my own replication system using python. I will use the postgres own WAL archiving to write the files, then my app will read them and do some stuff. As im not a C programmer, im stuck in the mission of reading the binary files. I guess im needing to k