PHP Developers Network
http://forums.devnetwork.net/

postgresql insert syntax error
http://forums.devnetwork.net/viewtopic.php?f=14&t=147858
Page 1 of 1

Author:  barb woolums [ Wed Aug 08, 2018 9:14 pm ]
Post subject:  postgresql insert syntax error

This is driving me nuts, can't see the problem here.

Here is my table definition

Screenshot_15.jpg
Screenshot_15.jpg [ 38.42 KiB | Viewed 37465 times ]


SQL

Syntax: [ Download ] [ Hide ]
INSERT INTO custwelc_section (owner, sheader, scontent) VALUES (5, 'about me', 'vvvvvvvvvvvvvvvvv');


error in phpPgAdmin

SQL error:

ERROR: syntax error at or near "INTO"
LINE 1: SELECT COUNT(*) AS total FROM (INSERT INTO custwelc_section ...
^

In statement:
SELECT COUNT(*) AS total FROM (INSERT INTO custwelc_section (owner, sheader, scontent) VALUES (5, 'about me', 'vvvvvvvvvvvvvvvvv')) AS sub

Author:  Christopher [ Wed Aug 08, 2018 10:24 pm ]
Post subject:  Re: postgresql insert syntax error

I don't think you can use an INSERT as a sub-select. Maybe try:

GET DIAGNOSTICS integer_var = ROW_COUNT;

Author:  barb woolums [ Wed Aug 08, 2018 10:43 pm ]
Post subject:  Re: postgresql insert syntax error

I didn't use it as a subselect, that's just how is is displayed in the error. All I entered was the insert statement as shown.

Author:  barb woolums [ Wed Aug 08, 2018 10:55 pm ]
Post subject:  Re: postgresql insert syntax error

It's working now, and the only thing I did was try it in pgadmin :)

Page 1 of 1 All times are UTC - 5 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/