Re: Query parser?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Teodor Sigaev <teodor(at)stack(dot)net>
Cc: Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Query parser?
Date: 2002-07-31 14:31:12
Message-ID: 27785.1028125872@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Teodor Sigaev <teodor(at)stack(dot)net> writes:
> wow=# update \d dmoz
> Table "dmoz"
> Column | Type | Modifiers
> --------+---------+-----------
> id | integer |
> name | text |
> path | ltree |
> Indexes: dmoz_id_idx unique btree (id),
> dmoz_path_idx gist ("path")

> wow-#
> wow-# ;
> ERROR: parser: parse error at or near ""

> Is it normal behaviour? Its seems to me that isn't..

This is the same as
\d dmoz
update ;

The behavior seems reasonable to me. If psql's backslash commands
flushed the query input buffer, we couldn't have any commands for
query-buffer editing.

One thing that does seem a little odd is:

regression=# update;
ERROR: parser: parse error at or near ";"
regression=# update
regression-# ;
ERROR: parser: parse error at or near ""

Investigation shows that psql includes the ';' in what it sends to
the backend in the first case, but not in the second. I'm not sure that
that rises to the level of a bug, but it seems odd.

It'd probably also be nice if the error message said
ERROR: parser: parse error at or near end of input
rather than quoting a useless empty token. I will see if I can make
that happen.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2002-07-31 14:37:51 Re: Rules and Views
Previous Message Tom Lane 2002-07-31 14:23:07 Re: WAL file location