Syntax Error Inserting From STDIN?

Started by Hunter Hillegasover 20 years ago6 messagesgeneral
Jump to latest
#1Hunter Hillegas
lists@lastonepicked.com

I am trying to run the following:

COPY departments (id, issue_id, title, description, feature_type) FROM
stdin;
23 4 Local Buzz Things to do, people to see, places to go. aspen

I get back:

COPY departments (id, issue_id, title, description, feature_type) FROM
stdin;

23 4 Local Buzz Things to do, people to see, places to go. aspen

ERROR: syntax error at or near "23" at character 80

What am I doing wrong? I am on 8.1.1...

The table is defined as:

--------------+------------------------+------------------------------------
----------------------
id | integer | not null default
issue_id | integer |
title | character varying(255) |
description | character varying(255) |
feature_type | character varying(255) |

Thx.

#2Scott Marlowe
smarlowe@g2switchworks.com
In reply to: Hunter Hillegas (#1)
Re: Syntax Error Inserting From STDIN?

On Tue, 2005-12-20 at 13:30, Hunter's Lists wrote:

I am trying to run the following:

COPY departments (id, issue_id, title, description, feature_type) FROM
stdin;
23 4 Local Buzz Things to do, people to see, places to go. aspen

I get back:

COPY departments (id, issue_id, title, description, feature_type) FROM
stdin;

23 4 Local Buzz Things to do, people to see, places to go. aspen

ERROR: syntax error at or near "23" at character 80

Seeing that "character 80" I'm gonna guess this is a CR/LF issue. I.e.
pgsql on your machine is seeing the 23 as being on the same line as the
copy departments statement.

#3Hunter Hillegas
lists@lastonepicked.com
In reply to: Scott Marlowe (#2)
Re: Syntax Error Inserting From STDIN?

Interesting.

How would I go about solving that?

I inserted an extra line between the two, no dice.

Show quoted text

From: Scott Marlowe <smarlowe@g2switchworks.com>
Date: Tue, 20 Dec 2005 13:53:37 -0600
To: Hunter's Lists <lists@lastonepicked.com>
Cc: PostgreSQL <pgsql-general@postgresql.org>
Subject: Re: [GENERAL] Syntax Error Inserting From STDIN?

On Tue, 2005-12-20 at 13:30, Hunter's Lists wrote:

I am trying to run the following:

COPY departments (id, issue_id, title, description, feature_type) FROM
stdin;
23 4 Local Buzz Things to do, people to see, places to go. aspen

I get back:

COPY departments (id, issue_id, title, description, feature_type) FROM
stdin;

23 4 Local Buzz Things to do, people to see, places to go. aspen

ERROR: syntax error at or near "23" at character 80

Seeing that "character 80" I'm gonna guess this is a CR/LF issue. I.e.
pgsql on your machine is seeing the 23 as being on the same line as the
copy departments statement.

#4Tom Lane
tgl@sss.pgh.pa.us
In reply to: Hunter Hillegas (#1)
Re: Syntax Error Inserting From STDIN?

"Hunter's Lists" <lists@lastonepicked.com> writes:

I get back:

COPY departments (id, issue_id, title, description, feature_type) FROM
stdin;

23 4 Local Buzz Things to do, people to see, places to go. aspen

ERROR: syntax error at or near "23" at character 80

How are you feeding this into Postgres exactly? Scott's right that it
looks like the connection isn't getting switched into COPY mode at the
right instant, but you haven't given us any hint about why that might
be happening.

regards, tom lane

#5Scott Marlowe
smarlowe@g2switchworks.com
In reply to: Hunter Hillegas (#3)
Re: Syntax Error Inserting From STDIN?

quick answer, try a different editor.

Are you editing in the same environment as the database is in, or are
you editing on windows and feeding the copy data in on another platform?

Show quoted text

On Tue, 2005-12-20 at 14:40, Hunter's Lists wrote:

Interesting.

How would I go about solving that?

I inserted an extra line between the two, no dice.

From: Scott Marlowe <smarlowe@g2switchworks.com>
Date: Tue, 20 Dec 2005 13:53:37 -0600
To: Hunter's Lists <lists@lastonepicked.com>
Cc: PostgreSQL <pgsql-general@postgresql.org>
Subject: Re: [GENERAL] Syntax Error Inserting From STDIN?

On Tue, 2005-12-20 at 13:30, Hunter's Lists wrote:

I am trying to run the following:

COPY departments (id, issue_id, title, description, feature_type) FROM
stdin;
23 4 Local Buzz Things to do, people to see, places to go. aspen

I get back:

COPY departments (id, issue_id, title, description, feature_type) FROM
stdin;

23 4 Local Buzz Things to do, people to see, places to go. aspen

ERROR: syntax error at or near "23" at character 80

Seeing that "character 80" I'm gonna guess this is a CR/LF issue. I.e.
pgsql on your machine is seeing the 23 as being on the same line as the
copy departments statement.

#6Hunter Hillegas
lists@lastonepicked.com
In reply to: Scott Marlowe (#5)
Re: Syntax Error Inserting From STDIN?

Everything was on OS X.

Looks like it was a problem with spaces vs. tabs. Anyway, I went through and
fixed all the lines and everything went in.

We had a strange problem restoring a 8.0.4 dump to a 8.1.1 server and this
was the last of the data that had to be re-imported.

Show quoted text

From: Scott Marlowe <smarlowe@g2switchworks.com>
Date: Tue, 20 Dec 2005 16:41:32 -0600
To: Hunter's Lists <lists@lastonepicked.com>
Cc: PostgreSQL <pgsql-general@postgresql.org>
Subject: Re: [GENERAL] Syntax Error Inserting From STDIN?

quick answer, try a different editor.

Are you editing in the same environment as the database is in, or are
you editing on windows and feeding the copy data in on another platform?

On Tue, 2005-12-20 at 14:40, Hunter's Lists wrote:

Interesting.

How would I go about solving that?

I inserted an extra line between the two, no dice.

From: Scott Marlowe <smarlowe@g2switchworks.com>
Date: Tue, 20 Dec 2005 13:53:37 -0600
To: Hunter's Lists <lists@lastonepicked.com>
Cc: PostgreSQL <pgsql-general@postgresql.org>
Subject: Re: [GENERAL] Syntax Error Inserting From STDIN?

On Tue, 2005-12-20 at 13:30, Hunter's Lists wrote:

I am trying to run the following:

COPY departments (id, issue_id, title, description, feature_type) FROM
stdin;
23 4 Local Buzz Things to do, people to see, places to go. aspen

I get back:

COPY departments (id, issue_id, title, description, feature_type) FROM
stdin;

23 4 Local Buzz Things to do, people to see, places to go. aspen

ERROR: syntax error at or near "23" at character 80

Seeing that "character 80" I'm gonna guess this is a CR/LF issue. I.e.
pgsql on your machine is seeing the 23 as being on the same line as the
copy departments statement.

---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster