Re: [SQL] UPDATE WITH ORDER BY

2005-04-27 Thread Greg Sabino Mullane
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 (Please send email as text, not HTML) I need to make an UPDATE on a column reordering it with a sequence using order by a description ... BEGIN; CREATE SEQUENCE fruit_seq; CREATE TABLE newfruit AS SELECT nextval('fruit_seq')::int AS newid, *

[SQL] trigger/rule question

2005-04-27 Thread Enrico Weigelt
Hi folks, for database synchronization I'm maintaining an mtime field in each record and I'd like to get it updated automatically on normal writes (insert seems trivial, but update not), but it must remain untouched when data is coming in from another node (to prevent sync loops). I first

[SQL] SYNTAX ERROR ON FOR... LOOP

2005-04-27 Thread Rodrigo Carvalhaes
Hi Guys, I am having a simple syntax problem but very strange... I am trying to make an IF / ELSE / END IF inside of a FOR ... LOOP but I am getting syntax error on this contol structure... If I comment the IF / ELSE / ENDIF the fuction works ... I am using PostgreSQL win 8.0 Any tip ? :-D The

Re: [SQL] SYNTAX ERROR ON FOR... LOOP

2005-04-27 Thread Michael Fuhr
On Wed, Apr 27, 2005 at 02:39:53PM -0300, Rodrigo Carvalhaes wrote: I am trying to make an IF / ELSE / END IF inside of a FOR ... LOOP but I am getting syntax error on this contol structure... [snip] IF records.is_customer IS FALSE THEN vstrupdate := vstrupdate || $$ IS true $$; ELSE

Re: [SQL] SYNTAX ERROR ON FOR... LOOP

2005-04-27 Thread George Weaver
Hi Rodrigo, - Original Message - From: Rodrigo Carvalhaes [EMAIL PROTECTED] To: pgsql-sql@postgresql.org Sent: Wednesday, April 27, 2005 12:39 PM Subject: [SQL] SYNTAX ERROR ON FOR... LOOP Hi Guys, I am having a simple syntax problem but very strange... I am trying to make an IF / ELSE

Re: [SQL] SYNTAX ERROR ON FOR... LOOP

2005-04-27 Thread Tom Lane
Rodrigo Carvalhaes [EMAIL PROTECTED] writes: I am trying to make an IF / ELSE / END IF inside of a FOR ... LOOP but I am getting syntax error on this contol structure... If I comment the IF / ELSE / ENDIF the fuction works ... plpgsql wants END IF not ENDIF. regards,

Re: [SQL] SYNTAX ERROR ON FOR... LOOP

2005-04-27 Thread Rodrigo Carvalhaes
Guys, sometimes I make stupid things... I t was the END IF as all of you said... Thanks for your exists. Cheers, Rodrigo Tom Lane wrote: Rodrigo Carvalhaes [EMAIL PROTECTED] writes: I am trying to make an IF / ELSE / END IF inside of a FOR ... LOOP but I am getting syntax