Re: BUG #11524: Unable to add value to ENUM when having AUTOCOMMIT disabled in psql - Mailing list pgsql-bugs

From Michael Paquier
Subject Re: BUG #11524: Unable to add value to ENUM when having AUTOCOMMIT disabled in psql
Date
Msg-id CAB7nPqQHNr97k0J-rACXk2Py6NrEzLqDeiSR=PjEL_EwNuUR=w@mail.gmail.com
Whole thread Raw
In response to Re: BUG #11524: Unable to add value to ENUM when having AUTOCOMMIT disabled in psql  (Feike Steenbergen <feikesteenbergen@gmail.com>)
List pgsql-bugs
On Tue, Sep 30, 2014 at 9:05 PM, Feike Steenbergen <
feikesteenbergen@gmail.com> wrote:
> There seems to be a provision in ./src/bin/psql/common.c for these
> statements. The function is command_no_begin.
This function skips BEGIN statements for queries that cannot run within a
transaction block by scanning keywords at the beginning of the query
string, and it is true that CREATE TYPE ... ADD VALUE is not added. Now,
skip_white_space is able to skip whitespaces and comments but it is harder
to analyze the type name itself as it could be a combination of the
keywords you are analyzing, for example let's imagine this valid custom
type:
=# CREATE TYPE "create type foo add value" AS (a INT);
CREATE TYPE
=# \dT
                 List of data types
 Schema |            Name             | Description
--------+-----------------------------+-------------
 public | "create type foo add value" |
(1 row)
It is true that this behavior could be improved by having an additional
function able to skip an object name safely for a query string, but I
simply imagine that such additional logic has not been added in psql until
now because of the lack of complains about this behavior on a feature that
has been released 3 years ago.
Regards,
--
Michael

pgsql-bugs by date:

Previous
From: Paul Dasari
Date:
Subject: Re: BUG #11528: Max Index Keys
Next
From: Michael Paquier
Date:
Subject: Re: BUG #11457: The below query crashes 9.3.5, but not 9.3.4