[SQL] COPY equivalent for updates

2008-07-15 Thread Ivan Sergio Borgonovo
Is there a COPY equivalent for updates? eg I've create table t1 ( id int primary key, col1 int, col2 int, col3 varchar(32) ); and a CSV file 10,4,5,abc 13,7,3,def 18,12,77,ghi I'd like to UPDATE t1 (col1, col2, col3) from file with @1 as primary key; or UPDATE t1 (col1, col2, col3)

Re: [SQL] Rollback in Postgres

2008-07-15 Thread Simon Riggs
On Mon, 2008-07-14 at 22:54 -0400, Jonah H. Harris wrote: On Mon, Jul 14, 2008 at 9:18 PM, Tom Lane [EMAIL PROTECTED] wrote: Kaare Rasmussen [EMAIL PROTECTED] writes: But yes, it has to be enabled, and yes it has to have a performance cost somehow, but people are requesting it, and somehow

[SQL] How to GROUP results BY month

2008-07-15 Thread Oliveiros Cristina
Howdy, all, I have a problem. I have a table which one of the fields is of type date. I need to obtain the totals of the other fields in a by-month basis IS there any easy way to do this using the GROUP BY or any other construct? Thanks in advance for your kind help Best, Oliveiros -- Sent

Re: [SQL] How to GROUP results BY month

2008-07-15 Thread A. Kretschmer
am Tue, dem 15.07.2008, um 13:12:39 +0100 mailte Oliveiros Cristina folgendes: Howdy, all, I have a problem. I have a table which one of the fields is of type date. I need to obtain the totals of the other fields in a by-month basis IS there any easy way to do this using the GROUP BY

Re: [SQL] How to GROUP results BY month

2008-07-15 Thread Herouth Maoz
Oliveiros Cristina wrote: Howdy, all, I have a problem. I have a table which one of the fields is of type date. I need to obtain the totals of the other fields in a by-month basis IS there any easy way to do this using the GROUP BY or any other construct? Yes, use date_trunc( 'month',

Re: [SQL] How to GROUP results BY month

2008-07-15 Thread Herouth Maoz
Oliveiros Cristina wrote: Howdy, all, I have a problem. I have a table which one of the fields is of type date. I need to obtain the totals of the other fields in a by-month basis IS there any easy way to do this using the GROUP BY or any other construct? Yes, use date_trunc( 'month',

Re: [SQL] Rollback in Postgres

2008-07-15 Thread Jonah H. Harris
On Tue, Jul 15, 2008 at 2:17 AM, Simon Riggs [EMAIL PROTECTED] wrote: I agree such improvements would be welcomed. I'm pretty sure they sat around saying we can already do that some other way at first, until the requests started to pile up. Agreed. Stuff that they see fit to add is not

Re: [SQL] How to GROUP results BY month

2008-07-15 Thread Scott Marlowe
On Tue, Jul 15, 2008 at 6:12 AM, Oliveiros Cristina [EMAIL PROTECTED] wrote: Howdy, all, I have a problem. I have a table which one of the fields is of type date. I need to obtain the totals of the other fields in a by-month basis IS there any easy way to do this using the GROUP BY or any

Re: [SQL] How to GROUP results BY month

2008-07-15 Thread Mark Roberts
On Tue, 2008-07-15 at 14:31 +0200, A. Kretschmer wrote: am Tue, dem 15.07.2008, um 13:12:39 +0100 mailte Oliveiros Cristina folgendes: Howdy, all, I have a problem. I have a table which one of the fields is of type date. I need to obtain the totals of the other fields in a

Re: [SQL] How to GROUP results BY month

2008-07-15 Thread Scott Marlowe
On Tue, Jul 15, 2008 at 7:15 PM, Mark Roberts [EMAIL PROTECTED] wrote: On Tue, 2008-07-15 at 14:31 +0200, A. Kretschmer wrote: am Tue, dem 15.07.2008, um 13:12:39 +0100 mailte Oliveiros Cristina folgendes: Howdy, all, I have a problem. I have a table which one of the fields is of

Re: [SQL] COPY equivalent for updates

2008-07-15 Thread Decibel!
On Jul 15, 2008, at 1:10 AM, Ivan Sergio Borgonovo wrote: I'd like to UPDATE t1 (col1, col2, col3) from file with @1 as primary key; or UPDATE t1 (col1, col2, col3) from file where @1=id; sort of... Sorry, there's nothing like COPY for UPDATE. Otherwise what is the fastest approach? I