Thread: Upcoming PG re-releases
It's been about a month since 8.1.0 was released, and we've found about the usual number of bugs for a new release, so it seems like it's time for 8.1.1. The core committee has tentatively agreed to plan a release for Tuesday Dec 6 (which means wrapping tarballs Monday). We will at the same time be making new dot-releases in the 7.3, 7.4, and 8.0 branches, principally to fix the SLRU race condition reported by Jim Nasby and Robert Creager. So ... if you've got any open issues with the back branches, now's the time to get those patches in ... regards, tom lane
Tom Lane wrote: > We will >at the same time be making new dot-releases in the 7.3, 7.4, and 8.0 >branches, principally to fix the SLRU race condition reported by Jim >Nasby and Robert Creager. > > > > Was there a conclusion out of the recent discussion on EOL policy? The consensus seemed to be something like: "We will maintain releases to the best of our ability for at least 2 years plus 1 release cycle. After that, support may be dropped at any time when maintenance becomes difficult." Have we actually officially stopped supporting the 7.2 series? All this needs some announcement from the core trsam, IMNSHO - there has been some confusion over it (e.g. I saw someone recently saying we had stopped supporting the 7.3 series, which the above would seem to indicate is not true). cheers andrew
Andrew Dunstan <andrew@dunslane.net> writes: > Have we actually officially stopped supporting the 7.2 series? Yeah, we have. It reached the "too difficult to support" point already (the VACUUM/ctid bug back in August --- the patch used in the later branches wouldn't apply at all, IIRC). > All this needs some announcement from the core trsam, IMNSHO - there has > been some confusion over it (e.g. I saw someone recently saying we had > stopped supporting the 7.3 series, which the above would seem to > indicate is not true). Personally I expect to keep supporting 7.3 for a long while, because Red Hat pays me to ;-) ... and the EOL date for RHEL3 is a long way away yet. The PG community may stop bothering with 7.3 releases before that. But I think Marc and Bruce figure "as long as the patches are in our CVS we may as well put out a release". We hashed all this out in the pghackers list back in August, but I agree there ought to be something about it on the website. regards, tom lane
On Wednesday 30 November 2005 11:40, Tom Lane wrote: > Personally I expect to keep supporting 7.3 for a long while, because Red > Hat pays me to ;-) ... and the EOL date for RHEL3 is a long way away yet. > The PG community may stop bothering with 7.3 releases before that. But > I think Marc and Bruce figure "as long as the patches are in our CVS we > may as well put out a release". > Yeah, thats one of the reasons I am skeptical about having official policies on this type of thing. If Sun decided they wanted to maintain 7.2 and were going to dedicate developers and testing for it, would we really turn that away? OK, I don't really want to have this discussion again, but as of now I think we are all agreed that 7.2 is unsupported. > We hashed all this out in the pghackers list back in August, but I agree > there ought to be something about it on the website. > We've been kicking it around but haven't moved much on this... Marc, can you move the 7.2 branches in the FTP under the OLD directory? http://www.postgresql.org/ftp/source/ We need to do the same with 7.2 documentation, moving them into the Manual Archive http://www.postgresql.org/docs/manuals/archive.html. We can also change the caption on the main documentation page to note these are manuals for the current supported versions. -- Robert Treat Build A Brighter Lamp :: Linux Apache {middleware} PostgreSQL
Done, as well as moved all but the last two of each version after ... On Wed, 30 Nov 2005, Robert Treat wrote: > On Wednesday 30 November 2005 11:40, Tom Lane wrote: >> Personally I expect to keep supporting 7.3 for a long while, because Red >> Hat pays me to ;-) ... and the EOL date for RHEL3 is a long way away yet. >> The PG community may stop bothering with 7.3 releases before that. But >> I think Marc and Bruce figure "as long as the patches are in our CVS we >> may as well put out a release". >> > > Yeah, thats one of the reasons I am skeptical about having official policies > on this type of thing. If Sun decided they wanted to maintain 7.2 and were > going to dedicate developers and testing for it, would we really turn that > away? OK, I don't really want to have this discussion again, but as of now I > think we are all agreed that 7.2 is unsupported. > >> We hashed all this out in the pghackers list back in August, but I agree >> there ought to be something about it on the website. >> > > We've been kicking it around but haven't moved much on this... > > Marc, can you move the 7.2 branches in the FTP under the OLD directory? > http://www.postgresql.org/ftp/source/ > > We need to do the same with 7.2 documentation, moving them into the Manual > Archive http://www.postgresql.org/docs/manuals/archive.html. We can also > change the caption on the main documentation page to note these are manuals > for the current supported versions. > > -- > Robert Treat > Build A Brighter Lamp :: Linux Apache {middleware} PostgreSQL > > ---------------------------(end of broadcast)--------------------------- > TIP 2: Don't 'kill -9' the postmaster > ---- Marc G. Fournier Hub.Org Networking Services (http://www.hub.org) Email: scrappy@hub.org Yahoo!: yscrappy ICQ: 7615664
I have a COPY CSV weird thing I'll post in a minute... Tom Lane wrote: > It's been about a month since 8.1.0 was released, and we've found about > the usual number of bugs for a new release, so it seems like it's time > for 8.1.1. The core committee has tentatively agreed to plan a release > for Tuesday Dec 6 (which means wrapping tarballs Monday). We will > at the same time be making new dot-releases in the 7.3, 7.4, and 8.0 > branches, principally to fix the SLRU race condition reported by Jim > Nasby and Robert Creager. > > So ... if you've got any open issues with the back branches, now's the > time to get those patches in ... > > regards, tom lane > > ---------------------------(end of broadcast)--------------------------- > TIP 6: explain analyze is your friend
Tom Lane said: > > We hashed all this out in the pghackers list back in August, but I > agree there ought to be something about it on the website. > The reason I asked again is that, notwithstanding the recent discussion, I have observed confusion about the matter (including Jan telling me he didn't think there was any agreed policy). cheers andrew
On Wed, Nov 30, 2005 at 01:23:38PM -0500, Robert Treat wrote: > On Wednesday 30 November 2005 11:40, Tom Lane wrote: > > Personally I expect to keep supporting 7.3 for a long while, > > because Red Hat pays me to ;-) ... and the EOL date for RHEL3 is a > > long way away yet. The PG community may stop bothering with 7.3 > > releases before that. But I think Marc and Bruce figure "as long > > as the patches are in our CVS we may as well put out a release". > > Yeah, thats one of the reasons I am skeptical about having official > policies on this type of thing. I see this as an excellent reason to draw a bright, sharp line between what vendors support and what the community as a whole does, especially where individual community members wear another hat. > If Sun decided they wanted to maintain 7.2 and were going to > dedicate developers and testing for it, would we really turn that > away? If any company chooses to support versions that the community is no longer supporting, that can be part of their value-add or more properly, their headache. Making commitments on behalf of the community--which will be held responsible for them no matter what happens--based on what some company says it's going to do this week is *extremely* ill-advised. > OK, I don't really want to have this discussion again, but as of now > I think we are all agreed that 7.2 is unsupported. And it's good that we're making more definite moves to show that we no longer support it :) > > We hashed all this out in the pghackers list back in August, but I agree > > there ought to be something about it on the website. > > > > We've been kicking it around but haven't moved much on this... > > Marc, can you move the 7.2 branches in the FTP under the OLD directory? > http://www.postgresql.org/ftp/source/ > > We need to do the same with 7.2 documentation, moving them into the Manual > Archive http://www.postgresql.org/docs/manuals/archive.html. We can also > change the caption on the main documentation page to note these are manuals > for the current supported versions. Excellent :) Cheers, D -- David Fetter david@fetter.org http://fetter.org/ phone: +1 415 235 3778 Remember to vote!
On Wed, 30 Nov 2005, David Fetter wrote: > On Wed, Nov 30, 2005 at 01:23:38PM -0500, Robert Treat wrote: >> On Wednesday 30 November 2005 11:40, Tom Lane wrote: >>> Personally I expect to keep supporting 7.3 for a long while, >>> because Red Hat pays me to ;-) ... and the EOL date for RHEL3 is a >>> long way away yet. The PG community may stop bothering with 7.3 >>> releases before that. But I think Marc and Bruce figure "as long >>> as the patches are in our CVS we may as well put out a release". >> >> Yeah, thats one of the reasons I am skeptical about having official >> policies on this type of thing. > > I see this as an excellent reason to draw a bright, sharp line between > what vendors support and what the community as a whole does, > especially where individual community members wear another hat. So, if Sun, SRA, Pervasive, Command Prompt, etc were to submit a patch for v7.2, we'd refuse it? I think not ... Will we accept/fix a bug report *for* v7.2, that is different ... ---- Marc G. Fournier Hub.Org Networking Services (http://www.hub.org) Email: scrappy@hub.org Yahoo!: yscrappy ICQ: 7615664
>> >> I see this as an excellent reason to draw a bright, sharp line between >> what vendors support and what the community as a whole does, >> especially where individual community members wear another hat. > > > So, if Sun, SRA, Pervasive, Command Prompt, etc were to submit a patch > for v7.2, we'd refuse it? I think not ... Oh but you should. The community has enough to worry about. Joshua D. Drake -- The PostgreSQL Company - Command Prompt, Inc. 1.503.667.4564 PostgreSQL Replication, Consulting, Custom Development, 24x7 support Managed Services, Shared and Dedicated Hosting Co-Authors: PLphp, PLperl - http://www.commandprompt.com/
On Wed, Nov 30, 2005 at 11:56:33PM -0400, Marc G. Fournier wrote: > On Wed, 30 Nov 2005, David Fetter wrote: > > >On Wed, Nov 30, 2005 at 01:23:38PM -0500, Robert Treat wrote: > >>On Wednesday 30 November 2005 11:40, Tom Lane wrote: > >>>Personally I expect to keep supporting 7.3 for a long while, > >>>because Red Hat pays me to ;-) ... and the EOL date for RHEL3 is a > >>>long way away yet. The PG community may stop bothering with 7.3 > >>>releases before that. But I think Marc and Bruce figure "as long > >>>as the patches are in our CVS we may as well put out a release". > >> > >>Yeah, thats one of the reasons I am skeptical about having official > >>policies on this type of thing. > > > >I see this as an excellent reason to draw a bright, sharp line between > >what vendors support and what the community as a whole does, > >especially where individual community members wear another hat. > > So, if Sun, SRA, Pervasive, Command Prompt, etc were to submit a patch for > v7.2, we'd refuse it? That depends on what you mean by "refuse." Such a patch wouldn't resurrect the original Postgres with POSTQUEL and cause us to support it, and it won't cause us to start supporting PostgreSQL 7.2 again either. That said, there's a backports project on pgfoundry. We could see about something like an "attic" project for such patches, etc. This way, the community doesn't get albatrosses draped over its neck, and the patches are available for those interested :) Cheers, D -- David Fetter david@fetter.org http://fetter.org/ phone: +1 415 235 3778 Remember to vote!
On Wed, 2005-11-30 at 10:56 -0500, Tom Lane wrote: > It's been about a month since 8.1.0 was released, and we've found about > the usual number of bugs for a new release, so it seems like it's time > for 8.1.1. I think one fix that should be made in time for 8.1.1 is adding a note to the "version migration" section of the 8.1 release notes describing the "invalid UTF-8 byte sequence" problems that some people have run into when upgrading from prior versions. I'm not familiar enough with the problem or its remedies to add the note myself, though. -Neil
Neil Conway wrote: > On Wed, 2005-11-30 at 10:56 -0500, Tom Lane wrote: > > It's been about a month since 8.1.0 was released, and we've found about > > the usual number of bugs for a new release, so it seems like it's time > > for 8.1.1. > > I think one fix that should be made in time for 8.1.1 is adding a note > to the "version migration" section of the 8.1 release notes describing > the "invalid UTF-8 byte sequence" problems that some people have run > into when upgrading from prior versions. I'm not familiar enough with > the problem or its remedies to add the note myself, though. Agreed, but I don't understand the problem well enough either. Does anyone? -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 359-1001+ If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania19073
David Fetter wrote: > On Wed, Nov 30, 2005 at 11:56:33PM -0400, Marc G. Fournier wrote: > > So, if Sun, SRA, Pervasive, Command Prompt, etc were to submit a patch for > > v7.2, we'd refuse it? > > That depends on what you mean by "refuse." Such a patch wouldn't > resurrect the original Postgres with POSTQUEL and cause us to support > it, and it won't cause us to start supporting PostgreSQL 7.2 again > either. Okay, but suppose the patch in question breaks the version in question in some subtle but horrible way? If the community isn't "supporting" the release in question then it implies that it won't go to the effort of testing the patch, subjecting it to a beta period, etc. But since the patch would be applied by the community, the implication would be that the community *endorses* the patch in question, since the official source would be changed to reflect it. If the patch breaks the release horribly, just blindly accepting it wouldn't do good things to the community's reputation. And that means that the only really good way to guard against such an occurrance is to subject the patch to the same process that's used for officially supported releases. At that point, there's no real distinction between "officially supported" and "not officially supported". I doubt the community wants to go down that road. The acceptance of a patch by the community probably implies a lot more than one would think at first glance, so this is certainly an issue that should be thought all the way through. -- Kevin Brown kevin@sysexperts.com
On Sat, Dec 03, 2005 at 10:54:08AM -0500, Bruce Momjian wrote: > Neil Conway wrote: > > On Wed, 2005-11-30 at 10:56 -0500, Tom Lane wrote: > > > It's been about a month since 8.1.0 was released, and we've found about > > > the usual number of bugs for a new release, so it seems like it's time > > > for 8.1.1. > > > > I think one fix that should be made in time for 8.1.1 is adding a note > > to the "version migration" section of the 8.1 release notes describing > > the "invalid UTF-8 byte sequence" problems that some people have run > > into when upgrading from prior versions. I'm not familiar enough with > > the problem or its remedies to add the note myself, though. > > Agreed, but I don't understand the problem well enough either. Does > anyone? There was a thread a couple of weeks back about this problem. Here's my sample writeup -- I give my permission for anyone to use it as they see fit: Upgrading UNICODE databases to 8.1 Postgres 8.1 includes a number of bug-fixes and improvements to Unicode and UTF-8 character handling. Unfortunately previous releases would accept character sequences that were not valid UTF-8. This may cause problems when upgrading your database using pg_dump/pg_restore resulting in an error message like this: Invalid UNICODE byte sequence detected near byte ... To convert your pre-8.1 database to 8.1 you may have to remove and/or fix the offending characters. One simple way to fix the problem is to run your pg_dump output through the iconv command like this: iconv -c -f UTF8 -t UTF8 -o fixed.sql dump.sql The -c flag tells iconv to omit invalid characters from output. There is one problem with this. Most versions of iconv try to read the entire input file into memory. If you dump is quite large you will need to split the dump into multiple files and convert each one individually. You must use the -l flag for split to insure that the unicode byte sequences are not split. split -l 10000 dump.sql Another possible solution is to use the --inserts flag to pg_dump. When you load the resulting data dump in 8.1 this will result in the problem rows showing up in your error log. -- Paul Lindner ||||| | | | | | | | | | lindner@inuus.com
Paul Lindner <lindner@inuus.com> writes: > To convert your pre-8.1 database to 8.1 you may have to remove and/or > fix the offending characters. One simple way to fix the problem is to > run your pg_dump output through the iconv command like this: > iconv -c -f UTF8 -t UTF8 -o fixed.sql dump.sql Is that really a one-size-fits-all solution? Especially with -c? regards, tom lane
On Sun, Dec 04, 2005 at 11:34:16AM -0500, Tom Lane wrote: > Paul Lindner <lindner@inuus.com> writes: > > To convert your pre-8.1 database to 8.1 you may have to remove and/or > > fix the offending characters. One simple way to fix the problem is to > > run your pg_dump output through the iconv command like this: > > > iconv -c -f UTF8 -t UTF8 -o fixed.sql dump.sql > > Is that really a one-size-fits-all solution? Especially with -c? > I'd say yes, and the -c flag is needed so iconv strips out the invalid characters. This technique worked for some smaller databases I converted and croaked with out-of-memory on the larger ones. It certainly doesn't make the problem worse. If one wanted to fix this in the general case one could duplicate the iconv behavior in the Postgres code via some kind of special flag/setting that is only used for imports.. set strip_bad_utf8 = on -- Paul Lindner ||||| | | | | | | | | | lindner@inuus.com
Paul Lindner <lindner@inuus.com> writes: > On Sun, Dec 04, 2005 at 11:34:16AM -0500, Tom Lane wrote: >> Paul Lindner <lindner@inuus.com> writes: >>> iconv -c -f UTF8 -t UTF8 -o fixed.sql dump.sql >> >> Is that really a one-size-fits-all solution? Especially with -c? > I'd say yes, and the -c flag is needed so iconv strips out the > invalid characters. That's exactly what's bothering me about it. If we recommend that we had better put a large THIS WILL DESTROY YOUR DATA warning first. The problem is that the data is not "invalid" from the user's point of view --- more likely, it's in some non-UTF8 encoding --- and so just throwing away some of the characters is unlikely to make people happy. regards, tom lane
On 12/4/05, Tom Lane <tgl@sss.pgh.pa.us> wrote: > Paul Lindner <lindner@inuus.com> writes: > > On Sun, Dec 04, 2005 at 11:34:16AM -0500, Tom Lane wrote: > >> Paul Lindner <lindner@inuus.com> writes: > >>> iconv -c -f UTF8 -t UTF8 -o fixed.sql dump.sql > >> > >> Is that really a one-size-fits-all solution? Especially with -c? > > > I'd say yes, and the -c flag is needed so iconv strips out the > > invalid characters. > > That's exactly what's bothering me about it. If we recommend that > we had better put a large THIS WILL DESTROY YOUR DATA warning first. > The problem is that the data is not "invalid" from the user's point > of view --- more likely, it's in some non-UTF8 encoding --- and so > just throwing away some of the characters is unlikely to make people > happy. Nor is it even guarenteed to make the data load: If the column is unique constrained and the removal of the non-UTF characters makes two rows have the same data where they didn't before... The way to preserve the data is to switch the column to be a bytea.
On Sun, Dec 04, 2005 at 12:19:32PM -0500, Gregory Maxwell wrote: > > That's exactly what's bothering me about it. If we recommend that > > we had better put a large THIS WILL DESTROY YOUR DATA warning first. > > The problem is that the data is not "invalid" from the user's point > > of view --- more likely, it's in some non-UTF8 encoding --- and so > > just throwing away some of the characters is unlikely to make people > > happy. > > Nor is it even guarenteed to make the data load: If the column is > unique constrained and the removal of the non-UTF characters makes two > rows have the same data where they didn't before... > > The way to preserve the data is to switch the column to be a bytea. Additionally, it's hard to suggest anything better without specific knowledge of the characters that are incorrect and how they got there. The ideal solution would be a way for people to identify problem data *before* they dump so they have an opportunity to fix it. Something like a module they can load and say: select val from table where not utf8_validate(val); This would allow people to examine the data while the system is still running and fix it. Maybe we can code something up in plpgsql? Slow as molasses but you'll be able to run it anywhere. Have a nice day, -- Martijn van Oosterhout <kleptog@svana.org> http://svana.org/kleptog/ > Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a > tool for doing 5% of the work and then sitting around waiting for someone > else to do the other 95% so you can sue them.
Hi all, On Sun, 4 Dec 2005, Tom Lane wrote: > Paul Lindner <lindner@inuus.com> writes: > > To convert your pre-8.1 database to 8.1 you may have to remove and/or > > fix the offending characters. One simple way to fix the problem is to > > run your pg_dump output through the iconv command like this: > > > iconv -c -f UTF8 -t UTF8 -o fixed.sql dump.sql > > Is that really a one-size-fits-all solution? Especially with -c? > It's definately not a one size fits all. The reassuring thing is that others have tried to deal with this problem before. Omar Kilani and I have spent a few hours looking at the problem. For situations where there is a lot of invalid encoding, manual fixing is just not viable. The vim project has a kind of fuzzy encoding conversion which accounts for a lot of the non-UTF8 sequences in UTF8 data. You can use vim to modify your text dump as follows: vim -c ":wq! ++enc=utf8 fixed.dump" original.dump Now, our testing of this is far from exhaustive but it's a lot better than just cutting the data from the original dump. Those suffering the problem should definately check this out, particularly if you have a non-trivial amount of data. Thanks, Gavin
I have added your suggestions to the 8.1.X release notes. --------------------------------------------------------------------------- Paul Lindner wrote: -- Start of PGP signed section. > On Sat, Dec 03, 2005 at 10:54:08AM -0500, Bruce Momjian wrote: > > Neil Conway wrote: > > > On Wed, 2005-11-30 at 10:56 -0500, Tom Lane wrote: > > > > It's been about a month since 8.1.0 was released, and we've found about > > > > the usual number of bugs for a new release, so it seems like it's time > > > > for 8.1.1. > > > > > > I think one fix that should be made in time for 8.1.1 is adding a note > > > to the "version migration" section of the 8.1 release notes describing > > > the "invalid UTF-8 byte sequence" problems that some people have run > > > into when upgrading from prior versions. I'm not familiar enough with > > > the problem or its remedies to add the note myself, though. > > > > Agreed, but I don't understand the problem well enough either. Does > > anyone? > > There was a thread a couple of weeks back about this problem. Here's > my sample writeup -- I give my permission for anyone to use it as they > see fit: > > > Upgrading UNICODE databases to 8.1 > > Postgres 8.1 includes a number of bug-fixes and improvements to > Unicode and UTF-8 character handling. Unfortunately previous releases > would accept character sequences that were not valid UTF-8. This > may cause problems when upgrading your database using > pg_dump/pg_restore resulting in an error message like this: > > Invalid UNICODE byte sequence detected near byte ... > > To convert your pre-8.1 database to 8.1 you may have to remove and/or > fix the offending characters. One simple way to fix the problem is to > run your pg_dump output through the iconv command like this: > > iconv -c -f UTF8 -t UTF8 -o fixed.sql dump.sql > > The -c flag tells iconv to omit invalid characters from output. > > There is one problem with this. Most versions of iconv try to read > the entire input file into memory. If you dump is quite large you > will need to split the dump into multiple files and convert each one > individually. You must use the -l flag for split to insure that the > unicode byte sequences are not split. > > split -l 10000 dump.sql > > Another possible solution is to use the --inserts flag to pg_dump. > When you load the resulting data dump in 8.1 this will result in the > problem rows showing up in your error log. > > -- > Paul Lindner ||||| | | | | | | | | | > lindner@inuus.com -- End of PGP section, PGP failed! -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 359-1001+ If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania19073
Bruce Momjian <pgman@candle.pha.pa.us> writes: > I have added your suggestions to the 8.1.X release notes. Did you read the followup discussion? Recommending -c without a large warning seems a very bad idea. regards, tom lane
Tom Lane wrote: > Bruce Momjian <pgman@candle.pha.pa.us> writes: > > I have added your suggestions to the 8.1.X release notes. > > Did you read the followup discussion? Recommending -c without a large > warning seems a very bad idea. Well, I said it would remove invalid sequences. What else should we say? This will remove invalid character sequences. I saw no clear solution that allowed sequences to be corrected. -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 359-1001+ If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania19073
Bruce Momjian wrote: > Tom Lane wrote: > > Bruce Momjian <pgman@candle.pha.pa.us> writes: > > > I have added your suggestions to the 8.1.X release notes. > > > > Did you read the followup discussion? Recommending -c without a large > > warning seems a very bad idea. > > Well, I said it would remove invalid sequences. What else should we > say? > > This will remove invalid character sequences. > > I saw no clear solution that allowed sequences to be corrected. The release note text is: Some users are having problems loading <literal>UTF8</> data into 8.1.X. This is because previous versions allowed invalid<literal>UTF8</>sequences to be entered into the database, and this release properlyaccepts only valid <literal>UTF8</>sequences. One way to correct adumpfile is to use <command>iconv -c -f UTF-8 -t UTF-8</>. This willremoveinvalid character sequences. <command>iconv</> reads the entireinput file into memory so it might be necessaryto <command>split</> thedump into multiple smaller files for processing. One nice solution would be if iconv would report the lines with errors and you could correct them, but I see no way to do that. The only thing you could do is to diff the old and new files to see the problems. Is that helpful? Here is new text I have used: Some users are having problems loading <literal>UTF8</> data into 8.1.X. This is because previous versions allowed invalid<literal>UTF8</>sequences to be entered into the database, and this release properlyaccepts only valid <literal>UTF8</>sequences. One way to correct adumpfile is to use <command>iconv -c -f UTF-8 -t UTF-8 -o cleanfile.sqldumpfile.sql</>. The <literal>-c</> option removes invalid charactersequences. A diff of the two files willshow the sequences that areinvalid. <command>iconv</> reads the entire input file into memory soit might be necessaryto <command>split</> the dump into multiplesmaller files for processing. It highlights the 'diff' idea. -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 359-1001+ If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania19073
Bruce Momjian wrote: > One nice solution would be if iconv would report the lines with > errors and you could correct them, but I see no way to do that. The > only thing you could do is to diff the old and new files to see the > problems. Is that helpful? Here is new text I have used: I think this is nice. It users see a big mess, they will have to clean it up by hand anyway. How about this for better wording: diff -u -3 -p -r1.400.2.4 release.sgml --- doc/src/sgml/release.sgml 6 Dec 2005 20:26:02 -0000 1.400.2.4 +++ doc/src/sgml/release.sgml 6 Dec 2005 20:44:26 -0000 @@ -528,15 +528,16 @@ psql -t -f fixseq.sql db1 | psql -e db1 <listitem> <para> - Some users are having problems loading <literal>UTF8</> data into - 8.1.X. This is because previous versions allowed invalid <literal>UTF8</> + Some users are having problems loading UTF-8 data into + 8.1.X. This is because previous versions allowed invalid UTF-8 byte sequences to be entered into the database,and this release - properly accepts only valid <literal>UTF8</> sequences. One - way to correct a dumpfile is to use <command>iconv -c -f UTF-8 -t UTF-8 + properly accepts only valid UTF-8 sequences. One + way to correct a dumpfile is to run the command <command>iconv -c -f UTF-8 -t UTF-8 -o cleanfile.sql dumpfile.sql</>. The <literal>-c</> option removes invalid character sequences. A diff of the two files will showthe sequences that are invalid. <command>iconv</> reads the entire input - file into memory so it might be necessary to <command>split</> the dump + file into memory so it might be necessary to use <command>split</> + to break up the dump into multiple smaller files for processing. </para> </listitem> -- Peter Eisentraut http://developer.postgresql.org/~petere/
Nice, updated. --------------------------------------------------------------------------- Peter Eisentraut wrote: > Bruce Momjian wrote: > > One nice solution would be if iconv would report the lines with > > errors and you could correct them, but I see no way to do that. The > > only thing you could do is to diff the old and new files to see the > > problems. Is that helpful? Here is new text I have used: > > I think this is nice. It users see a big mess, they will have to clean > it up by hand anyway. > > How about this for better wording: > > diff -u -3 -p -r1.400.2.4 release.sgml > --- doc/src/sgml/release.sgml 6 Dec 2005 20:26:02 -0000 1.400.2.4 > +++ doc/src/sgml/release.sgml 6 Dec 2005 20:44:26 -0000 > @@ -528,15 +528,16 @@ psql -t -f fixseq.sql db1 | psql -e db1 > > <listitem> > <para> > - Some users are having problems loading <literal>UTF8</> data into > - 8.1.X. This is because previous versions allowed invalid <literal>UTF8</> > + Some users are having problems loading UTF-8 data into > + 8.1.X. This is because previous versions allowed invalid UTF-8 byte > sequences to be entered into the database, and this release > - properly accepts only valid <literal>UTF8</> sequences. One > - way to correct a dumpfile is to use <command>iconv -c -f UTF-8 -t UTF-8 > + properly accepts only valid UTF-8 sequences. One > + way to correct a dumpfile is to run the command <command>iconv -c -f UTF-8 -t UTF-8 > -o cleanfile.sql dumpfile.sql</>. The <literal>-c</> option removes > invalid character sequences. A diff of the two files will show the > sequences that are invalid. <command>iconv</> reads the entire input > - file into memory so it might be necessary to <command>split</> the dump > + file into memory so it might be necessary to use <command>split</> > + to break up the dump > into multiple smaller files for processing. > </para> > </listitem> > > -- > Peter Eisentraut > http://developer.postgresql.org/~petere/ > > ---------------------------(end of broadcast)--------------------------- > TIP 5: don't forget to increase your free space map settings > -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 359-1001+ If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania19073
Hi, On Tue, 6 Dec 2005, Bruce Momjian wrote: > > Nice, updated. > > --------------------------------------------------------------------------- > I think my suggestion from the other day is useful also. --- Omar Kilani and I have spent a few hours looking at the problem. For situations where there is a lot of invalid encoding, manual fixing is just not viable. The vim project has a kind of fuzzy encoding conversion which accounts for a lot of the non-UTF8 sequences in UTF8 data. You can use vim to modify your text dump as follows: vim -c ":wq! ++enc=utf8 fixed.dump" original.dump --- I think this is a viable option for people with a non-trivial amount of data and don't see manual fixing or potentially losing data as a viable option. Thanks, Gavin
Exactly what does vim do that iconv does not? Fuzzy encoding sounds scary to me. --------------------------------------------------------------------------- Gavin Sherry wrote: > Hi, > > On Tue, 6 Dec 2005, Bruce Momjian wrote: > > > > > Nice, updated. > > > > --------------------------------------------------------------------------- > > > > I think my suggestion from the other day is useful also. > > --- > > Omar Kilani and I have spent a few hours looking at the problem. For > situations where there is a lot of invalid encoding, manual fixing is just > not viable. The vim project has a kind of fuzzy encoding conversion which > accounts for a lot of the non-UTF8 sequences in UTF8 data. You can use vim > to modify your text dump as follows: > > vim -c ":wq! ++enc=utf8 fixed.dump" original.dump > > --- > > I think this is a viable option for people with a non-trivial amount of > data and don't see manual fixing or potentially losing data as a viable > option. > > Thanks, > > Gavin > > ---------------------------(end of broadcast)--------------------------- > TIP 5: don't forget to increase your free space map settings > -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 359-1001+ If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania19073
On Tue, 6 Dec 2005, Bruce Momjian wrote: > > Exactly what does vim do that iconv does not? Fuzzy encoding sounds > scary to me. > Right. It actually makes assumptions about the source encoding. People who care about their data need, unfortunately, to spend a bit of time on this problem. I've been discussing the same issue on the slony1 mailing list, because the issue can affect people's ability upgrade using slony1. http://gborg.postgresql.org/pipermail/slony1-general/2005-December/003430.html It would be good if had the script I suggest in the email: A script which identifies non-utf-8 characters and provides somecontext, line numbers, etc, will greatly speed up the processofremedying the situation. Thoughts? Gavin
Gavin Sherry wrote: > On Tue, 6 Dec 2005, Bruce Momjian wrote: > > > > > Exactly what does vim do that iconv does not? Fuzzy encoding sounds > > scary to me. > > > > Right. It actually makes assumptions about the source encoding. People who > care about their data need, unfortunately, to spend a bit of time on this > problem. I've been discussing the same issue on the slony1 mailing list, > because the issue can affect people's ability upgrade using slony1. > > http://gborg.postgresql.org/pipermail/slony1-general/2005-December/003430.html > > It would be good if had the script I suggest in the email: > > A script which identifies non-utf-8 characters and provides some > context, line numbers, etc, will greatly speed up the process of > remedying the situation. I think the best we can do is the "iconv -c with the diff" idea, which is already in the release notes. I suppose we could merge the iconv and diff into a single command, but I don't see a portable way to output the iconv output to stdout., /dev/stdin not being portable. -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 359-1001+ If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania19073
On 12/8/05, Bruce Momjian <pgman@candle.pha.pa.us> wrote: > > A script which identifies non-utf-8 characters and provides some > > context, line numbers, etc, will greatly speed up the process of > > remedying the situation. > > I think the best we can do is the "iconv -c with the diff" idea, which > is already in the release notes. I suppose we could merge the iconv and > diff into a single command, but I don't see a portable way to output the > iconv output to stdout., /dev/stdin not being portable. No, what is needed for people who care about fixing their data is a loadable strip_invalid_utf8() that works in older versions.. then just select * from bar where foo != strip_invalid_utf8(foo); The function would be useful in general, for example, if you have an application which doesn't already have much utf8 logic, you want to use a text field, and stripping is the behaviour you want. For example, lots of simple web applications.
On Thu, Dec 08, 2005 at 05:54:35PM -0500, Gregory Maxwell wrote: > No, what is needed for people who care about fixing their data is a > loadable strip_invalid_utf8() that works in older versions.. then just > select * from bar where foo != strip_invalid_utf8(foo); The function > would be useful in general, for example, if you have an application > which doesn't already have much utf8 logic, you want to use a text > field, and stripping is the behaviour you want. For example, lots of > simple web applications. Would something like the following work? It's written in pl/pgsql and does (AFAICS) the same checking as the backend in recent releases. Except the backend only supports up to 4-byte UTF-8 whereas this function checks upto six byte. For a six byte UTF-8 character, who is wrong? In any case, people should be able to do something like: SELECT field FROM table WHERE NOT utf8_verify(field,4); To check conformance with PostgreSQL 8.1. Note, I don't have large chunks of UTF-8 to test with but it works for the characters I tried with. Tested with 7.4. Have a nice day, -- Martijn van Oosterhout <kleptog@svana.org> http://svana.org/kleptog/ > Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a > tool for doing 5% of the work and then sitting around waiting for someone > else to do the other 95% so you can sue them.
Attachment
Martijn van Oosterhout wrote: -- Start of PGP signed section. > On Thu, Dec 08, 2005 at 05:54:35PM -0500, Gregory Maxwell wrote: > > No, what is needed for people who care about fixing their data is a > > loadable strip_invalid_utf8() that works in older versions.. then just > > select * from bar where foo != strip_invalid_utf8(foo); The function > > would be useful in general, for example, if you have an application > > which doesn't already have much utf8 logic, you want to use a text > > field, and stripping is the behaviour you want. For example, lots of > > simple web applications. > > Would something like the following work? It's written in pl/pgsql and > does (AFAICS) the same checking as the backend in recent releases. > Except the backend only supports up to 4-byte UTF-8 whereas this > function checks upto six byte. For a six byte UTF-8 character, who is > wrong? > > In any case, people should be able to do something like: > > SELECT field FROM table WHERE NOT utf8_verify(field,4); > > To check conformance with PostgreSQL 8.1. Note, I don't have large > chunks of UTF-8 to test with but it works for the characters I tried > with. Tested with 7.4. I think the problem with any kind of function-call detection is that the data has to get into the database first, and it isn't clear how someone loading a failed dump would do that aside from modifying the column to bytea in the dump, loading it in, then fixing it. The iconv idea has the advantage that it can be fixed before loading into the database. -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 359-1001+ If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania19073
On Fri, Dec 09, 2005 at 11:34:22AM -0500, Bruce Momjian wrote: > I think the problem with any kind of function-call detection is that the > data has to get into the database first, and it isn't clear how someone > loading a failed dump would do that aside from modifying the column to > bytea in the dump, loading it in, then fixing it. The iconv idea has > the advantage that it can be fixed before loading into the database. The point of this function is to test the data *before* you even create the dump, while it is still running on 7.4 or 8.0. This means someone who is planning on upgrading to 8.1 in two months can use this function now to weed out the bad data before the upgrade even starts. Have a nice day, -- Martijn van Oosterhout <kleptog@svana.org> http://svana.org/kleptog/ > Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a > tool for doing 5% of the work and then sitting around waiting for someone > else to do the other 95% so you can sue them.
Martijn van Oosterhout wrote: -- Start of PGP signed section. > On Fri, Dec 09, 2005 at 11:34:22AM -0500, Bruce Momjian wrote: > > I think the problem with any kind of function-call detection is that the > > data has to get into the database first, and it isn't clear how someone > > loading a failed dump would do that aside from modifying the column to > > bytea in the dump, loading it in, then fixing it. The iconv idea has > > the advantage that it can be fixed before loading into the database. > > The point of this function is to test the data *before* you even create > the dump, while it is still running on 7.4 or 8.0. > > This means someone who is planning on upgrading to 8.1 in two months > can use this function now to weed out the bad data before the upgrade > even starts. Oh, so you back-load it into the old database. Interesting. I assume to be useful you would have to write something that checked every column values in every table and database. -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 359-1001+ If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania19073
On Fri, Dec 09, 2005 at 12:38:21PM -0500, Bruce Momjian wrote: > > This means someone who is planning on upgrading to 8.1 in two months > > can use this function now to weed out the bad data before the upgrade > > even starts. > > Oh, so you back-load it into the old database. Interesting. I assume > to be useful you would have to write something that checked every column > values in every table and database. Umm, yeah. I was thinking about how to do that. pl/pgsql is not the best language to do that in. In any case I found a bug in the version I posted and also added a function that does: test=# select * from db_utf8_verify();tab | fld | location ------+-----+----------tbl1 | foo | (12,3) (1 row) It gives the table, field and ctid of any values that failed. It skips pg_catalog. It's also *really* slow for long strings. Just executing it on the pg_rewrite in the default installation takes forever. If someone really wanted this for a large database maybe they should recode it in C. http://svana.org/kleptog/pgsql/utf8_verify.sql Have a nice day, -- Martijn van Oosterhout <kleptog@svana.org> http://svana.org/kleptog/ > Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a > tool for doing 5% of the work and then sitting around waiting for someone > else to do the other 95% so you can sue them.
Was thinking if someone could summarize this all it would make a really good FAQ entry. Robert Treat On Friday 09 December 2005 13:28, Martijn van Oosterhout wrote: > On Fri, Dec 09, 2005 at 12:38:21PM -0500, Bruce Momjian wrote: > > > This means someone who is planning on upgrading to 8.1 in two months > > > can use this function now to weed out the bad data before the upgrade > > > even starts. > > > > Oh, so you back-load it into the old database. Interesting. I assume > > to be useful you would have to write something that checked every column > > values in every table and database. > > Umm, yeah. I was thinking about how to do that. pl/pgsql is not the > best language to do that in. In any case I found a bug in the version I > posted and also added a function that does: > > test=# select * from db_utf8_verify(); > tab | fld | location > ------+-----+---------- > tbl1 | foo | (12,3) > (1 row) > > It gives the table, field and ctid of any values that failed. It skips > pg_catalog. It's also *really* slow for long strings. Just executing it > on the pg_rewrite in the default installation takes forever. If someone > really wanted this for a large database maybe they should recode it in > C. > > http://svana.org/kleptog/pgsql/utf8_verify.sql > > Have a nice day, -- Robert Treat Build A Brighter Lamp :: Linux Apache {middleware} PostgreSQL
I don't see it asked very often, and I think our 8.1 releae note addition (plus a mention in the 8.1.1 notes) will complete this. --------------------------------------------------------------------------- Robert Treat wrote: > Was thinking if someone could summarize this all it would make a really good > FAQ entry. > > Robert Treat > > On Friday 09 December 2005 13:28, Martijn van Oosterhout wrote: > > On Fri, Dec 09, 2005 at 12:38:21PM -0500, Bruce Momjian wrote: > > > > This means someone who is planning on upgrading to 8.1 in two months > > > > can use this function now to weed out the bad data before the upgrade > > > > even starts. > > > > > > Oh, so you back-load it into the old database. Interesting. I assume > > > to be useful you would have to write something that checked every column > > > values in every table and database. > > > > Umm, yeah. I was thinking about how to do that. pl/pgsql is not the > > best language to do that in. In any case I found a bug in the version I > > posted and also added a function that does: > > > > test=# select * from db_utf8_verify(); > > tab | fld | location > > ------+-----+---------- > > tbl1 | foo | (12,3) > > (1 row) > > > > It gives the table, field and ctid of any values that failed. It skips > > pg_catalog. It's also *really* slow for long strings. Just executing it > > on the pg_rewrite in the default installation takes forever. If someone > > really wanted this for a large database maybe they should recode it in > > C. > > > > http://svana.org/kleptog/pgsql/utf8_verify.sql > > > > Have a nice day, > > -- > Robert Treat > Build A Brighter Lamp :: Linux Apache {middleware} PostgreSQL > -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 359-1001+ If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania19073
Bruce Momjian wrote: > I don't see it asked very often, and I think our 8.1 releae note > addition (plus a mention in the 8.1.1 notes) will complete this. > > Actually a "upgrade" FAQ is probably a good idea. Something that says what really happens when foo changes in 8.1 or how foo is different then 8.0. The idea that there is a practical (for those that have practical implications) resource for finding out what it really means that the UTF-8 stuff changed . Joshua D. Drake > --------------------------------------------------------------------------- > > Robert Treat wrote: > >> Was thinking if someone could summarize this all it would make a really good >> FAQ entry. >> >> Robert Treat >> >> On Friday 09 December 2005 13:28, Martijn van Oosterhout wrote: >> >>> On Fri, Dec 09, 2005 at 12:38:21PM -0500, Bruce Momjian wrote: >>> >>>>> This means someone who is planning on upgrading to 8.1 in two months >>>>> can use this function now to weed out the bad data before the upgrade >>>>> even starts. >>>>> >>>> Oh, so you back-load it into the old database. Interesting. I assume >>>> to be useful you would have to write something that checked every column >>>> values in every table and database. >>>> >>> Umm, yeah. I was thinking about how to do that. pl/pgsql is not the >>> best language to do that in. In any case I found a bug in the version I >>> posted and also added a function that does: >>> >>> test=# select * from db_utf8_verify(); >>> tab | fld | location >>> ------+-----+---------- >>> tbl1 | foo | (12,3) >>> (1 row) >>> >>> It gives the table, field and ctid of any values that failed. It skips >>> pg_catalog. It's also *really* slow for long strings. Just executing it >>> on the pg_rewrite in the default installation takes forever. If someone >>> really wanted this for a large database maybe they should recode it in >>> C. >>> >>> http://svana.org/kleptog/pgsql/utf8_verify.sql >>> >>> Have a nice day, >>> >> -- >> Robert Treat >> Build A Brighter Lamp :: Linux Apache {middleware} PostgreSQL >> >> > >