postgresql insert syntax error

XML, Perl, Python, and other languages can be discussed here, even if it isn't PHP (We might forgive you).

Moderator: General Moderators

Post Reply
User avatar
barb woolums
Forum Contributor
Posts: 134
Joined: Sun Feb 08, 2009 9:52 pm

postgresql insert syntax error

Post by barb woolums »

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

Here is my table definition
Screenshot_15.jpg
SQL

Code: Select all

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
User avatar
Christopher
Site Administrator
Posts: 13595
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: postgresql insert syntax error

Post by Christopher »

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

GET DIAGNOSTICS integer_var = ROW_COUNT;
(#10850)
User avatar
barb woolums
Forum Contributor
Posts: 134
Joined: Sun Feb 08, 2009 9:52 pm

Re: postgresql insert syntax error

Post by barb woolums »

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.
User avatar
barb woolums
Forum Contributor
Posts: 134
Joined: Sun Feb 08, 2009 9:52 pm

Re: postgresql insert syntax error

Post by barb woolums »

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