[BUGS] pg_dump: patterns and tables with uppercase letters - Mailing list pgsql-bugs

From Andrea Urbani
Subject [BUGS] pg_dump: patterns and tables with uppercase letters
Date
Msg-id trinity-c423bad7-ca93-4754-92e8-5171ccdc4ad8-1482320156560@3capp-mailcom-lxa15
Whole thread Raw
Responses Re: [BUGS] pg_dump: patterns and tables with uppercase letters
List pgsql-bugs
Hello to everybody,
if you have table names with uppercase letters you will not be able to use the patterns in pg_dump.
In particular the processSQLNamePattern function, inside src/fe_utils/strings_utils.c, is converting to lowercase when the text is not double quoted, but when it is double quoted, all the |*+?()[]{}.^$\ characters are quoted.
This means, i.e., that if your tables are called  "tDocuments" and "tDocumentsFiles" if you call
    pg_dump --dbname=healthorganizer --username=hor --table=tDocument*
processSQLNamePattern will output
    c.relname ~ '^(tdocument*)$'
and if you use the double quote
    pg_dump --dbname=healthorganizer --username=hor --table='"tDocument*"'
processSQLNamePattern will output
    c.relname ~ '^(tDocument\*)$'
and both the instructions will not find those tables.
I suggest to add a parameter to the processSQLNamePattern function to choose between a case-sensitive or case-insensitive compare
c.relname ~ '^(tdocument*)$'
c.relname ~* '^(tdocument*)$'
and to use it in the expand_table_name_patterns method of pg_dump.c.
Bye
Andrea
matfanjol@user.sf.net
 

pgsql-bugs by date:

Previous
From: josef.machytka@gmail.com
Date:
Subject: [BUGS] BUG #14471: PostgreSQL 9.6 "NOT IN" in select causes crash with"ERROR: unknown error"
Next
From: Tom Lane
Date:
Subject: Re: [BUGS] BUG #14471: PostgreSQL 9.6 "NOT IN" in select causes crash with "ERROR: unknown error"