Re: Setting expire date on insert/modify

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Foster, Stephen" <stephenlfoster(at)comcast(dot)net>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Setting expire date on insert/modify
Date: 2006-01-25 03:47:29
Message-ID: 25891.1138160849@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"Foster, Stephen" <stephenlfoster(at)comcast(dot)net> writes:
> Michael, I tried that line in the trigger procedure with double quotes,
> single quotes and without. The only way it would save was with single
> quotes and that is why you saw it that way.

Just for reference, the thing that was tripping you up (or one thing
that was tripping you up at least) was trying to extrapolate the syntax

typename 'literal value'

to situations where you didn't mean an actual literal constant. This
syntax is something that's forced on us by the SQL standard, but we do
not support it for anything but literal constants (which is all that the
standard defines it for, either). In the examples you gave, you wanted
to coerce the value of a variable of one type to some other type, and so
you should have written either

CAST( variablename AS typename )
or
variablename :: typename

the former being the SQL-spec syntax for a runtime type conversion
and the latter being a traditional Postgres abbreviation.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Bruce Momjian 2006-01-25 03:54:53 Re: hardware checks (was Re: invalid memory alloc request
Previous Message Tom Lane 2006-01-25 03:34:55 Re: pgxml