On Wed, Mar 28, 2012 at 3:40 PM, Merlin Moncure <mmoncure@xxxxxxxxx> wrote:
On Wed, Mar 28, 2012 at 2:08 PM, Kenneth Tilton <ktilton@xxxxxxxx> wrote:your'e missing a 'select' in there. functions must be called through
> Thanks, Merlin. Maybe I have some subtle detail wrong. When
> NEW.warn_time_init is 'now_plus_30' and I have this as my execute statement:
>
> execute NEW.warn_time_init || '($1)' into bpa using NEW;
>
> ...I get:
>
select (just like you can't call a function by name in psql without
it).
Well then I have the other error. With this code:
execute 'select ' || NEW.warn_time_init || '($1)' into bpa using NEW;
I get:
NOTICE: bpa inbound (,now_plus_30)
CONTEXT: SQL statement "select now_plus_30($1)"
PL/pgSQL function "bp_alert_init" line 6 at EXECUTE statement
NOTICE: warn time in input row = ("2012-04-27 19:04:37.793835+00",now_plus_30)
CONTEXT: SQL statement "select now_plus_30($1)"
PL/pgSQL function "bp_alert_init" line 6 at EXECUTE statement
ERROR: invalid input syntax for type timestamp with time zone: "("2012-04-27 19:04:37.793835+00",now_plus_30)"
CONTEXT: PL/pgSQL function "bp_alert_init" line 6 at EXECUTE statement
********** Error **********
ERROR: invalid input syntax for type timestamp with time zone: "("2012-04-27 19:04:37.793835+00",now_plus_30)"
SQL state: 22007
Context: PL/pgSQL function "bp_alert_init" line 6 at EXECUTE statement
I guess you are right, though. This is the error I have to resolve.
Thx,
-kt