Skip site navigation (1) Skip section navigation (2)

Re: Fix command completion for CREATE TABEL ... AS

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Fernando Nasser <fnasser(at)redhat(dot)com>
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: Fix command completion for CREATE TABEL ... AS
Date: 2002-02-22 23:10:15
Message-ID: 21351.1014419415@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-patches
Fernando Nasser <fnasser(at)redhat(dot)com> writes:
> Tom Lane wrote:
>> Do we really need the overhead of adding a new parse node type just
>> to change the command tag returned for a CREATE ... AS?

> There is not much overhead -- CreateAsStmt it is just an alias for
> SelectStmt.

Yes, but for every node type there need to be copy, compare, output,
and input routines; and something like SelectStmt is certain to need
changes from time to time, which will also have to get done on
CreateAsStmt (or cause subtle bugs if someone forgets).  It's that
long-term maintenance cost that I'm objecting to.

Moreover, this is far from the only case where we translate multiple
user-entered constructs into the same parse-level representation.
A relevant example is that COMMIT and END produce identical parse
trees, as do ABORT and ROLLBACK.  Will you insist on changing all
such cases?

> Well, getting a SELECT response for a CREATE statement is a little bit
> disconcerting (except for people that know that the old syntax used to
> be SELECT ... INTO).  Doesn't look very professional.

Again, what's your definition of "looking professional"?  Do you want to
define it as repeating the first word of what the user typed, regardless
of what our internal representation is?  If so, I can make that happen,
in a direct way that doesn't depend on assuming any global properties
of the parse representation.  A quick little hack to make the lexer save
the first lexed token of each statement will do nicely.

However, an equally defensible definition of "looking professional"
is "emitting the most standard name for the construct" --- this is
what we currently do with COMMIT/END/ABORT/ROLLBACK.  I think it could
be argued with reasonable vigor that the right answer for your concern
is that SELECT...INTO and CREATE...AS should both produce
command-completion tags of CREATE.

			regards, tom lane

In response to

Responses

pgsql-patches by date

Next:From: Bruce MomjianDate: 2002-02-22 23:19:13
Subject: Re: Support for QNX6, POSIX IPC and PTHREAD-style locking
Previous:From: Bruce MomjianDate: 2002-02-22 23:06:37
Subject: Re: TOAST-slicing: substring access methods for TOASTed values.

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group