Re: BUG #13655: Incorrect Syntax Error - Mailing list pgsql-bugs

From Haribabu Kommi
Subject Re: BUG #13655: Incorrect Syntax Error
Date
Msg-id CAJrrPGcUHwY6_PYhQXcuPKPm01--FzNDnxuRigLnbGs2uPSFpw@mail.gmail.com
Whole thread Raw
In response to BUG #13655: Incorrect Syntax Error  (stormbyte@gmail.com)
Responses Re: BUG #13655: Incorrect Syntax Error  ("David G. Johnston" <david.g.johnston@gmail.com>)
List pgsql-bugs
On Thu, Oct 1, 2015 at 5:25 AM,  <stormbyte@gmail.com> wrote:
> The following bug has been logged on the website:
>
> Bug reference:      13655
> Logged by:          David
> Email address:      stormbyte@gmail.com
> PostgreSQL version: 9.4.4
> Operating system:   Gentoo Linux
> Description:
>
> When using field names with "", and custom data type, with its name also
> with "", a syntax error is triggered in CREATE TABLE when tab character is
> used instead of spaces.
>
> To reproduce, create a sql file with: (Insert tab and NOT space when <TAB>
> is specified)
> CREATE TYPE "GPSPoint" AS ("lat" DECIMAL(9,6), "lon" DECIMAL(9,6));
>
> CREATE TABLE "TestTable" ("testGPS"<TAB>"GPSPoint" NOT NULL);
>
> Save it, and copy/paste to psql, you will see an syntax error near NOT.
>
> That is workarounded by inserting <SPACE> before or instead of <TAB>, but
> should not trigger any syntax error, as the same syntax works for bundled
> types, so the following does not fail:
> CREATE TABLE "TestTable" ("test"<TAB>SMALLINT NOT NULL);
>
> This is a low priority bug, but a bit annoying

As I feel this is not a bug. psql has the tab complete feature with
the help of readline library.
Means it tries fill the command if the user provides the tab key as input.

In the test given above, the query is translated as follows, because
of that reason only
it is giving problem.

CREATE TYPE "GPSPoint" AS ("lat" DECIMAL(9,6), "lon" DECIMAL(9,6));

CREATE TABLE "TestTable" ("testGPS"<TAB>"GPSPoint" NOT NULL);

In this tab character is taken as psql input and the query will turn
into as follows.

CREATE TABLE "TestTable" ("testGPS""GPSPoint" NOT NULL);

Two quoted separate strings next to each other turns into a single
string as follows.

CREATE TABLE "TestTable" ("testGPSGPSPoint" NOT NULL);

Because of the above case, it is leading to a problem.

If I written the query as follows it works similar like SMALLINT case,

CREATE TYPE GPSPoint AS ("lat" DECIMAL(9,6), "lon" DECIMAL(9,6));
CREATE TABLE "TestTable" ("testGPS"<TAB>GPSPoint NOT NULL);
CREATE TABLE "TestTable" ("testGPS"GPSPoint NOT NULL);

Does any one feels the documentation to be updated for such case?

Regards,
Hari Babu
Fujitsu Australia

pgsql-bugs by date:

Previous
From: stormbyte@gmail.com
Date:
Subject: BUG #13655: Incorrect Syntax Error
Next
From: "David G. Johnston"
Date:
Subject: Re: BUG #13655: Incorrect Syntax Error