Search Postgresql Archives

Re: Setting expire date on insert/modify

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On Jan 25, 2006, at 10:12 , Foster, Stephen wrote:

If I try to save without which was what I did in the first place I
receive this using "ExpireDate := (date StartDate + integer NumOfDays);"

ERROR:  syntax error at or near "$1" at character 16
QUERY:  SELECT  (date  $1  + integer  $2 )
CONTEXT:  SQL statement in PL/PgSQL function "TF_BannerAd_Ads_InsMod"
near line 8

The common ways of casting in PostgreSQL are some_value::some_type, e.g., "ExpireDate"::date, or using CAST, e.g., CAST ("ExpireDate" as date). In the general case, some_type some_value will not work.

The docs can also be very helpful. I myself just looked up the syntax of the CAST expression (I generally use the double-colon method).

See if that makes a difference.

Michael Glaesemann
grzm myrealbox com





[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux