pg_dump: patterns and tables with uppercase letters

From: "Andrea Urbani" <matfanjol(at)mail(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: pg_dump: patterns and tables with uppercase letters
Date: 2016-12-21 11:35:56
Message-ID: trinity-c423bad7-ca93-4754-92e8-5171ccdc4ad8-1482320156560@3capp-mailcom-lxa15
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

<html><head></head><body><div style="font-family: Verdana;font-size: 12.0px;"><div>
<div>Hello to everybody,</div>

<div>if you have table names with uppercase letters you will not be able to use the patterns in pg_dump.<br/>
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 &#124;*+?()[]{}.^&#36;&#92; characters are quoted.<br/>
This means, i.e., that if your tables are called&nbsp; &quot;tDocuments&quot; and &quot;tDocumentsFiles&quot; if you call</div>

<div>&nbsp;&nbsp; &nbsp;pg_dump --dbname=healthorganizer --username=hor --table=tDocument*</div>

<div>processSQLNamePattern will output</div>

<div>&nbsp;&nbsp; &nbsp;c.relname ~ &#39;^(tdocument*)&#36;&#39;</div>

<div>and if you use the double quote</div>

<div>&nbsp;&nbsp; &nbsp;pg_dump --dbname=healthorganizer --username=hor --table=&#39;&quot;tDocument*&quot;&#39;</div>

<div>processSQLNamePattern will output</div>

<div>&nbsp;&nbsp; &nbsp;c.relname ~ &#39;^(tDocument&#92;*)&#36;&#39;</div>

<div>and both the instructions will not find those tables.</div>

<div>I suggest to add a parameter to the&nbsp;processSQLNamePattern function to choose between a case-sensitive or case-insensitive compare</div>

<div>c.relname ~ &#39;^(tdocument*)&#36;&#39;<br/>
c.relname ~* &#39;^(tdocument*)&#36;&#39;</div>

<div>and to use it in the&nbsp;expand_table_name_patterns method of pg_dump.c.</div>

<div>Bye<br/>
Andrea<br/>
matfanjol(at)user(dot)sf(dot)net</div>

<div>&nbsp;</div>
</div></div></body></html>

Attachment Content-Type Size
unknown_filename text/html 1.6 KB

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2016-12-21 15:26:10 Re: BUG #14471: PostgreSQL 9.6 "NOT IN" in select causes crash with "ERROR: unknown error"
Previous Message josef.machytka 2016-12-21 09:44:43 BUG #14471: PostgreSQL 9.6 "NOT IN" in select causes crash with "ERROR: unknown error"