Re: [SQL] Help with quotes in plpgsql

2006-12-20 Thread Richard Huxton
Richard Ray wrote: It makes sense when ya'll explain it It never sounds that good when I'm talkin to myself That solves my problem but not my ignorance I'm still curious about how would I properly quote create or replace function test(integer) returns setof text as $$ declare a record; begin

Re: [SQL] Help with quotes in plpgsql

2006-12-20 Thread Richard Ray
It makes sense when ya'll explain it It never sounds that good when I'm talkin to myself That solves my problem but not my ignorance I'm still curious about how would I properly quote create or replace function test(integer) returns setof text as $$ declare a record; begin select into a now()

Re: [SQL] Help with quotes in plpgsql

2006-12-19 Thread Tom Lane
"Hector Villarreal" <[EMAIL PROTECTED]> writes: >select into a now() - ($1::text||'days')::interval; People keep suggesting variants of that as ways to convert numeric values to intervals, but it's really extremely bad practice. Much better is to use number-times-interval multiplication:

Re: [SQL] Help with quotes in plpgsql

2006-12-19 Thread Hector Villarreal
::interval; return next a; return; end $$ language 'plpgsql'; -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Milen A. Radev Sent: Tuesday, December 19, 2006 2:54 PM To: pgsql-sql@postgresql.org Subject: Re: [SQL] Help with quotes in plpgsql

Re: [SQL] Help with quotes in plpgsql

2006-12-19 Thread Milen A. Radev
Richard Ray написа: > On Tue, 19 Dec 2006, Milen A. Radev wrote: > >> Richard Ray : >>> How should this be properly quoted >>> >>> create or replace function test(integer) returns setof text as $$ >>> declare >>> a record; >>> begin >>> select into a now() - interval '$1 day'; >>>

Re: [SQL] Help with quotes in plpgsql

2006-12-19 Thread A. Kretschmer
am Tue, dem 19.12.2006, um 14:09:37 -0600 mailte Richard Ray folgendes: > How should this be properly quoted > > create or replace function test(integer) returns setof text as $$ > declare > a record; > begin > select into a now() - interval '$1 day'; > return next a; > return; > end > $$

Re: [SQL] Help with quotes in plpgsql

2006-12-19 Thread Richard Ray
On Tue, 19 Dec 2006, Milen A. Radev wrote: Richard Ray : How should this be properly quoted create or replace function test(integer) returns setof text as $$ declare a record; begin select into a now() - interval '$1 day'; return next a; return; end $$ language 'plpgsql';

Re: [SQL] Help with quotes in plpgsql

2006-12-19 Thread Richard Ray
:10 PM To: pgsql-sql@postgresql.org Subject: [SQL] Help with quotes in plpgsql How should this be properly quoted create or replace function test(integer) returns setof text as $$ declare a record; begin select into a now() - interval '$1 day'; return next a; return; end $$

Re: [SQL] Help with quotes in plpgsql

2006-12-19 Thread Hector Villarreal
turn; end $$ language 'plpgsql'; -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Richard Ray Sent: Tuesday, December 19, 2006 12:10 PM To: pgsql-sql@postgresql.org Subject: [SQL] Help with quotes in plpgsql How should this be properly

Re: [SQL] Help with quotes in plpgsql

2006-12-19 Thread Milen A. Radev
Richard Ray написа: > How should this be properly quoted > > create or replace function test(integer) returns setof text as $$ > declare > a record; > begin > select into a now() - interval '$1 day'; > return next a; > return; > end > $$ language 'plpgsql'; > > I'm not having a lot of luc

Re: [SQL] Help with quotes in plpgsql

2006-12-19 Thread Jim Buttafuoco
Try select into a now() - interval ($1 || ' day') -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Richard Ray Sent: Tuesday, December 19, 2006 3:10 PM To: pgsql-sql@postgresql.org Subject: [SQL] Help with quotes in plpgsql How should this b

[SQL] Help with quotes in plpgsql

2006-12-19 Thread Richard Ray
How should this be properly quoted create or replace function test(integer) returns setof text as $$ declare a record; begin select into a now() - interval '$1 day'; return next a; return; end $$ language 'plpgsql'; I'm not having a lot of luck Thanks Richard ---