Re: Setting expire date on insert/modify - Mailing list pgsql-general

From Michael Glaesemann
Subject Re: Setting expire date on insert/modify
Date
Msg-id 780F3D40-B0FE-4BB1-94E0-9A1A11D9AC99@myrealbox.com
Whole thread Raw
In response to Re: Setting expire date on insert/modify  ("Foster, Stephen" <stephenlfoster@comcast.net>)
List pgsql-general
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




pgsql-general by date:

Previous
From: Benjamin Smith
Date:
Subject: Postgresql Segfault in 8.1
Next
From: Stephan Szabo
Date:
Subject: Re: Setting expire date on insert/modify