Subject: Upcoming PG re-releases

From: Tom Lane <[email-masked]>
Date: Wed, 30 Nov 2005 10:56:25 -0500

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

---

From: Andrew Dunstan <[email-masked]>
Date: Wed, 30 Nov 2005 11:13:43 -0500

Tom Lane wrote:

> We will

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

---

From: Tom Lane <[email-masked]>
Date: Wed, 30 Nov 2005 11:40:30 -0500

> 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).

> stopped supporting the 7.3 series, which the above would seem to 

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

---

From: Robert Treat <[email-masked]>
Date: Wed, 30 Nov 2005 13:23:38 -0500

> 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. 

> 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

---

From: "Marc G. Fournier" <[email-masked]>
Date: Wed, 30 Nov 2005 14:30:57 -0400 (AST)

Done, as well as moved all but the last two of each version after ...

On Wed, 30 Nov 2005, Robert Treat wrote:

> ---------------------------(end of broadcast)---------------------------
> TIP 2: Don't 'kill -9' the postmaster
>

----
Marc G. Fournier           Hub.Org Networking Services (http://www.hub.org)
Email: [email-masked]           Yahoo!: yscrappy              ICQ: 7615664

---

From: Christopher Kings-Lynne <[email-masked]>
Date: Thu, 01 Dec 2005 09:21:46 +0800

I have a COPY CSV weird thing I'll post in a minute...

Tom Lane wrote:
> TIP 6: explain analyze is your friend

---

From: David Fetter <[email-masked]>
Date: Wed, 30 Nov 2005 17:36:52 -0800

On Wed, Nov 30, 2005 at 01:23:38PM -0500, Robert Treat 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 :)

> for the current supported versions. 

Excellent :)

Cheers,
D
-- 
David Fetter [email-masked] http://fetter.org/
phone: +1 415 235 3778

Remember to vote!

---

From: "Andrew Dunstan" <[email-masked]>
Date: Wed, 30 Nov 2005 20:21:43 -0600 (CST)

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

---

From: "Marc G. Fournier" <[email-masked]>
Date: Wed, 30 Nov 2005 23:56:33 -0400 (AST)

> 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 ...

----

---

From: "Joshua D. Drake" <[email-masked]>
Date: Wed, 30 Nov 2005 20:22:52 -0800

> 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/

---

From: David Fetter <[email-masked]>
Date: Wed, 30 Nov 2005 21:15:59 -0800

On Wed, Nov 30, 2005 at 11:56:33PM -0400, Marc G. Fournier wrote:
> 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

Remember to vote!

---

From: Bruce Momjian <[email-masked]>
Date: Sat, 3 Dec 2005 10:54:08 -0500 (EST)

Neil Conway wrote:
> On Wed, 2005-11-30 at 10:56 -0500, Tom Lane wrote:
> > 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
  [email-masked]               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

---

From: Neil Conway <[email-masked]>
Date: Sat, 03 Dec 2005 10:56:11 -0500

-Neil

---

From: Kevin Brown <[email-masked]>
Date: Sat, 3 Dec 2005 08:10:04 -0800

> it, and it won't cause us to start supporting PostgreSQL 7.2 again

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					      [email-masked]

---

From: Paul Lindner <[email-masked]>
Date: Sun, 4 Dec 2005 08:25:20 -0800

> Agreed, but I don't understand the problem well enough either.  Does

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        ||||| | | | |  |  |  |   |   |
[email-masked]

---

From: Tom Lane <[email-masked]>
Date: Sun, 04 Dec 2005 11:34:16 -0500

>   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

---

From: Paul Lindner <[email-masked]>
Date: Sun, 4 Dec 2005 08:40:54 -0800

> 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

---

From: Tom Lane <[email-masked]>
Date: Sun, 04 Dec 2005 11:52:45 -0500

> I'd say yes, and the -c flag is needed so iconv strips out the

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

---

From: Gregory Maxwell <[email-masked]>
Date: Sun, 4 Dec 2005 12:19:32 -0500

> just throwing away some of the characters is unlikely to make people

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.

---

From: Martijn van Oosterhout <[email-masked]>
Date: Sun, 4 Dec 2005 19:55:05 +0100

