PgAdmin errors

Started by Hall, Samuel L (Sam)about 12 years ago10 messagesgeneral
Jump to latest
#1Hall, Samuel L (Sam)
sam.hall@alcatel-lucent.com

When I try to run SQL from PgAdmin : CREATE TABLE tse_history_old LIKE tse_history INCLUDING ALL WITH OIDS
I get this error
ERROR: syntax error at or near "LIKE"
LINE 2: CREATE TABLE tse_history_old LIKE tse_history INCLUDING ALL ...

testing, I find that using the word "LIKE" always causes errors

"PostgreSQL 9.3.0 on x86_64-unknown-linux-gnu, compiled by gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3, 64-bit"
Running PgAdmin on Windows 7 64 bit

What I need to do is copy a table completely, all data, indexes, keys

#2John R Pierce
pierce@hogranch.com
In reply to: Hall, Samuel L (Sam) (#1)
Re: PgAdmin errors

On 3/26/2014 12:32 PM, Hall, Samuel L (Sam) wrote:

When I try to run SQL from PgAdmin : CREATE TABLE tse_history_old LIKE
tse_history INCLUDING ALL WITH OIDS

I get this error

ERROR: syntax error at or near "LIKE"

LINE 2: CREATE TABLE tse_history_old LIKE tse_history INCLUDING ALL ...

from the manual, it appears LIKE belongs in parenthesis.

CREATE TABLE tse_history_old (LIKE tse_history INCLUDING ALL) WITH OIDS

--
john r pierce 37N 122W
somewhere on the middle of the left coast

#3Hall, Samuel L (Sam)
sam.hall@alcatel-lucent.com
In reply to: John R Pierce (#2)
Re: PgAdmin errors

That doesn't help. Even this CREATE TABLE tse_history_old (LIKE tse_history) gives an error

From: pgsql-general-owner@postgresql.org [mailto:pgsql-general-owner@postgresql.org] On Behalf Of John R Pierce
Sent: Wednesday, March 26, 2014 2:43 PM
To: pgsql-general@postgresql.org
Subject: Re: [GENERAL] PgAdmin errors

On 3/26/2014 12:32 PM, Hall, Samuel L (Sam) wrote:
When I try to run SQL from PgAdmin : CREATE TABLE tse_history_old LIKE tse_history INCLUDING ALL WITH OIDS
I get this error
ERROR: syntax error at or near "LIKE"
LINE 2: CREATE TABLE tse_history_old LIKE tse_history INCLUDING ALL ...

from the manual, it appears LIKE belongs in parenthesis.

CREATE TABLE tse_history_old (LIKE tse_history INCLUDING ALL) WITH OIDS

--

john r pierce 37N 122W

somewhere on the middle of the left coast

#4John R Pierce
pierce@hogranch.com
In reply to: Hall, Samuel L (Sam) (#3)
Re: PgAdmin errors

On 3/26/2014 12:58 PM, Hall, Samuel L (Sam) wrote:

That doesn't help. Even this CREATE TABLE tse_history_old (LIKE
tse_history) gives an error

the exact same error ?

--
john r pierce 37N 122W
somewhere on the middle of the left coast

#5Hall, Samuel L (Sam)
sam.hall@alcatel-lucent.com
In reply to: John R Pierce (#4)
Re: PgAdmin errors

ERROR: syntax error at or near "LIKE"
LINE 2: CREATE TABLE tse_history_old (LIKE tse_history)
^

From: pgsql-general-owner@postgresql.org [mailto:pgsql-general-owner@postgresql.org] On Behalf Of John R Pierce
Sent: Wednesday, March 26, 2014 3:02 PM
To: pgsql-general@postgresql.org
Subject: Re: [GENERAL] PgAdmin errors

On 3/26/2014 12:58 PM, Hall, Samuel L (Sam) wrote:
That doesn't help. Even this CREATE TABLE tse_history_old (LIKE tse_history) gives an error

the exact same error ?

--

john r pierce 37N 122W

somewhere on the middle of the left coast

#6John Pierce
jhn.pierce@gmail.com
In reply to: Hall, Samuel L (Sam) (#5)
Re: PgAdmin errors

On 3/26/2014 1:07 PM, Hall, Samuel L (Sam) wrote:

ERROR: syntax error at or near "LIKE"

LINE 2: CREATE TABLE tse_history_old (LIKE tse_history)

thats the syntax from
http://www.postgresql.org/docs/current/static/sql-createtable.html

try it in psql instead of pgadmin ?

earlier, you mentioned...

"PostgreSQL 9.3.0 on x86_64-unknown-linux-gnu, compiled by gcc
(Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3, 64-bit"

BTW, you really should update that database server to 9.3.4

What I need to do is copy a table completely, all data, indexes, keys

COPY TABLE ... (LIKE ...) will copy fields, constraints, and indexes
(given that you used INCLUDING ALL), but it doesn't copy data.

#7Tom Lane
tgl@sss.pgh.pa.us
In reply to: Hall, Samuel L (Sam) (#5)
Re: PgAdmin errors

"Hall, Samuel L (Sam)" <sam.hall@alcatel-lucent.com> writes:

ERROR: syntax error at or near "LIKE"
LINE 2: CREATE TABLE tse_history_old (LIKE tse_history)

You're certain the server you're talking to is 9.3?
("SELECT version()" is a good way to be sure.)

regards, tom lane

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

#8Hall, Samuel L (Sam)
sam.hall@alcatel-lucent.com
In reply to: Tom Lane (#7)
Re: PgAdmin errors

Yes
"PostgreSQL 9.3.0 on x86_64-unknown-linux-gnu, compiled by gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3, 64-bit"

-----Original Message-----
From: Tom Lane [mailto:tgl@sss.pgh.pa.us]
Sent: Wednesday, March 26, 2014 4:03 PM
To: Hall, Samuel L (Sam)
Cc: John R Pierce; pgsql-general@postgresql.org
Subject: Re: [GENERAL] PgAdmin errors

"Hall, Samuel L (Sam)" <sam.hall@alcatel-lucent.com> writes:

ERROR: syntax error at or near "LIKE"
LINE 2: CREATE TABLE tse_history_old (LIKE tse_history)

You're certain the server you're talking to is 9.3?
("SELECT version()" is a good way to be sure.)

regards, tom lane

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

#9Adrian Klaver
adrian.klaver@aklaver.com
In reply to: Hall, Samuel L (Sam) (#8)
Re: PgAdmin errors

On 03/26/2014 02:13 PM, Hall, Samuel L (Sam) wrote:

Yes
"PostgreSQL 9.3.0 on x86_64-unknown-linux-gnu, compiled by gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3, 64-bit"

So what happens when you run the command from psql ?

--
Adrian Klaver
adrian.klaver@aklaver.com

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

#10Alvaro Herrera
alvherre@2ndquadrant.com
In reply to: Hall, Samuel L (Sam) (#5)
Re: PgAdmin errors

Hall, Samuel L (Sam) wrote:

ERROR: syntax error at or near "LIKE"
LINE 2: CREATE TABLE tse_history_old (LIKE tse_history)
^

Note it says this is on line 2. What have you got in the previous line?
(psql has \p to show existing query buffer contents but I don't know if
pgadmin has such a facility).

--
�lvaro Herrera http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general