diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2007-07-10 00:21:31 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2007-07-10 00:21:31 +0000 |
commit | ff481ca0d463d33246a331c92bdf3dfc018c24eb (patch) | |
tree | f3ff364fb76a24afb2cdbccf5ee97d0c5299af28 /src | |
parent | 6244c2dfff6fa1b98fc8f13e59f656a20fad3564 (diff) | |
download | postgresql-ff481ca0d463d33246a331c92bdf3dfc018c24eb.tar.gz postgresql-ff481ca0d463d33246a331c92bdf3dfc018c24eb.zip |
Adjust processSQLNamePattern() so that $ within the pattern is always matched
literally, whether quoted or not. Since we allow $ as a character within
identifiers, this behavior is useful, whereas the previous behavior of
treating it as the regexp ending anchor was nearly useless given that the
pattern is automatically anchored anyway. This affects the arguments of
psql's \d commands as well as pg_dump's -n and -t switches. Per discussion.
Diffstat (limited to 'src')
-rw-r--r-- | src/bin/pg_dump/dumputils.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/bin/pg_dump/dumputils.c b/src/bin/pg_dump/dumputils.c index 0fc42ca7c26..02e3264658e 100644 --- a/src/bin/pg_dump/dumputils.c +++ b/src/bin/pg_dump/dumputils.c @@ -8,7 +8,7 @@ * Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/bin/pg_dump/dumputils.c,v 1.36 2007/06/18 21:40:58 tgl Exp $ + * $PostgreSQL: pgsql/src/bin/pg_dump/dumputils.c,v 1.37 2007/07/10 00:21:31 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -872,6 +872,18 @@ processSQLNamePattern(PGconn *conn, PQExpBuffer buf, const char *pattern, appendPQExpBufferStr(&namebuf, "^("); cp++; } + else if (ch == '$') + { + /* + * Dollar is always quoted, whether inside quotes or not. + * The reason is that it's allowed in SQL identifiers, so + * there's a significant use-case for treating it literally, + * while because we anchor the pattern automatically there is + * no use-case for having it possess its regexp meaning. + */ + appendPQExpBufferStr(&namebuf, "\\$"); + cp++; + } else { /* |