Search Postgresql Archives

Re: Syntax error in spi_prepare usage

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

 



> If I remove the braces from (\$1, \$2, \$3) then it gives below error.
> 
>  my $query = (<<ENDQUERY);
>   INSERT INTO changelogtest(id, txid, txtime)
>   SELECT  \$1, \$2, \$3
>   EXCEPT
>   SELECT (id, txid, txtime)
>   FROM changelogtest
>   WHERE id = \$1
>   AND txid = \$2
>   AND txtime = \$3;
>  ENDQUERY
>  
> techdb=# SELECT insert_history_info();
> ERROR:  error from Perl function "insert_history_info": each EXCEPT query must have the same number of columns at line 15.

Yes of course, your select lists are different. Try:
>  my $query = (<<ENDQUERY);
>   INSERT INTO changelogtest(id, txid, txtime)
>   SELECT  \$1, \$2, \$3
>   EXCEPT
>   SELECT id, txid, txtime
>   FROM changelogtest
>   WHERE id = \$1
>   AND txid = \$2
>   AND txtime = \$3;
>  ENDQUERY

Alban Hertroys

--
If you can't see the forest for the trees,
cut the trees and you'll see there is no forest.


!DSPAM:737,4bd3201310412109115467!



-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[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