Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

Trying to execute a standard insert query, but it doesn't work.

INSERT INTO users (vk_id, eu_name, eu_society, eu_notes, eu_want_team)
VALUES ("123123133","Eu name","Eu society","Eu notes","true")

The error I get is the following:

ERROR:  syntax error at or near "INTO" LINE 1: SELECT COUNT(*) AS
 total FROM (INSERT INTO users (vk_id, eu_...

What is causing this error?

share|improve this question
2  
The error message is showing you the error: SELECT COUNT(*) AS total FROM (INSERT ... –  ypercube Aug 21 '13 at 22:36
    
I dont have any clues.... I dont have SELECT COUNT(*) AS total FROM so i dont know where it is taken –  user2705406 Aug 21 '13 at 22:37
2  
Are all those double-quotes okay in postgresql? The documentation I'm looking at just shows single quotes. And does it need a terminating semicolon? –  Goat CO Aug 21 '13 at 22:40
2  
BTW: the strings inside the values need to be in single quotes: VALUES(123123133,'Eu name','Eu society','Eu notes',true) –  wildplasser Aug 21 '13 at 22:40
2  
Well, this could be a bug in phpPgAdmin, I see a report opened in May: Bugs item #3612602, was opened at 2013-05-03 –  ypercube Aug 21 '13 at 23:06
show 6 more comments

1 Answer

I've installed phpPgAdmin to try to reproduce your error. I got it right away when tried to create a test table:

enter image description here

So looks like phpPgAdmin wraping your query into select count(*) as total from (...). I've found that it happens only when checkbox "Paginate results" on query page is set to on (obviously phpPgAdmin trying to count how many rows it will get and then show it page by page). Uncheck it and your query will work fine:

enter image description here

see similar question - INSERT INTO PostgreSQL

share|improve this answer
    
Great answer, should be checked as correct! –  zavg Dec 6 '13 at 15:14
    
Would never have guessed! You deserve that green checkmark! –  ADTC Dec 18 '13 at 8:17
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.