Search Postgresql Archives

Re: Instead trigger on a view to update base tables ?

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

 



On Tue, Aug 7, 2018 at 12:09 PM, Day, David <dday@xxxxxxxxxx> wrote:
EXECUTE format(' UPDATE admin.user SET (%I) = ( SELECT %I FROM $1 )  WHERE id = $2)', USER_SETTING, USER_SETTING )
                    USING NEW,  NEW.id;

When this executes my exception handler generates "err syntax error at or near \"$1\"

The value after FROM must be an identifier and so cannot be parameterized.  You have to use "%I" for that dynamic element as well - only $2 (which becomes $1) is valid to parameterize (though you could just do "%L" and drop the USING clause on the EXECUTE...)

David J.


[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