> 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   <[email-masked]>   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.

---

From: Gavin Sherry <[email-masked]>
Date: Mon, 5 Dec 2005 15:43:59 +1100 (EST)

Hi all,

> 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

---

From: Bruce Momjian <[email-masked]>
Date: Tue, 6 Dec 2005 14:26:38 -0500 (EST)

I have added your suggestions to the 8.1.X release notes.

---------------------------------------------------------------------------

Paul Lindner wrote:
-- Start of PGP signed section.
> problem rows showing up in your error log.
-- End of PGP section, PGP failed!

---

From: Tom Lane <[email-masked]>
Date: Tue, 06 Dec 2005 14:27:56 -0500

> 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

---

From: Bruce Momjian <[email-masked]>
Date: Tue, 6 Dec 2005 14:32:15 -0500 (EST)

> 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.

---

From: Bruce Momjian <[email-masked]>
Date: Tue, 6 Dec 2005 15:25:13 -0500 (EST)

> 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 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</>. This will
	remove invalid character sequences. <command>iconv</> reads the entire
	input file into memory so it might be necessary to <command>split</> the
	dump 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 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 -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 into multiple
	smaller files for processing.

It highlights the 'diff' idea.

---

From: Peter Eisentraut <[email-masked]>
Date: Tue, 6 Dec 2005 21:47:25 +0100

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/

---

From: Bruce Momjian <[email-masked]>
Date: Tue, 6 Dec 2005 16:00:35 -0500 (EST)

Nice, updated.

Peter Eisentraut wrote:
> TIP 5: don't forget to increase your free space map settings
>

---

From: Gavin Sherry <[email-masked]>
Date: Wed, 7 Dec 2005 14:45:51 +1100 (EST)

Hi,

> Nice, updated.

I think my suggestion from the other day is useful also.

---

---

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

---

From: Bruce Momjian <[email-masked]>
Date: Tue, 6 Dec 2005 23:37:56 -0500 (EST)

Exactly what does vim do that iconv does not?  Fuzzy encoding sounds
scary to me.

---

From: Gavin Sherry <[email-masked]>
Date: Fri, 9 Dec 2005 09:37:39 +1100 (EST)

> Exactly what does vim do that iconv does not?  Fuzzy encoding sounds

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.

Thoughts?

Gavin

---

From: Bruce Momjian <[email-masked]>
Date: Thu, 8 Dec 2005 17:44:34 -0500 (EST)

> 	context, line numbers, etc, will greatly speed up the process of

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.

---

From: Gregory Maxwell <[email-masked]>
Date: Thu, 8 Dec 2005 17:54:35 -0500

> 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.

---

From: Martijn van Oosterhout <[email-masked]>
Date: Fri, 9 Dec 2005 17:17:33 +0100

> field, and stripping is the behaviour you want. For example, lots of

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,

---

From: Bruce Momjian <[email-masked]>
Date: Fri, 9 Dec 2005 11:34:22 -0500 (EST)

Martijn van Oosterhout wrote:
-- Start of PGP signed section.
> chunks of UTF-8 to test with but it works for the characters I tried

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.

---

From: Martijn van Oosterhout <[email-masked]>
Date: Fri, 9 Dec 2005 17:44:10 +0100

> 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,

---

From: Bruce Momjian <[email-masked]>
Date: Fri, 9 Dec 2005 12:38:21 -0500 (EST)

> can use this function now to weed out the bad data before the upgrade

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.

---

From: Martijn van Oosterhout <[email-masked]>
Date: Fri, 9 Dec 2005 19:28:12 +0100

> 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,

---

From: Robert Treat <[email-masked]>
Date: Sat, 10 Dec 2005 18:50:41 -0500

Was thinking if someone could summarize this all it would make a really good 
FAQ entry. 

Robert Treat

---

From: Bruce Momjian <[email-masked]>
Date: Sat, 10 Dec 2005 21:18:00 -0500 (EST)

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.

---

From: "Joshua D. Drake" <[email-masked]>
Date: Sat, 10 Dec 2005 21:30:12 -0800

> 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