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

Re: [HACKERS] dollar quoting

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>,"Patches (PostgreSQL)" <pgsql-patches(at)postgresql(dot)org>
Subject: Re: [HACKERS] dollar quoting
Date: 2004-02-09 06:25:10
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackerspgsql-patches
Andrew Dunstan <andrew(at)dunslane(dot)net> writes:
> Comments welcome. Reviewers: I am not sure I got multi-byte stuff right 
> in psql/mainloop.c - please pay close attention to that.

The i-1 stuff should generally be i-prevlen.  Not sure if there are any
other pitfalls.

A bigger problem here:

> +             else if (!dol_quote && line[i] == '$' && 
> +                      !isdigit(line[i + thislen]) && 
> +                      (dol_end = strchr(line+i+1,'$')) != NULL &&
> +                      (i == 0 || 
> +                       ! ((line[i-1] & 0x80) != 0 || isalnum(line[i-1]) || 
> +                          line[i-1] == '_')))
> +             {

is that you aren't checking that what comes between the two dollar signs
looks like empty-or-an-identifier.  The check for
next-char-isn't-a-digit is part of that but not the only part.

Also I'm not sure about the positioning of these tests relative to the
in_quote and in_xcomment tests.  As you have it, $foo$ will be
recognized within an xcomment, which I think is at variance with the
proposed backend lexing behavior.

Also, the strdup should be pg_strdup.

			regards, tom lane

In response to


pgsql-hackers by date

Next:From: Slavisa GaricDate: 2004-02-09 06:34:37
Subject: Timestamps
Previous:From: Michael GlaesemannDate: 2004-02-09 05:57:13
Subject: Re: [HACKERS] Linking the previously separated documentation

pgsql-patches by date

Next:From: Andrew DunstanDate: 2004-02-09 07:05:02
Subject: Re: [HACKERS] dollar quoting
Previous:From: Neil ConwayDate: 2004-02-09 02:06:26
Subject: Re: win32 inode fix

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