Re: A couple of issues with psql variable substitution

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: A couple of issues with psql variable substitution
Date: 2011-08-25 16:51:16
Message-ID: CA+TgmoZ9i-pcEEgM8Vt6v66Ezkw0OiFZ-CU-5+6poytGmgavnw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Aug 25, 2011 at 12:47 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> On my way to do something else entirely, I came across a couple of
> things that are not very nice about psql's lexer:
>
> 1. Somebody broke the no-backtracking property back in 9.0 while adding
> quoted variable substitution.  According to the flex manual, use of
> backtracking creates a performance penalty.  We once measured the
> backend's lexer as being about a third faster with backtrack avoidance,
> and presumably it's about the same for psql's.  This is not hard to fix,
> but should I consider it a bug fix and back-patch?  We've not had
> complaints about psql getting slower as of 9.0.

That may well have been me. How would I have known that I broke it?

Also, how invasive is the fix?

> 2. The lexer rules associated with variable substitution think that
> variable names can consist only of ASCII letters and digits (and
> underscores).  The psql manual is noncommittal about whether non-ASCII
> characters are allowed, but a reasonable person would think that the
> rules ought to be the same as the backend's idea of what an identifier
> is.  Does anybody have a problem with improving that?

Nope. Or at least, I don't.

> (I'm not
> proposing this part as a bug fix, because it does look a little bit
> more invasive to fix, because of the way psql deals with unsafe
> multibyte encodings.)

+1 for not back-patching this part.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2011-08-25 17:00:57 Re: A couple of issues with psql variable substitution
Previous Message Robert Haas 2011-08-25 16:49:04 Re: Change format of FDW options used in \d* commands