syntax error with example sql of createtable

Started by Honda Shigehiroover 21 years ago4 messagesdocs
Jump to latest
#1Honda Shigehiro
fwif0083@mb.infoweb.ne.jp

Hello,

I got a error when execute below command in
http://developer.postgresql.org/docs/postgres/sql-createtable.html

postgres=# CREATE TABLE array (vector int[][]);
ERROR: syntax error at or near "array" at character 14
LINE 1: CREATE TABLE array (vector int[][]);

^
(I tried it on 8.0.0rc2.)

'array' is a reserved word, so it needs quote to create table
named array:
postgres=# CREATE TABLE "array" (vector int[][]);
CREATE TABLE

regards,
-- Shigehiro Honda

#2Bruce Momjian
bruce@momjian.us
In reply to: Honda Shigehiro (#1)
Re: syntax error with example sql of createtable

Thanks. Changed to 'array_int'.

---------------------------------------------------------------------------

Honda Shigehiro wrote:

Hello,

I got a error when execute below command in
http://developer.postgresql.org/docs/postgres/sql-createtable.html

postgres=# CREATE TABLE array (vector int[][]);
ERROR: syntax error at or near "array" at character 14
LINE 1: CREATE TABLE array (vector int[][]);

^
(I tried it on 8.0.0rc2.)

'array' is a reserved word, so it needs quote to create table
named array:
postgres=# CREATE TABLE "array" (vector int[][]);
CREATE TABLE

regards,
-- Shigehiro Honda

---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
#3Honda Shigehiro
fwif0083@mb.infoweb.ne.jp
In reply to: Honda Shigehiro (#1)
Re: syntax error with example sql of createtable

Hello,
Thank you for fixing.

I notice that there is also example which cause a syntax error
like "create table" in example of below URLs:
http://developer.postgresql.org/docs/postgres/sql-release-savepoint.html
http://developer.postgresql.org/docs/postgres/sql-savepoint.html

A word "table" in SQL "INSERT INTO table VALUES (3);" is reserved.
So renaming or quoting are needed to avoid an error.

regards,
--
Shigehiro Honda

#4Tom Lane
tgl@sss.pgh.pa.us
In reply to: Honda Shigehiro (#3)
Re: syntax error with example sql of createtable

Honda Shigehiro <fwif0083@mb.infoweb.ne.jp> writes:

A word "table" in SQL "INSERT INTO table VALUES (3);" is reserved.
So renaming or quoting are needed to avoid an error.

Fixed, thanks.

regards, tom lane