From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | "Chris Ochs" <chris(at)paymentonline(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: casting parameters to a function |
Date: | 2004-01-14 00:16:34 |
Message-ID: | 14898.1074039394@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
"Chris Ochs" <chris(at)paymentonline(dot)com> writes:
> I was playing around with trying to convert types, but it isn't working so
> far. The function takes a single varchar[] as an argument..
> This doesn't work:
> s ALIAS FOR $1;
> in_trans_date timestamp := s[3];
> and this doesn't work either:
> in_trans_date timestamp := $1[3];
These should work, and do work in CVS tip, but in 7.4 and before you'll
need to do the assignment separately from the variable declaration, eg
DECLARE
s ALIAS FOR $1;
in_trans_date timestamp;
BEGIN
in_trans_date := s[3];
...
PITA, I know, but the previous coding didn't allow any variable
references in initialization expressions. If it really bugs you
you could drop the CVS-tip version of src/pl/plpgsql/src/gram.y
into 7.4 to get the fix:
2003-12-22 19:01 tgl
* src/pl/plpgsql/src/gram.y: Allow plpgsql variables' default value
expressions to reference existing variables (such as function
parameters). Per gripe from David Fetter.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Nigel J. Andrews | 2004-01-14 00:17:37 | Re: Nested transaction - I am a bank ?? |
Previous Message | Chris Ochs | 2004-01-14 00:10:05 | Re: casting parameters to a function |