pg.ddx.io pgsql-bugs@postgresql.org mailing list archive
help / color / mirror / Atom feedCannot dump 8.4.8 database using later versions
11+ messages / 7 participants
[nested] [flat]
* Cannot dump 8.4.8 database using later versions
@ 2011-11-14 23:11 Josh Berkus <josh@agliodbs.com>
2011-11-14 23:13 ` Re: Cannot dump 8.4.8 database using later versions Bruce Momjian <bruce@momjian.us>
0 siblings, 1 reply; 11+ messages in thread
From: Josh Berkus @ 2011-11-14 23:11 UTC (permalink / raw)
To: pgsql-bugs
Severity: normal
Versions tested: 9.0.4 and 9.1.1
Installed from packages on Ubuntu
Reproduceability: 100% on this server
have not tried a test case yet
Steps:
1. large running 8.4.8 PostgreSQL database
2. /usr/lib/postgresql/9.1/bin/pg_dump -Fc -v -f test.dump dbname
3. dumps all table etc definitions correctly. then:
pg_dump: saving database definition
pg_dump: SQL command failed
pg_dump: Error message from server: ERROR: NEW used in query that is
not in a rule
LINE 1: ...END AS min_value, cache_value, is_cycled, is_called from new
^
pg_dump: The command was: SELECT sequence_name, start_value, last_value,
increment_by, CASE WHEN increment_by > 0 AND max_value =
9223372036854775807 THEN NULL WHEN increment_by < 0 AND max_value =
-1 THEN NULL ELSE max_value END AS max_value, CASE WHEN
increment_by > 0 AND min_value = 1 THEN NULL WHEN increment_by < 0
AND min_value = -9223372036854775807 THEN NULL ELSE min_value END
AS min_value, cache_value, is_cycled, is_called from new
(yes, that is the entire query, I checked the logs)
... somehow the query to dump the sequences is getting mangled. Any
clue how?
--
Josh Berkus
PostgreSQL Experts Inc.
http://pgexperts.com
^ permalink raw reply [nested|flat] 11+ messages in thread
* Re: Cannot dump 8.4.8 database using later versions
2011-11-14 23:11 Cannot dump 8.4.8 database using later versions Josh Berkus <josh@agliodbs.com>
@ 2011-11-14 23:13 ` Bruce Momjian <bruce@momjian.us>
2011-11-14 23:20 ` Re: Cannot dump 8.4.8 database using later versions Josh Berkus <josh@agliodbs.com>
2011-11-15 00:43 ` Re: Cannot dump 8.4.8 database using later versions Josh Berkus <josh@agliodbs.com>
0 siblings, 2 replies; 11+ messages in thread
From: Bruce Momjian @ 2011-11-14 23:13 UTC (permalink / raw)
To: Josh Berkus <josh@agliodbs.com>; +Cc: pgsql-bugs
Josh Berkus wrote:
> Severity: normal
>
> Versions tested: 9.0.4 and 9.1.1
> Installed from packages on Ubuntu
>
> Reproduceability: 100% on this server
> have not tried a test case yet
>
> Steps:
>
> 1. large running 8.4.8 PostgreSQL database
>
> 2. /usr/lib/postgresql/9.1/bin/pg_dump -Fc -v -f test.dump dbname
>
> 3. dumps all table etc definitions correctly. then:
>
> pg_dump: saving database definition
> pg_dump: SQL command failed
> pg_dump: Error message from server: ERROR: NEW used in query that is
> not in a rule
> LINE 1: ...END AS min_value, cache_value, is_cycled, is_called from new
> ^
> pg_dump: The command was: SELECT sequence_name, start_value, last_value,
> increment_by, CASE WHEN increment_by > 0 AND max_value =
> 9223372036854775807 THEN NULL WHEN increment_by < 0 AND max_value =
> -1 THEN NULL ELSE max_value END AS max_value, CASE WHEN
> increment_by > 0 AND min_value = 1 THEN NULL WHEN increment_by < 0
> AND min_value = -9223372036854775807 THEN NULL ELSE min_value END
> AS min_value, cache_value, is_cycled, is_called from new
>
> (yes, that is the entire query, I checked the logs)
>
> ... somehow the query to dump the sequences is getting mangled. Any
> clue how?
Seems you have a sequence called "new"; seems we don't handle that
well.
--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://enterprisedb.com
+ It's impossible for everything to be true. +
^ permalink raw reply [nested|flat] 11+ messages in thread
* Re: Cannot dump 8.4.8 database using later versions
2011-11-14 23:11 Cannot dump 8.4.8 database using later versions Josh Berkus <josh@agliodbs.com>
2011-11-14 23:13 ` Re: Cannot dump 8.4.8 database using later versions Bruce Momjian <bruce@momjian.us>
@ 2011-11-14 23:20 ` Josh Berkus <josh@agliodbs.com>
1 sibling, 0 replies; 11+ messages in thread
From: Josh Berkus @ 2011-11-14 23:20 UTC (permalink / raw)
To: Bruce Momjian <bruce@momjian.us>; +Cc: pgsql-bugs
> Seems you have a sequence called "new"; seems we don't handle that
> well.
Hmmm ... yes, you're correct. Idiot users.
Interestingly, the sequence is no problem until 9.0. 8.4 handled it
fine. I'd guess this is another example of where merging in plpgsql
broke something.
--
Josh Berkus
PostgreSQL Experts Inc.
http://pgexperts.com
^ permalink raw reply [nested|flat] 11+ messages in thread
* Re: Cannot dump 8.4.8 database using later versions
2011-11-14 23:11 Cannot dump 8.4.8 database using later versions Josh Berkus <josh@agliodbs.com>
2011-11-14 23:13 ` Re: Cannot dump 8.4.8 database using later versions Bruce Momjian <bruce@momjian.us>
@ 2011-11-15 00:43 ` Josh Berkus <josh@agliodbs.com>
2011-11-15 08:36 ` Re: Cannot dump 8.4.8 database using later versions Andreas Lange <andreas.lange@liu.se>
2011-11-15 10:16 ` Re: Cannot dump 8.4.8 database using later versions Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>
1 sibling, 2 replies; 11+ messages in thread
From: Josh Berkus @ 2011-11-15 00:43 UTC (permalink / raw)
To: Bruce Momjian <bruce@momjian.us>; +Cc: pgsql-bugs
>> ... somehow the query to dump the sequences is getting mangled. Any
>> clue how?
>
> Seems you have a sequence called "new"; seems we don't handle that
> well.
So, tested this some more. For some reason, 8.4's pg_dump would
recognize NEW as a reserved word and quote it before dumping. 9.0 and
later pg_dump does not. Any ideas?
--
Josh Berkus
PostgreSQL Experts Inc.
http://pgexperts.com
^ permalink raw reply [nested|flat] 11+ messages in thread
* Re: Cannot dump 8.4.8 database using later versions
2011-11-14 23:11 Cannot dump 8.4.8 database using later versions Josh Berkus <josh@agliodbs.com>
2011-11-14 23:13 ` Re: Cannot dump 8.4.8 database using later versions Bruce Momjian <bruce@momjian.us>
2011-11-15 00:43 ` Re: Cannot dump 8.4.8 database using later versions Josh Berkus <josh@agliodbs.com>
@ 2011-11-15 08:36 ` Andreas Lange <andreas.lange@liu.se>
1 sibling, 0 replies; 11+ messages in thread
From: Andreas Lange @ 2011-11-15 08:36 UTC (permalink / raw)
To: pgsql-bugs
On 2011-11-15 v46 01.43, Josh Berkus wrote:
>>> ... somehow the query to dump the sequences is getting mangled. Any
>>> clue how?
>> Seems you have a sequence called "new"; seems we don't handle that
>> well.
> So, tested this some more. For some reason, 8.4's pg_dump would
> recognize NEW as a reserved word and quote it before dumping. 9.0 and
> later pg_dump does not. Any ideas?
>
Funny, I was about to write a bug report regarding this...
'new' was reserved in 8.4, but not in 9.0/9.1. It's reserved in SQL
1999, 2003 & 2008.
(http://www.postgresql.org/docs/9.1/interactive/sql-keywords-appendix.html)
You can have a 8.4 DB with a 'new' column and dump it with 8.4 tools.
You can have a 9.x DB with a 'new' column and dump it with 9.x tools.
However, it fails when you use 9.x pg_dump against 8.4 with a 'new' column.
//Andreas
^ permalink raw reply [nested|flat] 11+ messages in thread
* Re: Cannot dump 8.4.8 database using later versions
2011-11-14 23:11 Cannot dump 8.4.8 database using later versions Josh Berkus <josh@agliodbs.com>
2011-11-14 23:13 ` Re: Cannot dump 8.4.8 database using later versions Bruce Momjian <bruce@momjian.us>
2011-11-15 00:43 ` Re: Cannot dump 8.4.8 database using later versions Josh Berkus <josh@agliodbs.com>
@ 2011-11-15 10:16 ` Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>
2011-11-16 01:28 ` Re: Cannot dump 8.4.8 database using later versions Robert Haas <robertmhaas@gmail.com>
1 sibling, 1 reply; 11+ messages in thread
From: Heikki Linnakangas @ 2011-11-15 10:16 UTC (permalink / raw)
To: Josh Berkus <josh@agliodbs.com>; +Cc: Bruce Momjian <bruce@momjian.us>; pgsql-bugs
On 15.11.2011 02:43, Josh Berkus wrote:
>
>>> ... somehow the query to dump the sequences is getting mangled. Any
>>> clue how?
>>
>> Seems you have a sequence called "new"; seems we don't handle that
>> well.
>
> So, tested this some more. For some reason, 8.4's pg_dump would
> recognize NEW as a reserved word and quote it before dumping. 9.0 and
> later pg_dump does not. Any ideas?
NEW used to be a reserved keyword, but it's not so in 9.0 anymore. So
9.0 pg_dump thinks it doesn't need to be quoted.
This is a problem with any keyword that was reserved (or
col_name_keyword or type_func_name_keyword) in an earlier release, but
has since been made unreserved. Looking at the history of our keyword
lists, that has happened to four keywords:
OFF (was reserved <= 8.4)
NEW (was reserved <= 8.4)
OLD (was reserved <= 8.4)
PUBLIC (was func_name_keyword <= 7.2)
There's also CONVERT, which used to be a col_name_keyword in versions <=
8.2, but that doesn't seem to cause trouble with pg_dump.
I'm thinking that we should add a list of these used-to-be keywords
somewhere in pg_dump (like in keywords.c), and check that list in
addition to the regular keyword list in fmtId().
--
Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.com
^ permalink raw reply [nested|flat] 11+ messages in thread
* Re: Cannot dump 8.4.8 database using later versions
2011-11-14 23:11 Cannot dump 8.4.8 database using later versions Josh Berkus <josh@agliodbs.com>
2011-11-14 23:13 ` Re: Cannot dump 8.4.8 database using later versions Bruce Momjian <bruce@momjian.us>
2011-11-15 00:43 ` Re: Cannot dump 8.4.8 database using later versions Josh Berkus <josh@agliodbs.com>
2011-11-15 10:16 ` Re: Cannot dump 8.4.8 database using later versions Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>
@ 2011-11-16 01:28 ` Robert Haas <robertmhaas@gmail.com>
2011-11-16 03:04 ` Re: Cannot dump 8.4.8 database using later versions Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 11+ messages in thread
From: Robert Haas @ 2011-11-16 01:28 UTC (permalink / raw)
To: Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>; +Cc: Josh Berkus <josh@agliodbs.com>; Bruce Momjian <bruce@momjian.us>; pgsql-bugs
On Tue, Nov 15, 2011 at 5:16 AM, Heikki Linnakangas
<heikki.linnakangas@enterprisedb.com> wrote:
> NEW used to be a reserved keyword, but it's not so in 9.0 anymore. So 9.0
> pg_dump thinks it doesn't need to be quoted.
Why isn't it correct?
--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
^ permalink raw reply [nested|flat] 11+ messages in thread
* Re: Cannot dump 8.4.8 database using later versions
2011-11-14 23:11 Cannot dump 8.4.8 database using later versions Josh Berkus <josh@agliodbs.com>
2011-11-14 23:13 ` Re: Cannot dump 8.4.8 database using later versions Bruce Momjian <bruce@momjian.us>
2011-11-15 00:43 ` Re: Cannot dump 8.4.8 database using later versions Josh Berkus <josh@agliodbs.com>
2011-11-15 10:16 ` Re: Cannot dump 8.4.8 database using later versions Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>
2011-11-16 01:28 ` Re: Cannot dump 8.4.8 database using later versions Robert Haas <robertmhaas@gmail.com>
@ 2011-11-16 03:04 ` Tom Lane <tgl@sss.pgh.pa.us>
2011-11-16 07:12 ` Re: Cannot dump 8.4.8 database using later versions Pavel Golub <pavel@microolap.com>
2011-11-16 19:52 ` Re: Cannot dump 8.4.8 database using later versions Josh Berkus <josh@agliodbs.com>
2012-08-17 00:34 ` Re: Cannot dump 8.4.8 database using later versions Bruce Momjian <bruce@momjian.us>
0 siblings, 3 replies; 11+ messages in thread
From: Tom Lane @ 2011-11-16 03:04 UTC (permalink / raw)
To: Robert Haas <robertmhaas@gmail.com>; +Cc: Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>; Josh Berkus <josh@agliodbs.com>; Bruce Momjian <bruce@momjian.us>; pgsql-bugs
Robert Haas <robertmhaas@gmail.com> writes:
> On Tue, Nov 15, 2011 at 5:16 AM, Heikki Linnakangas
> <heikki.linnakangas@enterprisedb.com> wrote:
>> NEW used to be a reserved keyword, but it's not so in 9.0 anymore. So 9.0
>> pg_dump thinks it doesn't need to be quoted.
> Why isn't it correct?
It's correct to not quote it in pg_dump's output (since we make no
promises that such output would load into a pre-9.0 server anyway).
The problem is that it needs to be quoted in commands that pg_dump
sends back to the 8.4 server. Example:
psql (8.4.9)
You are now connected to database "db84".
db84=# create table "new"( f1 int, "new" text);
... pg_dump with newer pg_dump ...
pg_dump: SQL command failed
pg_dump: Error message from server: ERROR: syntax error at or near "new"
LINE 1: COPY public.new (f1, new) TO stdout;
^
pg_dump: The command was: COPY public.new (f1, new) TO stdout;
The least painful solution might be to always quote *every* identifier
in commands sent to the source server, since we don't especially care
how nice-looking those are.
regards, tom lane
^ permalink raw reply [nested|flat] 11+ messages in thread
* Re: Cannot dump 8.4.8 database using later versions
2011-11-14 23:11 Cannot dump 8.4.8 database using later versions Josh Berkus <josh@agliodbs.com>
2011-11-14 23:13 ` Re: Cannot dump 8.4.8 database using later versions Bruce Momjian <bruce@momjian.us>
2011-11-15 00:43 ` Re: Cannot dump 8.4.8 database using later versions Josh Berkus <josh@agliodbs.com>
2011-11-15 10:16 ` Re: Cannot dump 8.4.8 database using later versions Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>
2011-11-16 01:28 ` Re: Cannot dump 8.4.8 database using later versions Robert Haas <robertmhaas@gmail.com>
2011-11-16 03:04 ` Re: Cannot dump 8.4.8 database using later versions Tom Lane <tgl@sss.pgh.pa.us>
@ 2011-11-16 07:12 ` Pavel Golub <pavel@microolap.com>
2 siblings, 0 replies; 11+ messages in thread
From: Pavel Golub @ 2011-11-16 07:12 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Robert Haas <robertmhaas@gmail.com>; Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>; Josh Berkus <josh@agliodbs.com>; Bruce Momjian <bruce@momjian.us>; pgsql-bugs; Pavel Golub <pavel@gf.microolap.com>
Hello, Tom.
You wrote:
TL> Robert Haas <robertmhaas@gmail.com> writes:
>> On Tue, Nov 15, 2011 at 5:16 AM, Heikki Linnakangas
>> <heikki.linnakangas@enterprisedb.com> wrote:
>>> NEW used to be a reserved keyword, but it's not so in 9.0 anymore. So 9.0
>>> pg_dump thinks it doesn't need to be quoted.
>> Why isn't it correct?
TL> It's correct to not quote it in pg_dump's output (since we make no
TL> promises that such output would load into a pre-9.0 server anyway).
TL> The problem is that it needs to be quoted in commands that pg_dump
TL> sends back to the 8.4 server. Example:
TL> psql (8.4.9)
TL> You are now connected to database "db84".
TL> db84=# create table "new"( f1 int, "new" text);
TL> ... pg_dump with newer pg_dump ...
TL> pg_dump: SQL command failed
TL> pg_dump: Error message from server: ERROR: syntax error at or near "new"
TL> LINE 1: COPY public.new (f1, new) TO stdout;
TL> ^
TL> pg_dump: The command was: COPY public.new (f1, new) TO stdout;
TL> The least painful solution might be to always quote *every* identifier
TL> in commands sent to the source server, since we don't especially care
TL> how nice-looking those are.
+1 for this. This will prevent such situations in the future.
TL> regards, tom lane
--
With best wishes,
Pavel mailto:pavel@gf.microolap.com
^ permalink raw reply [nested|flat] 11+ messages in thread
* Re: Cannot dump 8.4.8 database using later versions
2011-11-14 23:11 Cannot dump 8.4.8 database using later versions Josh Berkus <josh@agliodbs.com>
2011-11-14 23:13 ` Re: Cannot dump 8.4.8 database using later versions Bruce Momjian <bruce@momjian.us>
2011-11-15 00:43 ` Re: Cannot dump 8.4.8 database using later versions Josh Berkus <josh@agliodbs.com>
2011-11-15 10:16 ` Re: Cannot dump 8.4.8 database using later versions Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>
2011-11-16 01:28 ` Re: Cannot dump 8.4.8 database using later versions Robert Haas <robertmhaas@gmail.com>
2011-11-16 03:04 ` Re: Cannot dump 8.4.8 database using later versions Tom Lane <tgl@sss.pgh.pa.us>
@ 2011-11-16 19:52 ` Josh Berkus <josh@agliodbs.com>
2 siblings, 0 replies; 11+ messages in thread
From: Josh Berkus @ 2011-11-16 19:52 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Robert Haas <robertmhaas@gmail.com>; Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>; Bruce Momjian <bruce@momjian.us>; pgsql-bugs
> The least painful solution might be to always quote *every* identifier
> in commands sent to the source server, since we don't especially care
> how nice-looking those are.
I've never been clear on why we don't do that in the first place.
--
Josh Berkus
PostgreSQL Experts Inc.
http://pgexperts.com
^ permalink raw reply [nested|flat] 11+ messages in thread
* Re: Cannot dump 8.4.8 database using later versions
2011-11-14 23:11 Cannot dump 8.4.8 database using later versions Josh Berkus <josh@agliodbs.com>
2011-11-14 23:13 ` Re: Cannot dump 8.4.8 database using later versions Bruce Momjian <bruce@momjian.us>
2011-11-15 00:43 ` Re: Cannot dump 8.4.8 database using later versions Josh Berkus <josh@agliodbs.com>
2011-11-15 10:16 ` Re: Cannot dump 8.4.8 database using later versions Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>
2011-11-16 01:28 ` Re: Cannot dump 8.4.8 database using later versions Robert Haas <robertmhaas@gmail.com>
2011-11-16 03:04 ` Re: Cannot dump 8.4.8 database using later versions Tom Lane <tgl@sss.pgh.pa.us>
@ 2012-08-17 00:34 ` Bruce Momjian <bruce@momjian.us>
2 siblings, 0 replies; 11+ messages in thread
From: Bruce Momjian @ 2012-08-17 00:34 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Robert Haas <robertmhaas@gmail.com>; Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>; Josh Berkus <josh@agliodbs.com>; pgsql-bugs
I don't think we ever addressed this, but since we have had minimal
complaints about it, I guess we are OK.
---------------------------------------------------------------------------
On Tue, Nov 15, 2011 at 10:04:57PM -0500, Tom Lane wrote:
> Robert Haas <robertmhaas@gmail.com> writes:
> > On Tue, Nov 15, 2011 at 5:16 AM, Heikki Linnakangas
> > <heikki.linnakangas@enterprisedb.com> wrote:
> >> NEW used to be a reserved keyword, but it's not so in 9.0 anymore. So 9.0
> >> pg_dump thinks it doesn't need to be quoted.
>
> > Why isn't it correct?
>
> It's correct to not quote it in pg_dump's output (since we make no
> promises that such output would load into a pre-9.0 server anyway).
> The problem is that it needs to be quoted in commands that pg_dump
> sends back to the 8.4 server. Example:
>
> psql (8.4.9)
> You are now connected to database "db84".
> db84=# create table "new"( f1 int, "new" text);
>
> ... pg_dump with newer pg_dump ...
>
> pg_dump: SQL command failed
> pg_dump: Error message from server: ERROR: syntax error at or near "new"
> LINE 1: COPY public.new (f1, new) TO stdout;
> ^
> pg_dump: The command was: COPY public.new (f1, new) TO stdout;
>
> The least painful solution might be to always quote *every* identifier
> in commands sent to the source server, since we don't especially care
> how nice-looking those are.
>
> regards, tom lane
--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://enterprisedb.com
+ It's impossible for everything to be true. +
^ permalink raw reply [nested|flat] 11+ messages in thread
end of thread, other threads:[~2012-08-17 00:34 UTC | newest]
Thread overview: 11+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2011-11-14 23:11 Cannot dump 8.4.8 database using later versions Josh Berkus <josh@agliodbs.com>
2011-11-14 23:13 ` Bruce Momjian <bruce@momjian.us>
2011-11-14 23:20 ` Josh Berkus <josh@agliodbs.com>
2011-11-15 00:43 ` Josh Berkus <josh@agliodbs.com>
2011-11-15 08:36 ` Andreas Lange <andreas.lange@liu.se>
2011-11-15 10:16 ` Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>
2011-11-16 01:28 ` Robert Haas <robertmhaas@gmail.com>
2011-11-16 03:04 ` Tom Lane <tgl@sss.pgh.pa.us>
2011-11-16 07:12 ` Pavel Golub <pavel@microolap.com>
2011-11-16 19:52 ` Josh Berkus <josh@agliodbs.com>
2012-08-17 00:34 ` Bruce Momjian <bruce@momjian.us>
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