pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #14152: pg_dump does not take into account previous versions reserved keywords as column names
8+ messages / 6 participants
[nested] [flat]

* BUG #14152: pg_dump does not take into account previous versions reserved keywords as column names
@ 2016-05-20 16:58  alejandro@cartodb.com
  0 siblings, 1 reply; 8+ messages in thread

From: alejandro@cartodb.com @ 2016-05-20 16:58 UTC (permalink / raw)
  To: pgsql-bugs

The following bug has been logged on the website:

Bug reference:      14152
Logged by:          Alejandro Martínez
Email address:      alejandro@cartodb.com
PostgreSQL version: 9.5.3
Operating system:   Windows
Description:        

Steps to reproduce:

- Have a 9.3.13 cluster
- On that database run: CREATE TABLE test(foo int, "over" test, bar int);.
Note that "over" is a keyword which apparently went from reserved to
non-reserved on 9.4 release.
- Use a 9.5.3 pg_dump to dump the database.

It fails with:

pg_dump: [archiver (db)] query failed: ERROR:  syntax error at or near
"over"
LINE 1: COPY public.test (foo, over, bar) TO stdout;
                               ^
pg_dump: [archiver (db)] query was: COPY public.test (foo, over, bar) TO
stdout;

Using a 9.3 pg_dump will quote the "over" column name and properly finish
the dump.



-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs


^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: BUG #14152: pg_dump does not take into account previous versions reserved keywords as column names
@ 2016-05-20 17:56  Kevin Grittner <kgrittn@gmail.com>
  parent: alejandro@cartodb.com
  0 siblings, 1 reply; 8+ messages in thread

From: Kevin Grittner @ 2016-05-20 17:56 UTC (permalink / raw)
  To: alejandro@cartodb.com; +Cc: pgsql-bugs

On Fri, May 20, 2016 at 12:58 PM,  <alejandro@cartodb.com> wrote:

> - On that database run: CREATE TABLE test(foo int, "over" test, bar int);.
> Note that "over" is a keyword which apparently went from reserved to
> non-reserved on 9.4 release.
> - Use a 9.5.3 pg_dump to dump the database.
>
> It fails with:
>
> pg_dump: [archiver (db)] query failed: ERROR:  syntax error at or near
> "over"
> LINE 1: COPY public.test (foo, over, bar) TO stdout;
>                                ^
> pg_dump: [archiver (db)] query was: COPY public.test (foo, over, bar) TO
> stdout;
>
> Using a 9.3 pg_dump will quote the "over" column name and properly finish
> the dump.

... or use the --quote-all-identifiers option of 9.5 pg_dump.

http://www.postgresql.org/docs/9.5/static/app-pgdump.html

Not a bug.

-- 
Kevin Grittner
EDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: BUG #14152: pg_dump does not take into account previous versions reserved keywords as column names
@ 2016-05-20 18:02  John R Pierce <pierce@hogranch.com>
  parent: Kevin Grittner <kgrittn@gmail.com>
  0 siblings, 2 replies; 8+ messages in thread

From: John R Pierce @ 2016-05-20 18:02 UTC (permalink / raw)
  To: pgsql-bugs

On 5/20/2016 10:56 AM, Kevin Grittner wrote:
> ... or use the --quote-all-identifiers option of 9.5 pg_dump.
>
> http://www.postgresql.org/docs/9.5/static/app-pgdump.html
>
> Not a bug.

pg_dump and pg_dumpall are supposed to be able to dump all supported 
prior versions, thats the documented procedure for updating...    I 
contend this *is* a bug.   quote-all-identifiers is a workaround, for sure.


-- 
john r pierce, recycling bits in santa cruz

^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: BUG #14152: pg_dump does not take into account previous versions reserved keywords as column names
@ 2016-05-20 18:11  David G. Johnston <david.g.johnston@gmail.com>
  parent: John R Pierce <pierce@hogranch.com>
  1 sibling, 1 reply; 8+ messages in thread

From: David G. Johnston @ 2016-05-20 18:11 UTC (permalink / raw)
  To: John R Pierce <pierce@hogranch.com>; +Cc: pgsql-bugs

On Fri, May 20, 2016 at 2:02 PM, John R Pierce <pierce@hogranch.com> wrote:

> On 5/20/2016 10:56 AM, Kevin Grittner wrote:
>
> ... or use the --quote-all-identifiers option of 9.5 pg_dump.
> http://www.postgresql.org/docs/9.5/static/app-pgdump.html
>
> Not a bug.
>
>
> pg_dump and pg_dumpall are supposed to be able to dump all supported prior
> versions, thats the documented procedure for updating...    I contend this
> *is* a bug.   quote-all-identifiers is a workaround, for sure.
>
>
> ​This was my first reaction, and I suspect that we attempt to do this
already and that this one in just an oversight​.

If indeed the prescribed procedure is quote-all-identifiers I'd say we
should at least update the docs.

"""
Force quoting of all identifiers. This may be useful when dumping a
database for migration to a future version that may have introduced
additional keywords.
"""

​I'd probably say something like:

"It is recommended to use this option when performing dumps intended for
migration or when dealing with a version of PostgreSQL different than
pg_dump.  This is because the recognized keywords sometimes change between
major versions but only the quoting rules of the pg_dump version are
applied."

This doesn't seem to make its way that often to these lists otherwise I'd
recommend we add a "no-force-quote-identifiers" option and default to this
behavior.

David J.

