12

I create a new database 'sakila' with pgAdmin III in my local PostgreSQL database, then executed these sql statements:

sakila-schema.sql then sakila-data.sql

The first statement executed without error, however the second SQL did produced error when executed:

ERROR:  syntax error at or near "1"
LINE 112: 1 PENELOPE GUINESS 2006-02-15 09:34:33
          ^

********** Error **********

ERROR: syntax error at or near "1"
SQL state: 42601
Character: 2511

How to fix this error?

2
  • 4
    It seems pgAdmin does not support copy from stdin... Try to run the script using psql Commented Jul 26, 2012 at 16:30
  • 1
    I have succeeded in creating and populating the data here. I first had to do (from psql -U postgres postgres) create database sakila, and then (from the commandline) psql -U postgres sakila <sakila-schema.sql, followed by psql -U postgres sakila <sakila-data.sql Commented Jul 27, 2012 at 13:33

1 Answer 1

18

You can't COPY FROM stdin with pgAdmin, you have to use psql tool, the problem is that pgAdmin is not a console application, there is no easily usable stdin so you can't COPY from Standard Input .

Sign up to request clarification or add additional context in comments.

3 Comments

I tried running "/i C:/postgresql/sakila-data.sql" (without the quotes), no errors but it didn't do a thing, since if I SELECT from the database tables its empty...
@xybrek \i not /i , and I'd say you didn't get any error because, except for backslash commands, psql doesn't respond to a command until a semicolon is found in the input.
@xybrek try to import with psql -U postgres db_name < file.sql

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.