Forum .LRN Q&A: PG ERROR: 'CURRENT' is no longer supported

I get the following error when trying to install the simulation package on the 5.0 branch. I see there have been a lot of changes in acs-content-repository lately but I'm not sure that is related. Does this ring a bell for anyone?

[10/Feb/2004:02:02:13][31380.1081916224][-conn1-] Notice: apm_invoke_callback_proc: invoking callback after-install with command simulation::apm::after_i\
nstall
[10/Feb/2004:02:02:14][31380.1081916224][-conn1-] Notice: apm_invoke_callback_proc: invoking callback after-instantiate with command simulation::apm::aft\
er_instantiate  -package_id 608
[10/Feb/2004:02:02:14][31380.1081916224][-conn1-] Error: Ns_PgExec: result status: 7 message: ERROR:  'CURRENT' is no longer supported

[10/Feb/2004:02:02:14][31380.1081916224][-conn1-] Error: <p><font color=red>Simulation not installed.</font>
<p> Error:
<pre><blockquote>Transaction aborted: Database operation &quot;0or1row&quot; failed (exception NSDB, &quot;Query was not a statement returning rows.&quot\
;)

ERROR:  'CURRENT' is no longer supported

SQL:

        select content_folder__new('simulation_608_root','Simulation Root',NULL,'0','608',NULL,'current_timestamp',NULL,'213.150.51.66','null')

      </blockquote><blockquote>Database operation &quot;0or1row&quot; failed (exception NSDB, &quot;Query was not a statement returning rows.&quot;)

ERROR:  'CURRENT' is no longer supported

SQL:

        select content_folder__new('simulation_608_root','Simulation Root',NULL,'0','608',NULL,'current_timestamp',NULL,'213.150.51.66','null')


    while executing
&quot;ns_pg_bind 0or1row nsdb0 {

        select content_folder__new(:name,:label,:description,:parent_id,:context_id,:folder_id,'current_timestamp',:creation_user...&quot;
    (&quot;uplevel&quot; body line 1)
    invoked from within
&quot;uplevel $ulevel [list ns_pg_bind $type $db $sql&quot;
    (&quot;postgresql&quot; arm line 2)
    invoked from within
&quot;switch $driverkey {
                oracle {
                    return [uplevel $ulevel [list ns_ora $type $db $sql] $args]
                }
      ...&quot;
    invoked from within
&quot;db_exec 0or1row $db $full_statement_name $sql&quot;
    invoked from within
&quot;if {[regexp -nocase -- {^\s*select} $test_sql match]} {
                ns_log Debug &quot;PLPGSQL: bypassed anon function&quot;
                set selection [...&quot;
    (&quot;uplevel&quot; body line 6)
    invoked from within
&quot;uplevel 1 $code_block &quot;
    invoked from within
&quot;db_with_handle -dbn $dbn db {
            # plsql calls that are simple selects bypass the plpgsql
            # mechanism for creating anonymous fun...&quot;
    (procedure &quot;db_exec_plsql&quot; line 57)
    invoked from within
&quot;db_exec_plsql create_object {}&quot;
    (procedure &quot;package_instantiate_object&quot; line 98)
    invoked from within
&quot;package_instantiate_object  -extra_vars $extra_vars  -package_name &quot;content_folder&quot;  &quot;content_folder&quot;&quot;
    invoked from within
&quot;set folder_id [package_instantiate_object  -extra_vars $extra_vars  -package_name &quot;content_folder&quot;  &quot;content_folder&quot;]&quot;
    (&quot;uplevel&quot; body line 2)
    invoked from within
&quot;uplevel 1 $transaction_code &quot;
    (procedure &quot;db_transaction&quot; line 1)
    invoked from within
&quot;db_transaction {
        set folder_id [package_instantiate_object  -extra_vars $extra_vars  -package_name &quot;content_folder&quot;  &quot;content_folder&quot;]

      ...&quot;
    (procedure &quot;bcms::folder::create_folder&quot; line 11)
    invoked from within
&quot;bcms::folder::create_folder  -name &quot;simulation_${package_id}_root&quot;  -folder_label &quot;${instance_name} Root&quot;  -parent_id 0  -packa\
ge_id $package_id  -con...&quot;
    (procedure &quot;simulation::apm::after_instantiate&quot; line 5)
    invoked from within
&quot;simulation::apm::after_instantiate  -package_id 608&quot;

Collapse
Posted by Dave Bauer on
Peter,

I don't think any changes to the content repository have occured for OpenACS 5.0. I changed some things on HEAD but I did not change content_folder__new at all.

I do see that 'current_timestamp' is in single quotes. Is that the correct way to pass that in to a timestamp datatype? Normally I see that unquoted.

Which version of Postgresql are you using?

Collapse
Posted by Don Baccus on
We need to use 'now', not 'current_timestamp', which the time parser no longer recognizes.

Note that current_timestamp, the variable not the quoted string, does of course work.

I ran into this myself yesterday and have fixed it on head.

The problem has to do with the way define_function_args is written - it quotes the default values (or passes them as :tclvars to the driver, which does the quoting, not sure which).  In retrospect it would be best if define_function_args didn't do that but it's not worth changing at this point.

I guess this needs fixing for 5.0.1 too?  Changing "creation_date;current_timestamp" to "creation_date;now", that is, in calls to define_function_args.

Sigh ... all these near-silent changes the PG group makes bite us in the ass, don't they? :)