^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: BUG #14152: pg_dump does not take into account previous versions reserved keywords as column names
@ 2016-05-20 18:12  Michael Paquier <michael.paquier@gmail.com>
  parent: John R Pierce <pierce@hogranch.com>
  1 sibling, 0 replies; 8+ messages in thread

From: Michael Paquier @ 2016-05-20 18:12 UTC (permalink / raw)
  To: John R Pierce <pierce@hogranch.com>; +Cc: pgsql-bugs

On Fri, May 20, 2016 at 2:02 PM, John R Pierce <pierce@hogranch.com> wrote:
> pg_dump and pg_dumpall are supposed to be able to dump all supported prior
> versions, thats the documented procedure for updating...    I contend this
> *is* a bug.   quote-all-identifiers is a workaround, for sure.

Well, --quote-all-identifiers is here to handle the case of new
keywords introduced. Let's use that and call it a day.
-- 
Michael


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: BUG #14152: pg_dump does not take into account previous versions reserved keywords as column names
@ 2016-05-20 18:25  Tom Lane <tgl@sss.pgh.pa.us>
  parent: David G. Johnston <david.g.johnston@gmail.com>
  0 siblings, 1 reply; 8+ messages in thread

From: Tom Lane @ 2016-05-20 18:25 UTC (permalink / raw)
  To: David G. Johnston <david.g.johnston@gmail.com>; +Cc: John R Pierce <pierce@hogranch.com>; pgsql-bugs

"David G. Johnston" <david.g.johnston@gmail.com> writes:
> On Fri, May 20, 2016 at 2:02 PM, John R Pierce <pierce@hogranch.com> wrote:
>> pg_dump and pg_dumpall are supposed to be able to dump all supported prior
>> versions, thats the documented procedure for updating...    I contend this
>> *is* a bug.   quote-all-identifiers is a workaround, for sure.

> If indeed the prescribed procedure is quote-all-identifiers I'd say we
> should at least update the docs.

Yeah, agreed.  I'll put something in.

Alternatively, we could automatically turn on quote-all-identifiers when
dumping from a server of a different major version; but I imagine we'd
get complaints about that, too, since it's so seldom an issue.

			regards, tom lane


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: BUG #14152: pg_dump does not take into account previous versions reserved keywords as column names
@ 2016-05-20 18:59  David G. Johnston <david.g.johnston@gmail.com>
  parent: Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 8+ messages in thread

From: David G. Johnston @ 2016-05-20 18:59 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: John R Pierce <pierce@hogranch.com>; pgsql-bugs

On Fri, May 20, 2016 at 2:25 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:

> "David G. Johnston" <david.g.johnston@gmail.com> writes:
> > On Fri, May 20, 2016 at 2:02 PM, John R Pierce <pierce@hogranch.com>
> wrote:
> >> pg_dump and pg_dumpall are supposed to be able to dump all supported
> prior
> >> versions, thats the documented procedure for updating...    I contend
> this
> >> *is* a bug.   quote-all-identifiers is a workaround, for sure.
>
> > If indeed the prescribed procedure is quote-all-identifiers I'd say we
> > should at least update the docs.
>
> Yeah, agreed.  I'll put something in.
>
>
​I'd hit up the "Notes" section's last paragraph in addition to the
command-line option.  The former is going to be much more visible.  The
cross-version dynamic possibly warrants it own section header, IMO, given
that it is a primary use case for the tool.​  Consider placing it
subsequent to the Description section - maybe calling it "Upgrades".

Alternatively, we could automatically turn on quote-all-identifiers when
> dumping from a server of a different major version; but I imagine we'd
> get complaints about that, too, since it's so seldom an issue.
>
>
True, the volume of people using even potentially reserved words as
identifiers is not all that high.  Given fail-fast behavior, and a
reasonable pointer to overcoming it, catering to this minority doesn't seem
worth disrupting the status quo; even in this limited fashion.

​David J.​

^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: BUG #14152: pg_dump does not take into account previous versions reserved keywords as column names
@ 2016-05-20 19:13  Tom Lane <tgl@sss.pgh.pa.us>
  parent: David G. Johnston <david.g.johnston@gmail.com>
  0 siblings, 0 replies; 8+ messages in thread

From: Tom Lane @ 2016-05-20 19:13 UTC (permalink / raw)
  To: David G. Johnston <david.g.johnston@gmail.com>; +Cc: John R Pierce <pierce@hogranch.com>; pgsql-bugs

"David G. Johnston" <david.g.johnston@gmail.com> writes:
> On Fri, May 20, 2016 at 2:25 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> Yeah, agreed.  I'll put something in.

> ​I'd hit up the "Notes" section's last paragraph in addition to the
> command-line option.

Good point --- I missed that, but will have another go.

			regards, tom lane


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



^ permalink  raw  reply  [nested|flat] 8+ messages in thread


end of thread, other threads:[~2016-05-20 19:13 UTC | newest]

Thread overview: 8+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2016-05-20 16:58 BUG #14152: pg_dump does not take into account previous versions reserved keywords as column names alejandro@cartodb.com
2016-05-20 17:56 ` Kevin Grittner <kgrittn@gmail.com>
2016-05-20 18:02   ` John R Pierce <pierce@hogranch.com>
2016-05-20 18:11     ` David G. Johnston <david.g.johnston@gmail.com>
2016-05-20 18:25       ` Tom Lane <tgl@sss.pgh.pa.us>
2016-05-20 18:59         ` David G. Johnston <david.g.johnston@gmail.com>
2016-05-20 19:13           ` Tom Lane <tgl@sss.pgh.pa.us>
2016-05-20 18:12     ` Michael Paquier <michael.paquier@gmail.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox