<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<id>tag:old.nabble.com,2006:forum-764</id>
	<title>Nabble - PostgreSQL - bugs</title>
	<updated>2009-12-02T18:43:40Z</updated>
	<link rel="self" type="application/atom+xml" href="http://old.nabble.com/PostgreSQL---bugs-f764.xml" />
	<link rel="alternate" type="text/html" href="http://old.nabble.com/PostgreSQL---bugs-f764.html" />
	<subtitle type="html"></subtitle>
	
<entry>
	<id>tag:old.nabble.com,2006:post-26620179</id>
	<title>Re: BUG #5215: Error in PgAdmin</title>
	<published>2009-12-02T18:43:40Z</published>
	<updated>2009-12-02T18:43:40Z</updated>
	<author>
		<name>Robert Haas</name>
	</author>
	<content type="html">On Thu, Nov 26, 2009 at 5:41 AM, Walter Willmertinger &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26620179&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;willmis@...&lt;/a&gt;&amp;gt; wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; The following bug has been logged online:
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Bug reference:      5215
&lt;br&gt;&amp;gt; Logged by:          Walter Willmertinger
&lt;br&gt;&amp;gt; Email address:      &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26620179&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;willmis@...&lt;/a&gt;
&lt;br&gt;&amp;gt; PostgreSQL version: 8.4.1
&lt;br&gt;&amp;gt; Operating system:   Windows XP Prof.
&lt;br&gt;&amp;gt; Description:        Error in PgAdmin
&lt;br&gt;&amp;gt; Details:
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Since we introduced 8.4.1, we had some failures of our database. The server
&lt;br&gt;&amp;gt; remained the same, the application is the same as with our previous 8.3.x
&lt;br&gt;&amp;gt; installation.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Error 1:
&lt;br&gt;&amp;gt; &amp;quot;Missing ... pg_catalog&amp;quot;
&lt;br&gt;&amp;gt; pg_dump not possible
&lt;br&gt;&amp;gt; Fixed by &amp;quot;COPY table to FILE ...&amp;quot; for each separate table
&lt;br&gt;&amp;gt; reinstalling postgres, then restored a previous dump and run the output of
&lt;br&gt;&amp;gt; the &amp;quot;COPY&amp;quot;
&lt;/div&gt;&lt;br&gt;I'm not sure I understand which of the above lines were part of an
&lt;br&gt;error message (and if so, what exactly you did that precipitated the
&lt;br&gt;error) and which of them are your commentary.
&lt;br&gt;&lt;br&gt;...Robert
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-bugs mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26620179&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-bugs@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-bugs&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-bugs&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/BUG--5215%3A-Error-in-PgAdmin-tp26527900p26620179.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26620134</id>
	<title>Re: BUG #5227: please add a divide operator for intervals</title>
	<published>2009-12-02T18:35:05Z</published>
	<updated>2009-12-02T18:35:05Z</updated>
	<author>
		<name>John R Pierce</name>
	</author>
	<content type="html">Michał Pasternak wrote:
&lt;br&gt;&amp;gt; 1 month / 1 day equals 30. 
&lt;br&gt;&amp;gt; &amp;nbsp; 
&lt;br&gt;&lt;br&gt;or 31 or 28 or 29...
&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-bugs mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26620134&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-bugs@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-bugs&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-bugs&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/BUG--5227%3A-please-add-a-divide-operator-for-intervals-tp26618582p26620134.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26620062</id>
	<title>Re: BUG #5227: please add a divide operator for intervals</title>
	<published>2009-12-02T17:36:28Z</published>
	<updated>2009-12-02T17:36:28Z</updated>
	<author>
		<name>Michal Pasternak-3</name>
	</author>
	<content type="html">1 month / 1 day equals 30. 
&lt;br&gt;&lt;br&gt;-----Original Message-----
&lt;br&gt;From: Tom Lane [mailto:&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26620062&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;tgl@...&lt;/a&gt;] 
&lt;br&gt;Sent: Thursday, December 03, 2009 12:46 AM
&lt;br&gt;To: Michal Pasternak
&lt;br&gt;Cc: &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26620062&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-bugs@...&lt;/a&gt;
&lt;br&gt;Subject: Re: [BUGS] BUG #5227: please add a divide operator for intervals 
&lt;br&gt;&lt;br&gt;&amp;quot;Michal Pasternak&amp;quot; &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26620062&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;michal.dtz@...&lt;/a&gt;&amp;gt; writes:
&lt;br&gt;&amp;gt; Please add a divide operator for INTERVAL type, if possible.
&lt;br&gt;&lt;br&gt;Given that intervals have multiple subfields, it's far from obvious
&lt;br&gt;what division should mean. &amp;nbsp;What is '1 month' / '1 day'?
&lt;br&gt;&lt;br&gt;&amp;gt; db=# SELECT EXTRACT(EPOCH FROM '15 seconds'::INTERVAL) / EXTRACT(EPOCH
&lt;br&gt;FROM
&lt;br&gt;&amp;gt; '15 seconds'::INTERVAL);
&lt;br&gt;&lt;br&gt;If that's the behavior you want, you already have a way to do it
&lt;br&gt;(and you could wrap that up in a user-defined operator if you chose).
&lt;br&gt;It loses quite a lot of information though, so I doubt we'd want
&lt;br&gt;to enshrine it as the standard definition.
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; regards, tom lane
&lt;br&gt;&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-bugs mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26620062&amp;i=3&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-bugs@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-bugs&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-bugs&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/BUG--5227%3A-please-add-a-divide-operator-for-intervals-tp26618582p26620062.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26618705</id>
	<title>Re: BUG #5227: please add a divide operator for intervals</title>
	<published>2009-12-02T15:45:31Z</published>
	<updated>2009-12-02T15:45:31Z</updated>
	<author>
		<name>Tom Lane-2</name>
	</author>
	<content type="html">&amp;quot;Michal Pasternak&amp;quot; &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26618705&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;michal.dtz@...&lt;/a&gt;&amp;gt; writes:
&lt;br&gt;&amp;gt; Please add a divide operator for INTERVAL type, if possible.
&lt;br&gt;&lt;br&gt;Given that intervals have multiple subfields, it's far from obvious
&lt;br&gt;what division should mean. &amp;nbsp;What is '1 month' / '1 day'?
&lt;br&gt;&lt;br&gt;&amp;gt; db=# SELECT EXTRACT(EPOCH FROM '15 seconds'::INTERVAL) / EXTRACT(EPOCH FROM
&lt;br&gt;&amp;gt; '15 seconds'::INTERVAL);
&lt;br&gt;&lt;br&gt;If that's the behavior you want, you already have a way to do it
&lt;br&gt;(and you could wrap that up in a user-defined operator if you chose).
&lt;br&gt;It loses quite a lot of information though, so I doubt we'd want
&lt;br&gt;to enshrine it as the standard definition.
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; regards, tom lane
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-bugs mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26618705&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-bugs@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-bugs&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-bugs&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/BUG--5227%3A-please-add-a-divide-operator-for-intervals-tp26618582p26618705.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26618648</id>
	<title>Re: BUG #5225: create table: cast necessary for constant??</title>
	<published>2009-12-02T15:39:44Z</published>
	<updated>2009-12-02T15:39:44Z</updated>
	<author>
		<name>Tom Lane-2</name>
	</author>
	<content type="html">&amp;quot;Kevin Grittner&amp;quot; &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26618648&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Kevin.Grittner@...&lt;/a&gt;&amp;gt; writes:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; Quoting from section 5.3 of &amp;quot;WG3:HBA-003 H2-2003-305 August, 2003
&lt;br&gt;&amp;gt; (ISO-ANSI Working Draft) Foundation (SQL/Foundation)&amp;quot;:
&lt;br&gt;&amp;gt; | 13) The declared type of a &amp;lt;character string literal&amp;gt; is
&lt;br&gt;&amp;gt; | &amp;nbsp; &amp;nbsp; fixed-length character string.
&lt;br&gt;&amp;gt; Treating an otherwise unadorned set of characters between two
&lt;br&gt;&amp;gt; apostrophes as anything except a character string literal of type
&lt;br&gt;&amp;gt; CHARACTER with a length calculated per the above violates the
&lt;br&gt;&amp;gt; standard. &amp;nbsp;Rather than pretending otherwise, we should be prepared
&lt;br&gt;&amp;gt; to explain the reasons for the deviation, describe what the
&lt;br&gt;&amp;gt; PostgreSQL behavior *is*, and justify the deviation.
&lt;/div&gt;&lt;br&gt;Sorry about that --- I had confused this case with that of a bare NULL
&lt;br&gt;literal, which Postgres treats the same as an unadorned string literal
&lt;br&gt;for type determination purposes. &amp;nbsp;You're right that the spec treats
&lt;br&gt;them differently. &amp;nbsp;This is feasible for the spec's purposes because
&lt;br&gt;it has such a paucity of data types. &amp;nbsp;Also, I believe that the spec
&lt;br&gt;expects you to explicitly mark literals that aren't to be treated
&lt;br&gt;as plain strings, ie, in something like
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; TIMESTAMP '2009-12-02 18:28:58'
&lt;br&gt;you're not really supposed to omit the word TIMESTAMP.
&lt;br&gt;&lt;br&gt;Postgres has a whole lot of datatypes, including user-added ones, and
&lt;br&gt;most of them share the unadorned string literal as the base case for
&lt;br&gt;constants. &amp;nbsp;Giving preference to CHARACTER would make that machinery
&lt;br&gt;a lot less pleasant to use.
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; regards, tom lane
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-bugs mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26618648&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-bugs@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-bugs&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-bugs&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/BUG--5225%3A-create-table%3A-cast-necessary-for-constant---tp26611792p26618648.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26618582</id>
	<title>BUG #5227: please add a divide operator for intervals</title>
	<published>2009-12-02T14:31:37Z</published>
	<updated>2009-12-02T14:31:37Z</updated>
	<author>
		<name>Michal Pasternak-3</name>
	</author>
	<content type="html">&lt;br&gt;The following bug has been logged online:
&lt;br&gt;&lt;br&gt;Bug reference: &amp;nbsp; &amp;nbsp; &amp;nbsp;5227
&lt;br&gt;Logged by: &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Michal Pasternak
&lt;br&gt;Email address: &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26618582&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;michal.dtz@...&lt;/a&gt;
&lt;br&gt;PostgreSQL version: 8.4
&lt;br&gt;Operating system: &amp;nbsp; doesn't matter
&lt;br&gt;Description: &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;please add a divide operator for intervals
&lt;br&gt;Details: 
&lt;br&gt;&lt;br&gt;Please add a divide operator for INTERVAL type, if possible.
&lt;br&gt;&lt;br&gt;db=# SELECT '15 seconds'::INTERVAL / '15 seconds'::INTERVAL;
&lt;br&gt;ERROR: &amp;nbsp;operator does not exist: interval / interval
&lt;br&gt;LINE 1: SELECT '15 seconds'::INTERVAL / '15 seconds'::INTERVAL;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ^
&lt;br&gt;HINT: &amp;nbsp;No operator matches the given name and argument type(s). You might
&lt;br&gt;need to add explicit type casts.
&lt;br&gt;&lt;br&gt;&lt;br&gt;db=# SELECT EXTRACT(EPOCH FROM '15 seconds'::INTERVAL) / EXTRACT(EPOCH FROM
&lt;br&gt;'15 seconds'::INTERVAL);
&lt;br&gt;&amp;nbsp;?column?
&lt;br&gt;----------
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1
&lt;br&gt;(1 row)
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-bugs mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26618582&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-bugs@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-bugs&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-bugs&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/BUG--5227%3A-please-add-a-divide-operator-for-intervals-tp26618582p26618582.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26617599</id>
	<title>Re: Assertion failure with a subtransaction and cursor</title>
	<published>2009-12-02T13:59:50Z</published>
	<updated>2009-12-02T13:59:50Z</updated>
	<author>
		<name>Tom Lane-2</name>
	</author>
	<content type="html">Heikki Linnakangas &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26617599&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;heikki.linnakangas@...&lt;/a&gt;&amp;gt; writes:
&lt;br&gt;&amp;gt; The logical next step would be to get rid of the interXact concept
&lt;br&gt;&amp;gt; altogether and always associate temporary files with the current
&lt;br&gt;&amp;gt; resource owner; the caller should switch to a sufficiently long-lived
&lt;br&gt;&amp;gt; one before calling.
&lt;br&gt;&lt;br&gt;That would mean having a session-lifespan resource owner, which doesn't
&lt;br&gt;seem amazingly useful to me: we have no other resource types for which
&lt;br&gt;that would be even a little bit sane. &amp;nbsp;I'm inclined to leave the temp
&lt;br&gt;file API as nearly as possible as-is. &amp;nbsp;Having it attach only xact-local
&lt;br&gt;files to the CurrentResourceOwner sounds fine to me.
&lt;br&gt;&lt;br&gt;One thought here is that my inclination would be to keep
&lt;br&gt;CleanupTemporaryFiles in place and have it just look for temp files that
&lt;br&gt;didn't get closed, as a debugging aid. &amp;nbsp;This is comparable to the
&lt;br&gt;behavior of other modules that are mostly driven by resource managers.
&lt;br&gt;We didn't take out the end-of-xact checks when we added resource manager
&lt;br&gt;support elsewhere, and I'm not inclined to do that here. &amp;nbsp;I agree we
&lt;br&gt;don't need an EOSubXact-time crosscheck, though.
&lt;br&gt;&lt;br&gt;Other than that quibble it looks sane from here.
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; regards, tom lane
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-bugs mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26617599&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-bugs@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-bugs&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-bugs&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Assertion-failure-with-a-subtransaction-and-cursor-tp26464076p26617599.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26617556</id>
	<title>Re: Assertion failure with a subtransaction and cursor</title>
	<published>2009-12-02T13:46:19Z</published>
	<updated>2009-12-02T13:46:19Z</updated>
	<author>
		<name>Heikki Linnakangas-3</name>
	</author>
	<content type="html">Heikki Linnakangas wrote:
&lt;div class='shrinkable-quote'&gt;&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; Tom Lane wrote:
&lt;br&gt;&amp;gt;&amp;gt; So as far as I can tell at the moment, temp files really are the only
&lt;br&gt;&amp;gt;&amp;gt; problem, and making them be managed by resource owners instead of a
&lt;br&gt;&amp;gt;&amp;gt; subxact-based release policy should fix that. &amp;nbsp;
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; Ok, good.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt;&amp;gt; I can go work on that, unless you wanted to?
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; I started hacking on that when I posted, so I can finish it.
&lt;/div&gt;&lt;/div&gt;So, here's what I got this far, which is pretty straightforward.
&lt;br&gt;Temporary files not opened in the interXact mode are registered with
&lt;br&gt;CurrentResourceOwner, ensuring they're cleaned up at at the end of
&lt;br&gt;(sub)transaction, or when the portal is closed if it's a temporary file
&lt;br&gt;related to a cursor.
&lt;br&gt;&lt;br&gt;The logical next step would be to get rid of the interXact concept
&lt;br&gt;altogether and always associate temporary files with the current
&lt;br&gt;resource owner; the caller should switch to a sufficiently long-lived
&lt;br&gt;one before calling. But I'm hesitant to change the signature of
&lt;br&gt;OpenTemporaryFile, and tuplestore_begin_heap doesn't need the interXact
&lt;br&gt;argument anymore either. Changing the signature of tuplestore_begin_heap
&lt;br&gt;would certainly break user-defined set-returning C functions. So at
&lt;br&gt;least in back-branches, perhaps we should leave those as dummy arguments
&lt;br&gt;and elog(ERROR) if interXact is not passed in as false.
&lt;br&gt;&lt;br&gt;Google turned up one extra module that calls tuplestore_begin_heap with
&lt;br&gt;interXact set to 'true', but frankly that one looks broken to me. It
&lt;br&gt;should be using 'false':
&lt;br&gt;&lt;a href=&quot;http://cvs.pgfoundry.org/cgi-bin/cvsweb.cgi/python/be/src/call/pl.c?rev=1.20&amp;content-type=text/x-cvsweb-markup&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://cvs.pgfoundry.org/cgi-bin/cvsweb.cgi/python/be/src/call/pl.c?rev=1.20&amp;content-type=text/x-cvsweb-markup&lt;/a&gt;&lt;br&gt;&lt;br&gt;I left the cleanup of files/dirs opened with AllocateFile/Dir alone,
&lt;br&gt;although it looks a bit inconsistent now that they don't use resource
&lt;br&gt;owners as well.
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;&amp;nbsp; Heikki Linnakangas
&lt;br&gt;&amp;nbsp; EnterpriseDB &amp;nbsp; &lt;a href=&quot;http://www.enterprisedb.com&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.enterprisedb.com&lt;/a&gt;&lt;br&gt;&lt;br /&gt;Index: src/backend/storage/file/fd.c
&lt;br&gt;===================================================================
&lt;br&gt;RCS file: /cvsroot/pgsql/src/backend/storage/file/fd.c,v
&lt;br&gt;retrieving revision 1.150
&lt;br&gt;diff -c -r1.150 fd.c
&lt;br&gt;*** src/backend/storage/file/fd.c	5 Aug 2009 18:01:54 -0000	1.150
&lt;br&gt;--- src/backend/storage/file/fd.c	2 Dec 2009 21:42:01 -0000
&lt;br&gt;***************
&lt;br&gt;*** 55,60 ****
&lt;br&gt;--- 55,61 ----
&lt;br&gt;&amp;nbsp; #include &amp;quot;storage/fd.h&amp;quot;
&lt;br&gt;&amp;nbsp; #include &amp;quot;storage/ipc.h&amp;quot;
&lt;br&gt;&amp;nbsp; #include &amp;quot;utils/guc.h&amp;quot;
&lt;br&gt;+ #include &amp;quot;utils/resowner.h&amp;quot;
&lt;br&gt;&amp;nbsp; 
&lt;br&gt;&amp;nbsp; 
&lt;br&gt;&amp;nbsp; /*
&lt;br&gt;***************
&lt;br&gt;*** 122,140 ****
&lt;br&gt;&amp;nbsp; 
&lt;br&gt;&amp;nbsp; /* these are the assigned bits in fdstate below: */
&lt;br&gt;&amp;nbsp; #define FD_TEMPORARY		(1 &amp;lt;&amp;lt; 0)	/* T = delete when closed */
&lt;br&gt;- #define FD_XACT_TEMPORARY	(1 &amp;lt;&amp;lt; 1)	/* T = delete at eoXact */
&lt;br&gt;- 
&lt;br&gt;- /*
&lt;br&gt;- &amp;nbsp;* Flag to tell whether it's worth scanning VfdCache looking for temp files to
&lt;br&gt;- &amp;nbsp;* close
&lt;br&gt;- &amp;nbsp;*/
&lt;br&gt;- static bool have_xact_temporary_files = false;
&lt;br&gt;&amp;nbsp; 
&lt;br&gt;&amp;nbsp; typedef struct vfd
&lt;br&gt;&amp;nbsp; {
&lt;br&gt;&amp;nbsp; 	int			fd;				/* current FD, or VFD_CLOSED if none */
&lt;br&gt;&amp;nbsp; 	unsigned short fdstate;		/* bitflags for VFD's state */
&lt;br&gt;! 	SubTransactionId create_subid;		/* for TEMPORARY fds, creating subxact */
&lt;br&gt;&amp;nbsp; 	File		nextFree;		/* link to next free VFD, if in freelist */
&lt;br&gt;&amp;nbsp; 	File		lruMoreRecently;	/* doubly linked recency-of-use list */
&lt;br&gt;&amp;nbsp; 	File		lruLessRecently;
&lt;br&gt;--- 123,134 ----
&lt;br&gt;&amp;nbsp; 
&lt;br&gt;&amp;nbsp; /* these are the assigned bits in fdstate below: */
&lt;br&gt;&amp;nbsp; #define FD_TEMPORARY		(1 &amp;lt;&amp;lt; 0)	/* T = delete when closed */
&lt;br&gt;&amp;nbsp; 
&lt;br&gt;&amp;nbsp; typedef struct vfd
&lt;br&gt;&amp;nbsp; {
&lt;br&gt;&amp;nbsp; 	int			fd;				/* current FD, or VFD_CLOSED if none */
&lt;br&gt;&amp;nbsp; 	unsigned short fdstate;		/* bitflags for VFD's state */
&lt;br&gt;! 	ResourceOwner resowner;		/* owner, for automatic cleanup */
&lt;br&gt;&amp;nbsp; 	File		nextFree;		/* link to next free VFD, if in freelist */
&lt;br&gt;&amp;nbsp; 	File		lruMoreRecently;	/* doubly linked recency-of-use list */
&lt;br&gt;&amp;nbsp; 	File		lruLessRecently;
&lt;br&gt;***************
&lt;br&gt;*** 865,870 ****
&lt;br&gt;--- 859,865 ----
&lt;br&gt;&amp;nbsp; 	vfdP-&amp;gt;fileMode = fileMode;
&lt;br&gt;&amp;nbsp; 	vfdP-&amp;gt;seekPos = 0;
&lt;br&gt;&amp;nbsp; 	vfdP-&amp;gt;fdstate = 0x0;
&lt;br&gt;+ 	vfdP-&amp;gt;resowner = NULL;
&lt;br&gt;&amp;nbsp; 
&lt;br&gt;&amp;nbsp; 	return file;
&lt;br&gt;&amp;nbsp; }
&lt;br&gt;***************
&lt;br&gt;*** 876,883 ****
&lt;br&gt;&amp;nbsp; &amp;nbsp;* There's no need to pass in fileFlags or fileMode either, since only
&lt;br&gt;&amp;nbsp; &amp;nbsp;* one setting makes any sense for a temp file.
&lt;br&gt;&amp;nbsp; &amp;nbsp;*
&lt;br&gt;! &amp;nbsp;* interXact: if true, don't close the file at end-of-transaction. In
&lt;br&gt;! &amp;nbsp;* most cases, you don't want temporary files to outlive the transaction
&lt;br&gt;&amp;nbsp; &amp;nbsp;* that created them, so this should be false -- but if you need
&lt;br&gt;&amp;nbsp; &amp;nbsp;* &amp;quot;somewhat&amp;quot; temporary storage, this might be useful. In either case,
&lt;br&gt;&amp;nbsp; &amp;nbsp;* the file is removed when the File is explicitly closed.
&lt;br&gt;--- 871,878 ----
&lt;br&gt;&amp;nbsp; &amp;nbsp;* There's no need to pass in fileFlags or fileMode either, since only
&lt;br&gt;&amp;nbsp; &amp;nbsp;* one setting makes any sense for a temp file.
&lt;br&gt;&amp;nbsp; &amp;nbsp;*
&lt;br&gt;! &amp;nbsp;* interXact: if true, don't associate the file with CurrentResourceOwner.
&lt;br&gt;! &amp;nbsp;* In most cases, you don't want temporary files to outlive the transaction
&lt;br&gt;&amp;nbsp; &amp;nbsp;* that created them, so this should be false -- but if you need
&lt;br&gt;&amp;nbsp; &amp;nbsp;* &amp;quot;somewhat&amp;quot; temporary storage, this might be useful. In either case,
&lt;br&gt;&amp;nbsp; &amp;nbsp;* the file is removed when the File is explicitly closed.
&lt;br&gt;***************
&lt;br&gt;*** 918,931 ****
&lt;br&gt;&amp;nbsp; 	/* Mark it for deletion at close */
&lt;br&gt;&amp;nbsp; 	VfdCache[file].fdstate |= FD_TEMPORARY;
&lt;br&gt;&amp;nbsp; 
&lt;br&gt;! 	/* Mark it for deletion at EOXact */
&lt;br&gt;&amp;nbsp; 	if (!interXact)
&lt;br&gt;&amp;nbsp; 	{
&lt;br&gt;! 		VfdCache[file].fdstate |= FD_XACT_TEMPORARY;
&lt;br&gt;! 		VfdCache[file].create_subid = GetCurrentSubTransactionId();
&lt;br&gt;! 
&lt;br&gt;! 		/* ensure cleanup happens at eoxact */
&lt;br&gt;! 		have_xact_temporary_files = true;
&lt;br&gt;&amp;nbsp; 	}
&lt;br&gt;&amp;nbsp; 
&lt;br&gt;&amp;nbsp; 	return file;
&lt;br&gt;--- 913,924 ----
&lt;br&gt;&amp;nbsp; 	/* Mark it for deletion at close */
&lt;br&gt;&amp;nbsp; 	VfdCache[file].fdstate |= FD_TEMPORARY;
&lt;br&gt;&amp;nbsp; 
&lt;br&gt;! 	/* Associate it with the current resource owner */
&lt;br&gt;&amp;nbsp; 	if (!interXact)
&lt;br&gt;&amp;nbsp; 	{
&lt;br&gt;! 		ResourceOwnerEnlargeFiles(CurrentResourceOwner);
&lt;br&gt;! 		ResourceOwnerRememberFile(CurrentResourceOwner, file);
&lt;br&gt;! 		VfdCache[file].resowner = CurrentResourceOwner;
&lt;br&gt;&amp;nbsp; 	}
&lt;br&gt;&amp;nbsp; 
&lt;br&gt;&amp;nbsp; 	return file;
&lt;br&gt;***************
&lt;br&gt;*** 1051,1056 ****
&lt;br&gt;--- 1044,1052 ----
&lt;br&gt;&amp;nbsp; 			elog(LOG, &amp;quot;could not unlink file \&amp;quot;%s\&amp;quot;: %m&amp;quot;, vfdP-&amp;gt;fileName);
&lt;br&gt;&amp;nbsp; 	}
&lt;br&gt;&amp;nbsp; 
&lt;br&gt;+ 	if (vfdP-&amp;gt;resowner)
&lt;br&gt;+ 		ResourceOwnerForgetFile(vfdP-&amp;gt;resowner, file);
&lt;br&gt;+ 
&lt;br&gt;&amp;nbsp; 	/*
&lt;br&gt;&amp;nbsp; 	 * Return the Vfd slot to the free list
&lt;br&gt;&amp;nbsp; 	 */
&lt;br&gt;***************
&lt;br&gt;*** 1695,1718 ****
&lt;br&gt;&amp;nbsp; {
&lt;br&gt;&amp;nbsp; 	Index		i;
&lt;br&gt;&amp;nbsp; 
&lt;br&gt;- 	if (have_xact_temporary_files)
&lt;br&gt;- 	{
&lt;br&gt;- 		Assert(FileIsNotOpen(0));		/* Make sure ring not corrupted */
&lt;br&gt;- 		for (i = 1; i &amp;lt; SizeVfdCache; i++)
&lt;br&gt;- 		{
&lt;br&gt;- 			unsigned short fdstate = VfdCache[i].fdstate;
&lt;br&gt;- 
&lt;br&gt;- 			if ((fdstate &amp; FD_XACT_TEMPORARY) &amp;&amp;
&lt;br&gt;- 				VfdCache[i].create_subid == mySubid)
&lt;br&gt;- 			{
&lt;br&gt;- 				if (isCommit)
&lt;br&gt;- 					VfdCache[i].create_subid = parentSubid;
&lt;br&gt;- 				else if (VfdCache[i].fileName != NULL)
&lt;br&gt;- 					FileClose(i);
&lt;br&gt;- 			}
&lt;br&gt;- 		}
&lt;br&gt;- 	}
&lt;br&gt;- 
&lt;br&gt;&amp;nbsp; 	for (i = 0; i &amp;lt; numAllocatedDescs; i++)
&lt;br&gt;&amp;nbsp; 	{
&lt;br&gt;&amp;nbsp; 		if (allocatedDescs[i].create_subid == mySubid)
&lt;br&gt;--- 1691,1696 ----
&lt;br&gt;***************
&lt;br&gt;*** 1732,1746 ****
&lt;br&gt;&amp;nbsp; &amp;nbsp;* AtEOXact_Files
&lt;br&gt;&amp;nbsp; &amp;nbsp;*
&lt;br&gt;&amp;nbsp; &amp;nbsp;* This routine is called during transaction commit or abort (it doesn't
&lt;br&gt;! &amp;nbsp;* particularly care which). &amp;nbsp;All still-open per-transaction temporary file
&lt;br&gt;! &amp;nbsp;* VFDs are closed, which also causes the underlying files to be
&lt;br&gt;! &amp;nbsp;* deleted. Furthermore, all &amp;quot;allocated&amp;quot; stdio files are closed.
&lt;br&gt;&amp;nbsp; &amp;nbsp;* We also forget any transaction-local temp tablespace list.
&lt;br&gt;&amp;nbsp; &amp;nbsp;*/
&lt;br&gt;&amp;nbsp; void
&lt;br&gt;&amp;nbsp; AtEOXact_Files(void)
&lt;br&gt;&amp;nbsp; {
&lt;br&gt;! 	CleanupTempFiles(false);
&lt;br&gt;&amp;nbsp; 	tempTableSpaces = NULL;
&lt;br&gt;&amp;nbsp; 	numTempTableSpaces = -1;
&lt;br&gt;&amp;nbsp; }
&lt;br&gt;--- 1710,1725 ----
&lt;br&gt;&amp;nbsp; &amp;nbsp;* AtEOXact_Files
&lt;br&gt;&amp;nbsp; &amp;nbsp;*
&lt;br&gt;&amp;nbsp; &amp;nbsp;* This routine is called during transaction commit or abort (it doesn't
&lt;br&gt;! &amp;nbsp;* particularly care which). &amp;nbsp;All &amp;quot;allocated&amp;quot; stdio files are closed.
&lt;br&gt;&amp;nbsp; &amp;nbsp;* We also forget any transaction-local temp tablespace list.
&lt;br&gt;&amp;nbsp; &amp;nbsp;*/
&lt;br&gt;&amp;nbsp; void
&lt;br&gt;&amp;nbsp; AtEOXact_Files(void)
&lt;br&gt;&amp;nbsp; {
&lt;br&gt;! 	/* Clean up &amp;quot;allocated&amp;quot; stdio files and dirs. */
&lt;br&gt;! 	while (numAllocatedDescs &amp;gt; 0)
&lt;br&gt;! 		FreeDesc(&amp;allocatedDescs[0]);
&lt;br&gt;! 
&lt;br&gt;&amp;nbsp; 	tempTableSpaces = NULL;
&lt;br&gt;&amp;nbsp; 	numTempTableSpaces = -1;
&lt;br&gt;&amp;nbsp; }
&lt;br&gt;***************
&lt;br&gt;*** 1749,1802 ****
&lt;br&gt;&amp;nbsp; &amp;nbsp;* AtProcExit_Files
&lt;br&gt;&amp;nbsp; &amp;nbsp;*
&lt;br&gt;&amp;nbsp; &amp;nbsp;* on_proc_exit hook to clean up temp files during backend shutdown.
&lt;br&gt;! &amp;nbsp;* Here, we want to clean up *all* temp files including interXact ones.
&lt;br&gt;&amp;nbsp; &amp;nbsp;*/
&lt;br&gt;&amp;nbsp; static void
&lt;br&gt;&amp;nbsp; AtProcExit_Files(int code, Datum arg)
&lt;br&gt;&amp;nbsp; {
&lt;br&gt;! 	CleanupTempFiles(true);
&lt;br&gt;! }
&lt;br&gt;! 
&lt;br&gt;! /*
&lt;br&gt;! &amp;nbsp;* Close temporary files and delete their underlying files.
&lt;br&gt;! &amp;nbsp;*
&lt;br&gt;! &amp;nbsp;* isProcExit: if true, this is being called as the backend process is
&lt;br&gt;! &amp;nbsp;* exiting. If that's the case, we should remove all temporary files; if
&lt;br&gt;! &amp;nbsp;* that's not the case, we are being called for transaction commit/abort
&lt;br&gt;! &amp;nbsp;* and should only remove transaction-local temp files. &amp;nbsp;In either case,
&lt;br&gt;! &amp;nbsp;* also clean up &amp;quot;allocated&amp;quot; stdio files and dirs.
&lt;br&gt;! &amp;nbsp;*/
&lt;br&gt;! static void
&lt;br&gt;! CleanupTempFiles(bool isProcExit)
&lt;br&gt;! {
&lt;br&gt;! 	Index		i;
&lt;br&gt;&amp;nbsp; 
&lt;br&gt;&amp;nbsp; 	/*
&lt;br&gt;! 	 * Careful here: at proc_exit we need extra cleanup, not just
&lt;br&gt;! 	 * xact_temporary files.
&lt;br&gt;&amp;nbsp; 	 */
&lt;br&gt;! 	if (isProcExit || have_xact_temporary_files)
&lt;br&gt;&amp;nbsp; 	{
&lt;br&gt;! 		Assert(FileIsNotOpen(0));		/* Make sure ring not corrupted */
&lt;br&gt;! 		for (i = 1; i &amp;lt; SizeVfdCache; i++)
&lt;br&gt;! 		{
&lt;br&gt;! 			unsigned short fdstate = VfdCache[i].fdstate;
&lt;br&gt;! 
&lt;br&gt;! 			if ((fdstate &amp; FD_TEMPORARY) &amp;&amp; VfdCache[i].fileName != NULL)
&lt;br&gt;! 			{
&lt;br&gt;! 				/*
&lt;br&gt;! 				 * If we're in the process of exiting a backend process, close
&lt;br&gt;! 				 * all temporary files. Otherwise, only close temporary files
&lt;br&gt;! 				 * local to the current transaction.
&lt;br&gt;! 				 */
&lt;br&gt;! 				if (isProcExit || (fdstate &amp; FD_XACT_TEMPORARY))
&lt;br&gt;! 					FileClose(i);
&lt;br&gt;! 			}
&lt;br&gt;! 		}
&lt;br&gt;&amp;nbsp; 
&lt;br&gt;! 		have_xact_temporary_files = false;
&lt;br&gt;&amp;nbsp; 	}
&lt;br&gt;&amp;nbsp; 
&lt;br&gt;&amp;nbsp; 	while (numAllocatedDescs &amp;gt; 0)
&lt;br&gt;&amp;nbsp; 		FreeDesc(&amp;allocatedDescs[0]);
&lt;br&gt;&amp;nbsp; }
&lt;br&gt;--- 1728,1755 ----
&lt;br&gt;&amp;nbsp; &amp;nbsp;* AtProcExit_Files
&lt;br&gt;&amp;nbsp; &amp;nbsp;*
&lt;br&gt;&amp;nbsp; &amp;nbsp;* on_proc_exit hook to clean up temp files during backend shutdown.
&lt;br&gt;! &amp;nbsp;* Here, we want to clean up *all* temp files and &amp;quot;allocated&amp;quot; stdio files
&lt;br&gt;! &amp;nbsp;* and dirs.
&lt;br&gt;&amp;nbsp; &amp;nbsp;*/
&lt;br&gt;&amp;nbsp; static void
&lt;br&gt;&amp;nbsp; AtProcExit_Files(int code, Datum arg)
&lt;br&gt;&amp;nbsp; {
&lt;br&gt;! 	int i;
&lt;br&gt;&amp;nbsp; 
&lt;br&gt;&amp;nbsp; 	/*
&lt;br&gt;! 	 * Close all still-open temporary file VFD, which also causes the
&lt;br&gt;! 	 * underlying files to be deleted.
&lt;br&gt;&amp;nbsp; 	 */
&lt;br&gt;! 	Assert(FileIsNotOpen(0));		/* Make sure ring not corrupted */
&lt;br&gt;! 	for (i = 1; i &amp;lt; SizeVfdCache; i++)
&lt;br&gt;&amp;nbsp; 	{
&lt;br&gt;! 		unsigned short fdstate = VfdCache[i].fdstate;
&lt;br&gt;&amp;nbsp; 
&lt;br&gt;! 		if ((fdstate &amp; FD_TEMPORARY) &amp;&amp; VfdCache[i].fileName != NULL)
&lt;br&gt;! 			FileClose(i);
&lt;br&gt;&amp;nbsp; 	}
&lt;br&gt;&amp;nbsp; 
&lt;br&gt;+ 	/* Clean up &amp;quot;allocated&amp;quot; stdio files and dirs. */
&lt;br&gt;&amp;nbsp; 	while (numAllocatedDescs &amp;gt; 0)
&lt;br&gt;&amp;nbsp; 		FreeDesc(&amp;allocatedDescs[0]);
&lt;br&gt;&amp;nbsp; }
&lt;br&gt;Index: src/backend/utils/resowner/resowner.c
&lt;br&gt;===================================================================
&lt;br&gt;RCS file: /cvsroot/pgsql/src/backend/utils/resowner/resowner.c,v
&lt;br&gt;retrieving revision 1.32
&lt;br&gt;diff -c -r1.32 resowner.c
&lt;br&gt;*** src/backend/utils/resowner/resowner.c	11 Jun 2009 14:49:06 -0000	1.32
&lt;br&gt;--- src/backend/utils/resowner/resowner.c	2 Dec 2009 21:42:01 -0000
&lt;br&gt;***************
&lt;br&gt;*** 72,77 ****
&lt;br&gt;--- 72,82 ----
&lt;br&gt;&amp;nbsp; 	int			nsnapshots;		/* number of owned snapshot references */
&lt;br&gt;&amp;nbsp; 	Snapshot &amp;nbsp; *snapshots;		/* dynamically allocated array */
&lt;br&gt;&amp;nbsp; 	int			maxsnapshots;	/* currently allocated array size */
&lt;br&gt;+ 
&lt;br&gt;+ 	/* We have built-in support for remembering open temporary files */
&lt;br&gt;+ 	int			nfiles;			/* number of owned temporary files */
&lt;br&gt;+ 	File	 &amp;nbsp; *files;			/* dynamically allocated array */
&lt;br&gt;+ 	int			maxfiles;		/* currently allocated array size */
&lt;br&gt;&amp;nbsp; } ResourceOwnerData;
&lt;br&gt;&amp;nbsp; 
&lt;br&gt;&amp;nbsp; 
&lt;br&gt;***************
&lt;br&gt;*** 105,110 ****
&lt;br&gt;--- 110,116 ----
&lt;br&gt;&amp;nbsp; static void PrintPlanCacheLeakWarning(CachedPlan *plan);
&lt;br&gt;&amp;nbsp; static void PrintTupleDescLeakWarning(TupleDesc tupdesc);
&lt;br&gt;&amp;nbsp; static void PrintSnapshotLeakWarning(Snapshot snapshot);
&lt;br&gt;+ static void PrintFileLeakWarning(File file);
&lt;br&gt;&amp;nbsp; 
&lt;br&gt;&amp;nbsp; 
&lt;br&gt;&amp;nbsp; /*****************************************************************************
&lt;br&gt;***************
&lt;br&gt;*** 316,321 ****
&lt;br&gt;--- 322,335 ----
&lt;br&gt;&amp;nbsp; 			UnregisterSnapshot(owner-&amp;gt;snapshots[owner-&amp;gt;nsnapshots - 1]);
&lt;br&gt;&amp;nbsp; 		}
&lt;br&gt;&amp;nbsp; 
&lt;br&gt;+ 		/* Ditto for temporary files */
&lt;br&gt;+ 		while (owner-&amp;gt;nfiles &amp;gt; 0)
&lt;br&gt;+ 		{
&lt;br&gt;+ 			if (isCommit)
&lt;br&gt;+ 				PrintFileLeakWarning(owner-&amp;gt;files[owner-&amp;gt;nfiles - 1]);
&lt;br&gt;+ 			FileClose(owner-&amp;gt;files[owner-&amp;gt;nfiles - 1]);
&lt;br&gt;+ 		}
&lt;br&gt;+ 
&lt;br&gt;&amp;nbsp; 		/* Clean up index scans too */
&lt;br&gt;&amp;nbsp; 		ReleaseResources_hash();
&lt;br&gt;&amp;nbsp; 	}
&lt;br&gt;***************
&lt;br&gt;*** 347,352 ****
&lt;br&gt;--- 361,367 ----
&lt;br&gt;&amp;nbsp; 	Assert(owner-&amp;gt;nplanrefs == 0);
&lt;br&gt;&amp;nbsp; 	Assert(owner-&amp;gt;ntupdescs == 0);
&lt;br&gt;&amp;nbsp; 	Assert(owner-&amp;gt;nsnapshots == 0);
&lt;br&gt;+ 	Assert(owner-&amp;gt;nfiles == 0);
&lt;br&gt;&amp;nbsp; 
&lt;br&gt;&amp;nbsp; 	/*
&lt;br&gt;&amp;nbsp; 	 * Delete children. &amp;nbsp;The recursive call will delink the child from me, so
&lt;br&gt;***************
&lt;br&gt;*** 377,382 ****
&lt;br&gt;--- 392,399 ----
&lt;br&gt;&amp;nbsp; 		pfree(owner-&amp;gt;tupdescs);
&lt;br&gt;&amp;nbsp; 	if (owner-&amp;gt;snapshots)
&lt;br&gt;&amp;nbsp; 		pfree(owner-&amp;gt;snapshots);
&lt;br&gt;+ 	if (owner-&amp;gt;files)
&lt;br&gt;+ 		pfree(owner-&amp;gt;files);
&lt;br&gt;&amp;nbsp; 
&lt;br&gt;&amp;nbsp; 	pfree(owner);
&lt;br&gt;&amp;nbsp; }
&lt;br&gt;***************
&lt;br&gt;*** 1035,1037 ****
&lt;br&gt;--- 1052,1138 ----
&lt;br&gt;&amp;nbsp; 		 &amp;quot;Snapshot reference leak: Snapshot %p still referenced&amp;quot;,
&lt;br&gt;&amp;nbsp; 		 snapshot);
&lt;br&gt;&amp;nbsp; }
&lt;br&gt;+ 
&lt;br&gt;+ 
&lt;br&gt;+ /*
&lt;br&gt;+ &amp;nbsp;* Make sure there is room for at least one more entry in a ResourceOwner's
&lt;br&gt;+ &amp;nbsp;* files reference array.
&lt;br&gt;+ &amp;nbsp;*
&lt;br&gt;+ &amp;nbsp;* This is separate from actually inserting an entry because if we run out
&lt;br&gt;+ &amp;nbsp;* of memory, it's critical to do so *before* acquiring the resource.
&lt;br&gt;+ &amp;nbsp;*/
&lt;br&gt;+ void
&lt;br&gt;+ ResourceOwnerEnlargeFiles(ResourceOwner owner)
&lt;br&gt;+ {
&lt;br&gt;+ 	int			newmax;
&lt;br&gt;+ 
&lt;br&gt;+ 	if (owner-&amp;gt;nfiles &amp;lt; owner-&amp;gt;maxfiles)
&lt;br&gt;+ 		return;					/* nothing to do */
&lt;br&gt;+ 
&lt;br&gt;+ 	if (owner-&amp;gt;files == NULL)
&lt;br&gt;+ 	{
&lt;br&gt;+ 		newmax = 16;
&lt;br&gt;+ 		owner-&amp;gt;files = (File *)
&lt;br&gt;+ 			MemoryContextAlloc(TopMemoryContext, newmax * sizeof(File));
&lt;br&gt;+ 		owner-&amp;gt;maxfiles = newmax;
&lt;br&gt;+ 	}
&lt;br&gt;+ 	else
&lt;br&gt;+ 	{
&lt;br&gt;+ 		newmax = owner-&amp;gt;maxfiles * 2;
&lt;br&gt;+ 		owner-&amp;gt;files = (File *)
&lt;br&gt;+ 			repalloc(owner-&amp;gt;files, newmax * sizeof(File));
&lt;br&gt;+ 		owner-&amp;gt;maxfiles = newmax;
&lt;br&gt;+ 	}
&lt;br&gt;+ }
&lt;br&gt;+ 
&lt;br&gt;+ /*
&lt;br&gt;+ &amp;nbsp;* Remember that a temporary file is owned by a ResourceOwner
&lt;br&gt;+ &amp;nbsp;*
&lt;br&gt;+ &amp;nbsp;* Caller must have previously done ResourceOwnerEnlargeFiles()
&lt;br&gt;+ &amp;nbsp;*/
&lt;br&gt;+ void
&lt;br&gt;+ ResourceOwnerRememberFile(ResourceOwner owner, File file)
&lt;br&gt;+ {
&lt;br&gt;+ 	Assert(owner-&amp;gt;nfiles &amp;lt; owner-&amp;gt;maxfiles);
&lt;br&gt;+ 	owner-&amp;gt;files[owner-&amp;gt;nfiles] = file;
&lt;br&gt;+ 	owner-&amp;gt;nfiles++;
&lt;br&gt;+ }
&lt;br&gt;+ 
&lt;br&gt;+ /*
&lt;br&gt;+ &amp;nbsp;* Forget that a temporary file is owned by a ResourceOwner
&lt;br&gt;+ &amp;nbsp;*/
&lt;br&gt;+ void
&lt;br&gt;+ ResourceOwnerForgetFile(ResourceOwner owner, File file)
&lt;br&gt;+ {
&lt;br&gt;+ 	File	 &amp;nbsp; *files = owner-&amp;gt;files;
&lt;br&gt;+ 	int			ns1 = owner-&amp;gt;nfiles - 1;
&lt;br&gt;+ 	int			i;
&lt;br&gt;+ 
&lt;br&gt;+ 	for (i = ns1; i &amp;gt;= 0; i--)
&lt;br&gt;+ 	{
&lt;br&gt;+ 		if (files[i] == file)
&lt;br&gt;+ 		{
&lt;br&gt;+ 			while (i &amp;lt; ns1)
&lt;br&gt;+ 			{
&lt;br&gt;+ 				files[i] = files[i + 1];
&lt;br&gt;+ 				i++;
&lt;br&gt;+ 			}
&lt;br&gt;+ 			owner-&amp;gt;nfiles = ns1;
&lt;br&gt;+ 			return;
&lt;br&gt;+ 		}
&lt;br&gt;+ 	}
&lt;br&gt;+ 	elog(ERROR, &amp;quot;temporery file %d is not owned by resource owner %s&amp;quot;,
&lt;br&gt;+ 		 file, owner-&amp;gt;name);
&lt;br&gt;+ }
&lt;br&gt;+ 
&lt;br&gt;+ 
&lt;br&gt;+ /*
&lt;br&gt;+ &amp;nbsp;* Debugging subroutine
&lt;br&gt;+ &amp;nbsp;*/
&lt;br&gt;+ static void
&lt;br&gt;+ PrintFileLeakWarning(File file)
&lt;br&gt;+ {
&lt;br&gt;+ 	elog(WARNING,
&lt;br&gt;+ 		 &amp;quot;Temporary file leak: File %d still referenced&amp;quot;,
&lt;br&gt;+ 		 file);
&lt;br&gt;+ }
&lt;br&gt;Index: src/include/utils/resowner.h
&lt;br&gt;===================================================================
&lt;br&gt;RCS file: /cvsroot/pgsql/src/include/utils/resowner.h,v
&lt;br&gt;retrieving revision 1.17
&lt;br&gt;diff -c -r1.17 resowner.h
&lt;br&gt;*** src/include/utils/resowner.h	1 Jan 2009 17:24:02 -0000	1.17
&lt;br&gt;--- src/include/utils/resowner.h	2 Dec 2009 21:42:01 -0000
&lt;br&gt;***************
&lt;br&gt;*** 20,25 ****
&lt;br&gt;--- 20,26 ----
&lt;br&gt;&amp;nbsp; #define RESOWNER_H
&lt;br&gt;&amp;nbsp; 
&lt;br&gt;&amp;nbsp; #include &amp;quot;storage/buf.h&amp;quot;
&lt;br&gt;+ #include &amp;quot;storage/fd.h&amp;quot;
&lt;br&gt;&amp;nbsp; #include &amp;quot;utils/catcache.h&amp;quot;
&lt;br&gt;&amp;nbsp; #include &amp;quot;utils/plancache.h&amp;quot;
&lt;br&gt;&amp;nbsp; #include &amp;quot;utils/snapshot.h&amp;quot;
&lt;br&gt;***************
&lt;br&gt;*** 129,132 ****
&lt;br&gt;--- 130,140 ----
&lt;br&gt;&amp;nbsp; extern void ResourceOwnerForgetSnapshot(ResourceOwner owner,
&lt;br&gt;&amp;nbsp; 							Snapshot snapshot);
&lt;br&gt;&amp;nbsp; 
&lt;br&gt;+ /* support for temporary file management */
&lt;br&gt;+ extern void ResourceOwnerEnlargeFiles(ResourceOwner owner);
&lt;br&gt;+ extern void ResourceOwnerRememberFile(ResourceOwner owner,
&lt;br&gt;+ 						 &amp;nbsp;File file);
&lt;br&gt;+ extern void ResourceOwnerForgetFile(ResourceOwner owner,
&lt;br&gt;+ 						File file);
&lt;br&gt;+ 
&lt;br&gt;&amp;nbsp; #endif &amp;nbsp; /* RESOWNER_H */
&lt;br&gt;&lt;br /&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-bugs mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26617556&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-bugs@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-bugs&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-bugs&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Assertion-failure-with-a-subtransaction-and-cursor-tp26464076p26617556.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26617422</id>
	<title>Re: Assertion failure with a subtransaction and cursor</title>
	<published>2009-12-02T13:12:17Z</published>
	<updated>2009-12-02T13:12:17Z</updated>
	<author>
		<name>Tom Lane-2</name>
	</author>
	<content type="html">Heikki Linnakangas &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26617422&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;heikki.linnakangas@...&lt;/a&gt;&amp;gt; writes:
&lt;br&gt;&amp;gt; Tom Lane wrote:
&lt;br&gt;&amp;gt;&amp;gt; I can go work on that, unless you wanted to?
&lt;br&gt;&lt;br&gt;&amp;gt; I started hacking on that when I posted, so I can finish it.
&lt;br&gt;&lt;br&gt;Sounds good. &amp;nbsp;I added a bit to the ROLLBACK TO reference page to remind
&lt;br&gt;us what we think the behavior is supposed to be for cursor rollback.
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; regards, tom lane
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-bugs mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26617422&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-bugs@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-bugs&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-bugs&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Assertion-failure-with-a-subtransaction-and-cursor-tp26464076p26617422.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26616065</id>
	<title>Re: Assertion failure with a subtransaction and cursor</title>
	<published>2009-12-02T12:26:28Z</published>
	<updated>2009-12-02T12:26:28Z</updated>
	<author>
		<name>Heikki Linnakangas-3</name>
	</author>
	<content type="html">Tom Lane wrote:
&lt;br&gt;&amp;gt; So as far as I can tell at the moment, temp files really are the only
&lt;br&gt;&amp;gt; problem, and making them be managed by resource owners instead of a
&lt;br&gt;&amp;gt; subxact-based release policy should fix that. &amp;nbsp;
&lt;br&gt;&lt;br&gt;Ok, good.
&lt;br&gt;&lt;br&gt;&amp;gt; I can go work on that, unless you wanted to?
&lt;br&gt;&lt;br&gt;I started hacking on that when I posted, so I can finish it.
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;&amp;nbsp; Heikki Linnakangas
&lt;br&gt;&amp;nbsp; EnterpriseDB &amp;nbsp; &lt;a href=&quot;http://www.enterprisedb.com&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.enterprisedb.com&lt;/a&gt;&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-bugs mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26616065&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-bugs@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-bugs&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-bugs&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Assertion-failure-with-a-subtransaction-and-cursor-tp26464076p26616065.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26615961</id>
	<title>Re: Assertion failure with a subtransaction and cursor</title>
	<published>2009-12-02T12:14:37Z</published>
	<updated>2009-12-02T12:14:37Z</updated>
	<author>
		<name>Tom Lane-2</name>
	</author>
	<content type="html">I wrote:
&lt;br&gt;&amp;gt; Heikki Linnakangas &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26615961&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;heikki.linnakangas@...&lt;/a&gt;&amp;gt; writes:
&lt;br&gt;&amp;gt;&amp;gt; Hmm, I think we should track temporary files using resource owners.
&lt;br&gt;&lt;br&gt;&amp;gt; That would probably be a workable solution if temp files are the only
&lt;br&gt;&amp;gt; problem. &amp;nbsp;What I'm afraid of is that this type of problem exists
&lt;br&gt;&amp;gt; *everywhere* that we track the need for cleanup operations using the
&lt;br&gt;&amp;gt; assumption that subtransactions are nested.
&lt;br&gt;&lt;br&gt;I just spent a tedious hour digging through every function called by
&lt;br&gt;AbortSubTransaction(), and came to the conclusion that this fear may be
&lt;br&gt;overblown, so long as we are willing to stipulate that user-visible
&lt;br&gt;side effects caused by a cursor's query are to be rolled back if they
&lt;br&gt;occur during a subtransaction that is rolled back. &amp;nbsp;From the user's
&lt;br&gt;perspective this may make things a bit unpredictable, since it is not
&lt;br&gt;always clear exactly when a side effect will occur during the execution
&lt;br&gt;of a query. &amp;nbsp;However it doesn't seem like it can actually break the
&lt;br&gt;system.
&lt;br&gt;&lt;br&gt;(At least not for code in core CVS. &amp;nbsp;Outside modules might be doing
&lt;br&gt;unsafe things in RegisterSubXactCallback callbacks. &amp;nbsp;But that's not
&lt;br&gt;our responsibility to fix.)
&lt;br&gt;&lt;br&gt;It might be a good idea to forbid writeable CTEs in cursor queries,
&lt;br&gt;because that would expose the unpredictability a lot more, and maybe
&lt;br&gt;open some internal issues too -- I noted snapshot management as a likely
&lt;br&gt;problem if the executor is allowed to create its own snapshots. &amp;nbsp;But as
&lt;br&gt;far as what's in CVS is concerned that's not an issue yet anyhow. &amp;nbsp;If
&lt;br&gt;we did want to allow it, we could probably make it safe by forcing all
&lt;br&gt;the writable CTEs to run at cursor creation time.
&lt;br&gt;&lt;br&gt;So as far as I can tell at the moment, temp files really are the only
&lt;br&gt;problem, and making them be managed by resource owners instead of a
&lt;br&gt;subxact-based release policy should fix that. &amp;nbsp;I can go work on that,
&lt;br&gt;unless you wanted to?
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; regards, tom lane
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-bugs mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26615961&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-bugs@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-bugs&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-bugs&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Assertion-failure-with-a-subtransaction-and-cursor-tp26464076p26615961.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26615862</id>
	<title>Re: Assertion failure with a subtransaction and cursor</title>
	<published>2009-12-02T12:04:55Z</published>
	<updated>2009-12-02T12:04:55Z</updated>
	<author>
		<name>Alvaro Herrera-7</name>
	</author>
	<content type="html">Tom Lane wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; Heikki Linnakangas &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26615862&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;heikki.linnakangas@...&lt;/a&gt;&amp;gt; writes:
&lt;br&gt;&amp;gt; &amp;gt; Tom Lane wrote:
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt; Not sure what to do. &amp;nbsp;The only fix that seems bulletproof at the moment
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt; is to declare that any cursor that's been touched at all in a
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt; subtransaction is marked &amp;quot;broken&amp;quot; if the subtransaction rolls back.
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt; That might be too great a loss of functionality. &amp;nbsp;It would block off
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt; the controversial aspects of behavior though ...
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; &amp;gt; Hmm, I think we should track temporary files using resource owners.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; That would probably be a workable solution if temp files are the only
&lt;br&gt;&amp;gt; problem. &amp;nbsp;What I'm afraid of is that this type of problem exists
&lt;br&gt;&amp;gt; *everywhere* that we track the need for cleanup operations using the
&lt;br&gt;&amp;gt; assumption that subtransactions are nested. &amp;nbsp;If that's the case then we
&lt;br&gt;&amp;gt; are looking at a very major rewrite to make things bulletproof --- much
&lt;br&gt;&amp;gt; larger than I'd feel comfortable back-patching, especially so far back
&lt;br&gt;&amp;gt; as 8.0. &amp;nbsp;I'm thinking we might have little choice but to disable the
&lt;br&gt;&amp;gt; functionality in back branches.
&lt;/div&gt;&lt;br&gt;Hmm, the reason we didn't disable it is that people requested it
&lt;br&gt;explicitely. &amp;nbsp;In fact IIRC we had this very same discussion years ago,
&lt;br&gt;except without the crashing test case. &amp;nbsp;I fear that if it gets disabled,
&lt;br&gt;some people will be upset.
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Alvaro Herrera &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;a href=&quot;http://www.CommandPrompt.com/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.CommandPrompt.com/&lt;/a&gt;&lt;br&gt;The PostgreSQL Company - Command Prompt, Inc.
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-bugs mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26615862&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-bugs@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-bugs&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-bugs&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Assertion-failure-with-a-subtransaction-and-cursor-tp26464076p26615862.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26615376</id>
	<title>Re: Assertion failure with a subtransaction and cursor</title>
	<published>2009-12-02T10:59:08Z</published>
	<updated>2009-12-02T10:59:08Z</updated>
	<author>
		<name>Tom Lane-2</name>
	</author>
	<content type="html">Heikki Linnakangas &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26615376&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;heikki.linnakangas@...&lt;/a&gt;&amp;gt; writes:
&lt;br&gt;&amp;gt; Tom Lane wrote:
&lt;br&gt;&amp;gt;&amp;gt; Not sure what to do. &amp;nbsp;The only fix that seems bulletproof at the moment
&lt;br&gt;&amp;gt;&amp;gt; is to declare that any cursor that's been touched at all in a
&lt;br&gt;&amp;gt;&amp;gt; subtransaction is marked &amp;quot;broken&amp;quot; if the subtransaction rolls back.
&lt;br&gt;&amp;gt;&amp;gt; That might be too great a loss of functionality. &amp;nbsp;It would block off
&lt;br&gt;&amp;gt;&amp;gt; the controversial aspects of behavior though ...
&lt;br&gt;&lt;br&gt;&amp;gt; Hmm, I think we should track temporary files using resource owners.
&lt;br&gt;&lt;br&gt;That would probably be a workable solution if temp files are the only
&lt;br&gt;problem. &amp;nbsp;What I'm afraid of is that this type of problem exists
&lt;br&gt;*everywhere* that we track the need for cleanup operations using the
&lt;br&gt;assumption that subtransactions are nested. &amp;nbsp;If that's the case then we
&lt;br&gt;are looking at a very major rewrite to make things bulletproof --- much
&lt;br&gt;larger than I'd feel comfortable back-patching, especially so far back
&lt;br&gt;as 8.0. &amp;nbsp;I'm thinking we might have little choice but to disable the
&lt;br&gt;functionality in back branches.
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; regards, tom lane
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-bugs mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26615376&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-bugs@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-bugs&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-bugs&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Assertion-failure-with-a-subtransaction-and-cursor-tp26464076p26615376.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26615007</id>
	<title>Re: BUG #5225: create table: cast necessary for constant??</title>
	<published>2009-12-02T09:37:53Z</published>
	<updated>2009-12-02T09:37:53Z</updated>
	<author>
		<name>Kevin Grittner</name>
	</author>
	<content type="html">Craig Ringer &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26615007&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;craig@...&lt;/a&gt;&amp;gt; wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; On 3/12/2009 12:35 AM, Tom Lane wrote:
&lt;br&gt;&amp;gt;&amp;gt; You really ought to cast the 'I' to some specific type.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; It's usually neatest to do this by just explicitly identifying
&lt;br&gt;&amp;gt; the intended type in the first place, eg:
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; SELECT &amp;nbsp;firmnr,
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; werknr,
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; TEXT 'I' as invper,
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; invnum
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; from .... ;
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; ... which, IIRC, is the standard way to do it. I don't have a copy
&lt;br&gt;&amp;gt; to check against to be sure.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; Personally, I like the fact that Pg errs on the side of caution
&lt;br&gt;&amp;gt; here rather than guessing what you want.
&lt;/div&gt;&amp;nbsp;
&lt;br&gt;We should probably have some wiki page or something to which we can
&lt;br&gt;refer people when they raise this, which is bound to happen from
&lt;br&gt;time to time, since the PostgreSQL behavior is a deviation from the
&lt;br&gt;standard. &amp;nbsp;Now, I've been persuaded that there are good reasons for
&lt;br&gt;the deviation, and that workarounds for code previously written to
&lt;br&gt;standard are relatively straightforward, but many people here lose
&lt;br&gt;sight of the fact that it *is* a deviation when replying to someone
&lt;br&gt;who's just run into it.
&lt;br&gt;&amp;nbsp;
&lt;br&gt;Quoting from section 5.3 of &amp;quot;WG3:HBA-003 H2-2003-305 August, 2003
&lt;br&gt;(ISO-ANSI Working Draft) Foundation (SQL/Foundation)&amp;quot;:
&lt;br&gt;&amp;nbsp;
&lt;br&gt;| 13) The declared type of a &amp;lt;character string literal&amp;gt; is
&lt;br&gt;| &amp;nbsp; &amp;nbsp; fixed-length character string. The length of a &amp;lt;character
&lt;br&gt;| &amp;nbsp; &amp;nbsp; string literal&amp;gt; is the number of &amp;lt;character representation&amp;gt;s
&lt;br&gt;| &amp;nbsp; &amp;nbsp; that it contains. Each &amp;lt;quote symbol&amp;gt; contained in &amp;lt;character
&lt;br&gt;| &amp;nbsp; &amp;nbsp; string literal&amp;gt; represents a single &amp;lt;quote&amp;gt; in both the value
&lt;br&gt;| &amp;nbsp; &amp;nbsp; and the length of the &amp;lt;character string literal&amp;gt;. The two
&lt;br&gt;| &amp;nbsp; &amp;nbsp; &amp;lt;quote&amp;gt;s contained in a &amp;lt;quote symbol&amp;gt; shall not be separated
&lt;br&gt;| &amp;nbsp; &amp;nbsp; by any &amp;lt;separator&amp;gt;.
&lt;br&gt;|
&lt;br&gt;| &amp;nbsp; &amp;nbsp; NOTE 72 * &amp;lt;character string literal&amp;gt;s are allowed to be
&lt;br&gt;| &amp;nbsp; &amp;nbsp; zero-length strings (i.e., to contain no characters) even
&lt;br&gt;| &amp;nbsp; &amp;nbsp; though it is not permitted to declare a &amp;lt;data type&amp;gt; that is
&lt;br&gt;| &amp;nbsp; &amp;nbsp; CHARACTER with &amp;lt;length&amp;gt; 0 (zero).
&lt;br&gt;&amp;nbsp;
&lt;br&gt;Treating an otherwise unadorned set of characters between two
&lt;br&gt;apostrophes as anything except a character string literal of type
&lt;br&gt;CHARACTER with a length calculated per the above violates the
&lt;br&gt;standard. &amp;nbsp;Rather than pretending otherwise, we should be prepared
&lt;br&gt;to explain the reasons for the deviation, describe what the
&lt;br&gt;PostgreSQL behavior *is*, and justify the deviation.
&lt;br&gt;&amp;nbsp;
&lt;br&gt;-Kevin
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-bugs mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26615007&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-bugs@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-bugs&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-bugs&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/BUG--5225%3A-create-table%3A-cast-necessary-for-constant---tp26611792p26615007.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26612409</id>
	<title>Re: BUG #5226: Limit operator slows down</title>
	<published>2009-12-02T09:00:27Z</published>
	<updated>2009-12-02T09:00:27Z</updated>
	<author>
		<name>Robert Haas</name>
	</author>
	<content type="html">On Wed, Dec 2, 2009 at 11:42 AM, Craig Ringer
&lt;br&gt;&amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26612409&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;craig@...&lt;/a&gt;&amp;gt; wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; On 2/12/2009 10:35 PM, aftab wrote:
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; The following bug has been logged online:
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; Bug reference:      5226
&lt;br&gt;&amp;gt;&amp;gt; Logged by:          aftab
&lt;br&gt;&amp;gt;&amp;gt; Email address:      &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26612409&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;akhangd@...&lt;/a&gt;
&lt;br&gt;&amp;gt;&amp;gt; PostgreSQL version: 8.3.8
&lt;br&gt;&amp;gt;&amp;gt; Operating system:   Centos 5
&lt;br&gt;&amp;gt;&amp;gt; Description:        Limit operator slows down
&lt;br&gt;&amp;gt;&amp;gt; Details:
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; S1=&amp;quot;SELECT *
&lt;br&gt;&amp;gt;&amp;gt; FROM position WHERE
&lt;br&gt;&amp;gt;&amp;gt; position.POSITION_STATE_ID=2 AND
&lt;br&gt;&amp;gt;&amp;gt; position.TARGET_ID=18
&lt;br&gt;&amp;gt;&amp;gt; ORDER BY position.ID DESC
&lt;br&gt;&amp;gt;&amp;gt; &amp;quot;;
&lt;br&gt;&amp;gt;&amp;gt; S2=&amp;quot;SELECT *
&lt;br&gt;&amp;gt;&amp;gt; FROM position WHERE
&lt;br&gt;&amp;gt;&amp;gt; position.POSITION_STATE_ID=2 AND
&lt;br&gt;&amp;gt;&amp;gt; position.TARGET_ID=18
&lt;br&gt;&amp;gt;&amp;gt; ORDER BY position.ID DESC
&lt;br&gt;&amp;gt;&amp;gt; LIMIT 1
&lt;br&gt;&amp;gt;&amp;gt; &amp;quot;;
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; S1 takes 0.16ms compared to S2 which takes 5 secs. Both S1 and S2 are same
&lt;br&gt;&amp;gt;&amp;gt; except &amp;quot;LIMIT 1 &amp;quot; is added to S2.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Please read this:
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;  &lt;a href=&quot;http://wiki.postgresql.org/wiki/Guide_to_reporting_problems&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://wiki.postgresql.org/wiki/Guide_to_reporting_problems&lt;/a&gt;&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; then re-post your question to the pgsql-general mailing list, including
&lt;br&gt;&amp;gt; appropriate EXPLAIN ANALYZE output for both queries, etc.
&lt;/div&gt;&lt;br&gt;Or pgsql-performance.
&lt;br&gt;&lt;br&gt;...Robert
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-bugs mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26612409&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-bugs@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-bugs&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-bugs&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/BUG--5226%3A-Limit-operator-slows-down-tp26611793p26612409.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26612186</id>
	<title>Re: BUG #5225: create table: cast necessary for constant??</title>
	<published>2009-12-02T08:46:56Z</published>
	<updated>2009-12-02T08:46:56Z</updated>
	<author>
		<name>Craig Ringer</name>
	</author>
	<content type="html">On 3/12/2009 12:35 AM, Tom Lane wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; &amp;quot;Kurt wagner&amp;quot;&amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26612186&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;kurt.wagnerextern@...&lt;/a&gt;&amp;gt; &amp;nbsp;writes:
&lt;br&gt;&amp;gt;&amp;gt; During migration from Informix to Postgres I came across following issue:
&lt;br&gt;&amp;gt;&amp;gt; create temp table temp1 as
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; SELECT &amp;nbsp;firmnr,
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; werknr,
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 'I' as invper,
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; invnum
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; from .... ;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; You really ought to cast the 'I' to some specific type.
&lt;/div&gt;&lt;br&gt;It's usually neatest to do this by just explicitly identifying the 
&lt;br&gt;intended type in the first place, eg:
&lt;br&gt;&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; SELECT &amp;nbsp;firmnr,
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; werknr,
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; TEXT 'I' as invper,
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; invnum
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; from .... ;
&lt;br&gt;&lt;br&gt;... which, IIRC, is the standard way to do it. I don't have a copy to 
&lt;br&gt;check against to be sure.
&lt;br&gt;&lt;br&gt;Personally, I like the fact that Pg errs on the side of caution here 
&lt;br&gt;rather than guessing what you want.
&lt;br&gt;&lt;br&gt;--
&lt;br&gt;Craig Ringer
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-bugs mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26612186&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-bugs@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-bugs&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-bugs&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/BUG--5225%3A-create-table%3A-cast-necessary-for-constant---tp26611792p26612186.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26612100</id>
	<title>Re: BUG #5226: Limit operator slows down</title>
	<published>2009-12-02T08:42:38Z</published>
	<updated>2009-12-02T08:42:38Z</updated>
	<author>
		<name>Craig Ringer</name>
	</author>
	<content type="html">On 2/12/2009 10:35 PM, aftab wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; The following bug has been logged online:
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Bug reference: &amp;nbsp; &amp;nbsp; &amp;nbsp;5226
&lt;br&gt;&amp;gt; Logged by: &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;aftab
&lt;br&gt;&amp;gt; Email address: &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26612100&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;akhangd@...&lt;/a&gt;
&lt;br&gt;&amp;gt; PostgreSQL version: 8.3.8
&lt;br&gt;&amp;gt; Operating system: &amp;nbsp; Centos 5
&lt;br&gt;&amp;gt; Description: &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Limit operator slows down
&lt;br&gt;&amp;gt; Details:
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; S1=&amp;quot;SELECT *
&lt;br&gt;&amp;gt; FROM position WHERE
&lt;br&gt;&amp;gt; position.POSITION_STATE_ID=2 AND
&lt;br&gt;&amp;gt; position.TARGET_ID=18
&lt;br&gt;&amp;gt; ORDER BY position.ID DESC
&lt;br&gt;&amp;gt; &amp;quot;;
&lt;br&gt;&amp;gt; S2=&amp;quot;SELECT *
&lt;br&gt;&amp;gt; FROM position WHERE
&lt;br&gt;&amp;gt; position.POSITION_STATE_ID=2 AND
&lt;br&gt;&amp;gt; position.TARGET_ID=18
&lt;br&gt;&amp;gt; ORDER BY position.ID DESC
&lt;br&gt;&amp;gt; LIMIT 1
&lt;br&gt;&amp;gt; &amp;quot;;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; S1 takes 0.16ms compared to S2 which takes 5 secs. Both S1 and S2 are same
&lt;br&gt;&amp;gt; except &amp;quot;LIMIT 1 &amp;quot; is added to S2.
&lt;/div&gt;&lt;br&gt;Please read this:
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp;&lt;a href=&quot;http://wiki.postgresql.org/wiki/Guide_to_reporting_problems&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://wiki.postgresql.org/wiki/Guide_to_reporting_problems&lt;/a&gt;&lt;br&gt;&lt;br&gt;then re-post your question to the pgsql-general mailing list, including 
&lt;br&gt;appropriate EXPLAIN ANALYZE output for both queries, etc.
&lt;br&gt;&lt;br&gt;--
&lt;br&gt;Craig Ringer
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-bugs mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26612100&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-bugs@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-bugs&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-bugs&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/BUG--5226%3A-Limit-operator-slows-down-tp26611793p26612100.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26611946</id>
	<title>Re: BUG #5225: create table: cast necessary for constant??</title>
	<published>2009-12-02T08:35:01Z</published>
	<updated>2009-12-02T08:35:01Z</updated>
	<author>
		<name>Tom Lane-2</name>
	</author>
	<content type="html">&amp;quot;Kurt wagner&amp;quot; &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26611946&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;kurt.wagnerextern@...&lt;/a&gt;&amp;gt; writes:
&lt;br&gt;&amp;gt; During migration from Informix to Postgres I came across following issue:
&lt;br&gt;&amp;gt; create temp table temp1 as
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp;SELECT &amp;nbsp;firmnr,
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;werknr,
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;'I' as invper,
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;invnum
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp;from .... ;
&lt;br&gt;&lt;br&gt;You really ought to cast the 'I' to some specific type. &amp;nbsp;The above code
&lt;br&gt;is illegal per SQL standard. &amp;nbsp;You can get away with it in certain
&lt;br&gt;contexts in Postgres, but when you are creating a table or view and
&lt;br&gt;don't know exactly what might be done with the column, it's much better
&lt;br&gt;to ensure it's of the intended type. &amp;nbsp;We aren't going to make it default
&lt;br&gt;to text or whatever because it's not always clear that that's what's
&lt;br&gt;intended --- consider
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; '1.2' as invper,
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; '2009-11-23' as invper,
&lt;br&gt;&lt;br&gt;Most likely text was not what the writer had in mind in such cases.
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; regards, tom lane
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-bugs mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26611946&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-bugs@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-bugs&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-bugs&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/BUG--5225%3A-create-table%3A-cast-necessary-for-constant---tp26611792p26611946.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26611546</id>
	<title>Re: BUG #5224: After upgrading from vista to windows 7, 	postgres services are missing</title>
	<published>2009-12-02T08:12:54Z</published>
	<updated>2009-12-02T08:12:54Z</updated>
	<author>
		<name>Craig Ringer</name>
	</author>
	<content type="html">On 2/12/2009 11:57 PM, Sriram Gopalan wrote:
&lt;br&gt;&amp;gt; Please consider this issue as resolved. Reinstallation seems to have
&lt;br&gt;&amp;gt; fixed it.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; The service is running, as noted before and I am able to connect and use
&lt;br&gt;&amp;gt; the database. My syntax was wrong in the previous email.
&lt;br&gt;&lt;br&gt;Ah, OK. Please disregard my previous mail then.
&lt;br&gt;&lt;br&gt;Thanks for letting us know rather than just going quiet when the problem 
&lt;br&gt;was fixed. It's nice to know when things work out, and it helps others 
&lt;br&gt;who search for answers later.
&lt;br&gt;&lt;br&gt;--
&lt;br&gt;Craig Ringer
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-bugs mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26611546&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-bugs@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-bugs&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-bugs&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/BUG--5224%3A-After-upgrading-from-vista-to-windows-7%2C-postgres-services-are-missing-tp26604642p26611546.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26611523</id>
	<title>Re: BUG #5224: After upgrading from vista to windows 7, 	postgres services are missing</title>
	<published>2009-12-02T08:11:42Z</published>
	<updated>2009-12-02T08:11:42Z</updated>
	<author>
		<name>Craig Ringer</name>
	</author>
	<content type="html">On 2/12/2009 11:51 PM, Sriram Gopalan wrote:
&lt;br&gt;&amp;gt; 1. After I reinstalled the latest version of postgresql, I do see a
&lt;br&gt;&amp;gt; service called postgresql-8.4.
&lt;br&gt;&amp;gt; 2. It is started automatically.
&lt;br&gt;&lt;br&gt;Yes, but is it *running* ? The service manager shows the current status 
&lt;br&gt;(running or stopped) separately to the startup settings. Check if it's 
&lt;br&gt;running.
&lt;br&gt;&lt;br&gt;Also: If you look in Task Manager, are there any &amp;quot;postgres.exe&amp;quot; 
&lt;br&gt;processes shown? (You'll need to show all users' tasks, since they run 
&lt;br&gt;under a different user account to yours).
&lt;br&gt;&lt;br&gt;&amp;gt; psql: could not connect to server: Cannot assign requested address
&lt;br&gt;&amp;gt; (0x00002741/1
&lt;br&gt;&amp;gt; 0049)
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Is the server running on host &amp;quot;localhost&amp;quot; and accepting
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;TCP/IP connections on port test?
&lt;br&gt;&lt;br&gt;er ... what? &amp;quot;port test&amp;quot; ? Did you mean to specify a port number and 
&lt;br&gt;just put the wrong thing in the wrong field, or did you really intend to 
&lt;br&gt;tell psql to connect to the port &amp;quot;test&amp;quot; (via servicename-&amp;gt;port 
&lt;br&gt;translation presumably)?
&lt;br&gt;&lt;br&gt;What port is PostgreSQL listening on? Check postgresql.conf. The default 
&lt;br&gt;is 5432. Try connecting to PostgreSQL by port number.
&lt;br&gt;&lt;br&gt;As for the error message:
&lt;br&gt;&lt;br&gt;0x00002741 appears to be a name service error, which makes sense if the 
&lt;br&gt;system is trying to look up the service name to get a port number and 
&lt;br&gt;failing. Say, if it's deeply confused by being fed a non-numeric string 
&lt;br&gt;for a port number.
&lt;br&gt;&lt;br&gt;Specifically, it's:
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp;Windows Error 0x00002741 - 10049
&lt;br&gt;&amp;nbsp; &amp;nbsp;The requested address is not valid in its context.
&lt;br&gt;&amp;nbsp; &amp;nbsp;WSAEADDRNOTAVAIL
&lt;br&gt;&lt;br&gt;&amp;gt; 4. I believe ever since I upgraded, the pg_log logs have been empty.
&lt;br&gt;&amp;gt; There is nothing much interesting in the prior few logs (just info
&lt;br&gt;&amp;gt; messages about starting up and shutting down etc.)
&lt;br&gt;&lt;br&gt;Not even server startup messages? When is the most recent log entry?
&lt;br&gt;&lt;br&gt;&lt;br&gt;--
&lt;br&gt;Craig Ringer
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-bugs mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26611523&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-bugs@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-bugs&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-bugs&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/BUG--5224%3A-After-upgrading-from-vista-to-windows-7%2C-postgres-services-are-missing-tp26604642p26611523.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26611797</id>
	<title>Re: BUG #5224: After upgrading from vista to windows 7,  postgres services are missing</title>
	<published>2009-12-02T07:57:33Z</published>
	<updated>2009-12-02T07:57:33Z</updated>
	<author>
		<name>Sriram Gopalan-4</name>
	</author>
	<content type="html">Please consider this issue as resolved. Reinstallation seems to have fixed it.&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;The service is running, as noted before and I am able to connect and use the database. My syntax was wrong in the previous email.&lt;/div&gt;
&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;Thanks again.&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;Sriram&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;div class=&quot;gmail_quote&quot;&gt;On Wed, Dec 2, 2009 at 7:51 AM, Sriram Gopalan &lt;span dir=&quot;ltr&quot;&gt;&amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26611797&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;sriramgopalan@...&lt;/a&gt;&amp;gt;&lt;/span&gt; wrote:&lt;br&gt;
&lt;blockquote class=&quot;gmail_quote&quot; style=&quot;margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;&quot;&gt;1. After I reinstalled the latest version of postgresql, I do see a service called postgresql-8.4.&lt;div&gt;2. It is started automatically.&lt;/div&gt;
&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;Please note, however, that I am still not able to connect to the database. For example, trying to use psql gives me the following error:&lt;/div&gt;
&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;psql: could not connect to server: Cannot assign requested address (0x00002741/1&lt;/div&gt;&lt;div&gt;0049)&lt;/div&gt;&lt;div&gt;        Is the server running on host &amp;quot;localhost&amp;quot; and accepting&lt;/div&gt;&lt;div&gt;        TCP/IP connections on port test?&lt;/div&gt;

&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;I have never seen this error before my OS upgrade.&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;3. I looked through the Windows Event Viewer but didn&amp;#39;t anything related to postgres.&lt;/div&gt;&lt;div&gt;4. I believe ever since I upgraded, the pg_log logs have been empty. There is nothing much interesting in the prior few logs (just info messages about starting up and shutting down etc.)&lt;/div&gt;

&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;Thanks for the prompt response.&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;font color=&quot;#888888&quot;&gt;&lt;div&gt;Sriram&lt;/div&gt;&lt;/font&gt;&lt;div&gt;&lt;div&gt;&lt;/div&gt;&lt;div class=&quot;h5&quot;&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;br&gt;&lt;div class=&quot;gmail_quote&quot;&gt;On Wed, Dec 2, 2009 at 1:07 AM, Craig Ringer &lt;span dir=&quot;ltr&quot;&gt;&amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26611797&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;craig@...&lt;/a&gt;&amp;gt;&lt;/span&gt; wrote:&lt;br&gt;

&lt;blockquote class=&quot;gmail_quote&quot; style=&quot;margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex&quot;&gt;On 2/12/2009 12:57 PM, Sriram Gopalan wrote:&lt;br&gt;
&lt;blockquote class=&quot;gmail_quote&quot; style=&quot;margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex&quot;&gt;
&lt;br&gt;
The following bug has been logged online:&lt;br&gt;
&lt;br&gt;
Bug reference:      5224&lt;br&gt;
Logged by:          Sriram Gopalan&lt;br&gt;
Email address:      &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26611797&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;sriramgopalan@...&lt;/a&gt;&lt;br&gt;
PostgreSQL version: 8.4.1&lt;br&gt;
Operating system:   Windows 7&lt;br&gt;
Description:        After upgrading from vista to windows 7, postgres&lt;br&gt;
services are missing&lt;br&gt;
Details:&lt;br&gt;
&lt;br&gt;
I recently upgraded my machine from windows vista to window 7. I had&lt;br&gt;
installed postgresql 8.4.1 on that machine and it was working great.&lt;br&gt;
However, after upgrade, I cannot even see the services related to postgres.&lt;br&gt;
When I try to connect, I get the message that postgres is not running and&lt;br&gt;
listening to its port.&lt;br&gt;
&lt;/blockquote&gt;
&lt;br&gt;
In the services control panel (start -&amp;gt; run -&amp;gt;services.msc , or via Control Panel -&amp;gt; Administrative Tools) can you see the postgresql service listed?&lt;br&gt;
&lt;br&gt;
What state is it in?&lt;br&gt;
&lt;br&gt;
Is there anything in the Windows Error Log about PostgreSQL?&lt;br&gt;
&lt;br&gt;
Is there anything of interest at the end of the most recent log file in the &amp;quot;pg_log&amp;quot; subdirectory of the PostgreSQL data directory?&lt;br&gt;
&lt;br&gt;
--&lt;br&gt;&lt;font color=&quot;#888888&quot;&gt;
Craig Ringer&lt;br&gt;
&lt;/font&gt;&lt;/blockquote&gt;&lt;/div&gt;&lt;br&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;
&lt;/blockquote&gt;&lt;/div&gt;&lt;br&gt;&lt;/div&gt;
</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/BUG--5224%3A-After-upgrading-from-vista-to-windows-7%2C-postgres-services-are-missing-tp26604642p26611797.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26611795</id>
	<title>Re: BUG #5224: After upgrading from vista to windows 7,  postgres services are missing</title>
	<published>2009-12-02T07:51:46Z</published>
	<updated>2009-12-02T07:51:46Z</updated>
	<author>
		<name>Sriram Gopalan-4</name>
	</author>
	<content type="html">1. After I reinstalled the latest version of postgresql, I do see a service called postgresql-8.4.&lt;div&gt;2. It is started automatically.&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;Please note, however, that I am still not able to connect to the database. For example, trying to use psql gives me the following error:&lt;/div&gt;
&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;psql: could not connect to server: Cannot assign requested address (0x00002741/1&lt;/div&gt;&lt;div&gt;0049)&lt;/div&gt;&lt;div&gt;        Is the server running on host &amp;quot;localhost&amp;quot; and accepting&lt;/div&gt;&lt;div&gt;        TCP/IP connections on port test?&lt;/div&gt;
&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;I have never seen this error before my OS upgrade.&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;3. I looked through the Windows Event Viewer but didn&amp;#39;t anything related to postgres.&lt;/div&gt;&lt;div&gt;4. I believe ever since I upgraded, the pg_log logs have been empty. There is nothing much interesting in the prior few logs (just info messages about starting up and shutting down etc.)&lt;/div&gt;
&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;Thanks for the prompt response.&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;Sriram&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;br&gt;&lt;div class=&quot;gmail_quote&quot;&gt;On Wed, Dec 2, 2009 at 1:07 AM, Craig Ringer &lt;span dir=&quot;ltr&quot;&gt;&amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26611795&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;craig@...&lt;/a&gt;&amp;gt;&lt;/span&gt; wrote:&lt;br&gt;
&lt;blockquote class=&quot;gmail_quote&quot; style=&quot;margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;&quot;&gt;On 2/12/2009 12:57 PM, Sriram Gopalan wrote:&lt;br&gt;
&lt;blockquote class=&quot;gmail_quote&quot; style=&quot;margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex&quot;&gt;
&lt;br&gt;
The following bug has been logged online:&lt;br&gt;
&lt;br&gt;
Bug reference:      5224&lt;br&gt;
Logged by:          Sriram Gopalan&lt;br&gt;
Email address:      &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26611795&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;sriramgopalan@...&lt;/a&gt;&lt;br&gt;
PostgreSQL version: 8.4.1&lt;br&gt;
Operating system:   Windows 7&lt;br&gt;
Description:        After upgrading from vista to windows 7, postgres&lt;br&gt;
services are missing&lt;br&gt;
Details:&lt;br&gt;
&lt;br&gt;
I recently upgraded my machine from windows vista to window 7. I had&lt;br&gt;
installed postgresql 8.4.1 on that machine and it was working great.&lt;br&gt;
However, after upgrade, I cannot even see the services related to postgres.&lt;br&gt;
When I try to connect, I get the message that postgres is not running and&lt;br&gt;
listening to its port.&lt;br&gt;
&lt;/blockquote&gt;
&lt;br&gt;
In the services control panel (start -&amp;gt; run -&amp;gt;services.msc , or via Control Panel -&amp;gt; Administrative Tools) can you see the postgresql service listed?&lt;br&gt;
&lt;br&gt;
What state is it in?&lt;br&gt;
&lt;br&gt;
Is there anything in the Windows Error Log about PostgreSQL?&lt;br&gt;
&lt;br&gt;
Is there anything of interest at the end of the most recent log file in the &amp;quot;pg_log&amp;quot; subdirectory of the PostgreSQL data directory?&lt;br&gt;
&lt;br&gt;
--&lt;br&gt;&lt;font color=&quot;#888888&quot;&gt;
Craig Ringer&lt;br&gt;
&lt;/font&gt;&lt;/blockquote&gt;&lt;/div&gt;&lt;br&gt;&lt;/div&gt;&lt;/div&gt;
</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/BUG--5224%3A-After-upgrading-from-vista-to-windows-7%2C-postgres-services-are-missing-tp26604642p26611795.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26611793</id>
	<title>BUG #5226: Limit operator slows down</title>
	<published>2009-12-02T06:35:21Z</published>
	<updated>2009-12-02T06:35:21Z</updated>
	<author>
		<name>aftab-2</name>
	</author>
	<content type="html">&lt;br&gt;The following bug has been logged online:
&lt;br&gt;&lt;br&gt;Bug reference: &amp;nbsp; &amp;nbsp; &amp;nbsp;5226
&lt;br&gt;Logged by: &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;aftab
&lt;br&gt;Email address: &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26611793&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;akhangd@...&lt;/a&gt;
&lt;br&gt;PostgreSQL version: 8.3.8
&lt;br&gt;Operating system: &amp;nbsp; Centos 5
&lt;br&gt;Description: &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Limit operator slows down
&lt;br&gt;Details: 
&lt;br&gt;&lt;br&gt;S1=&amp;quot;SELECT *
&lt;br&gt;FROM position WHERE 
&lt;br&gt;position.POSITION_STATE_ID=2 AND 
&lt;br&gt;position.TARGET_ID=18
&lt;br&gt;ORDER BY position.ID DESC 
&lt;br&gt;&amp;quot;;
&lt;br&gt;S2=&amp;quot;SELECT *
&lt;br&gt;FROM position WHERE 
&lt;br&gt;position.POSITION_STATE_ID=2 AND 
&lt;br&gt;position.TARGET_ID=18
&lt;br&gt;ORDER BY position.ID DESC 
&lt;br&gt;LIMIT 1
&lt;br&gt;&amp;quot;;
&lt;br&gt;&lt;br&gt;S1 takes 0.16ms compared to S2 which takes 5 secs. Both S1 and S2 are same
&lt;br&gt;except &amp;quot;LIMIT 1 &amp;quot; is added to S2.
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-bugs mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26611793&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-bugs@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-bugs&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-bugs&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/BUG--5226%3A-Limit-operator-slows-down-tp26611793p26611793.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26611792</id>
	<title>BUG #5225: create table: cast necessary for constant??</title>
	<published>2009-12-02T04:45:15Z</published>
	<updated>2009-12-02T04:45:15Z</updated>
	<author>
		<name>Kurt wagner-2</name>
	</author>
	<content type="html">&lt;br&gt;The following bug has been logged online:
&lt;br&gt;&lt;br&gt;Bug reference: &amp;nbsp; &amp;nbsp; &amp;nbsp;5225
&lt;br&gt;Logged by: &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Kurt wagner
&lt;br&gt;Email address: &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26611792&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;kurt.wagnerextern@...&lt;/a&gt;
&lt;br&gt;PostgreSQL version: 8.41
&lt;br&gt;Operating system: &amp;nbsp; HP-UX
&lt;br&gt;Description: &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;create table: cast necessary for constant??
&lt;br&gt;Details: 
&lt;br&gt;&lt;br&gt;During migration from Informix to Postgres I came across following issue:
&lt;br&gt;create temp table temp1 as
&lt;br&gt;&amp;nbsp; &amp;nbsp;SELECT &amp;nbsp;firmnr,
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;werknr,
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;'I' as invper,
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;invnum
&lt;br&gt;&amp;nbsp; &amp;nbsp;from .... ;
&lt;br&gt;&lt;br&gt;the next select on table temp1 returned the error 
&lt;br&gt;ERROR: failed to find conversion function from unknown to character [SQL
&lt;br&gt;State=XX000] 
&lt;br&gt;&lt;br&gt;I could find out that the column invper in the temp. table temp1 was defined
&lt;br&gt;as data type &amp;quot;unknown&amp;quot;. To me it is a bug because the column is filled by a
&lt;br&gt;constant. So regardless if you estimate it as char, varchar, or text it is
&lt;br&gt;still processable whereas &amp;quot;unknown&amp;quot; is the worst case and returns an error
&lt;br&gt;as described above.
&lt;br&gt;&lt;br&gt;other DBs (e.g. db2, or Informix) can handle such cases correctly.
&lt;br&gt;&lt;br&gt;is it possible to fix it, please?
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-bugs mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26611792&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-bugs@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-bugs&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-bugs&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/BUG--5225%3A-create-table%3A-cast-necessary-for-constant---tp26611792p26611792.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26605665</id>
	<title>Re: BUG #5224: After upgrading from vista to windows 7, postgres services are missing</title>
	<published>2009-12-02T01:07:06Z</published>
	<updated>2009-12-02T01:07:06Z</updated>
	<author>
		<name>Craig Ringer</name>
	</author>
	<content type="html">On 2/12/2009 12:57 PM, Sriram Gopalan wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; The following bug has been logged online:
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Bug reference: &amp;nbsp; &amp;nbsp; &amp;nbsp;5224
&lt;br&gt;&amp;gt; Logged by: &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Sriram Gopalan
&lt;br&gt;&amp;gt; Email address: &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26605665&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;sriramgopalan@...&lt;/a&gt;
&lt;br&gt;&amp;gt; PostgreSQL version: 8.4.1
&lt;br&gt;&amp;gt; Operating system: &amp;nbsp; Windows 7
&lt;br&gt;&amp;gt; Description: &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;After upgrading from vista to windows 7, postgres
&lt;br&gt;&amp;gt; services are missing
&lt;br&gt;&amp;gt; Details:
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; I recently upgraded my machine from windows vista to window 7. I had
&lt;br&gt;&amp;gt; installed postgresql 8.4.1 on that machine and it was working great.
&lt;br&gt;&amp;gt; However, after upgrade, I cannot even see the services related to postgres.
&lt;br&gt;&amp;gt; When I try to connect, I get the message that postgres is not running and
&lt;br&gt;&amp;gt; listening to its port.
&lt;/div&gt;&lt;br&gt;In the services control panel (start -&amp;gt; run -&amp;gt;services.msc , or via 
&lt;br&gt;Control Panel -&amp;gt; Administrative Tools) can you see the postgresql 
&lt;br&gt;service listed?
&lt;br&gt;&lt;br&gt;What state is it in?
&lt;br&gt;&lt;br&gt;Is there anything in the Windows Error Log about PostgreSQL?
&lt;br&gt;&lt;br&gt;Is there anything of interest at the end of the most recent log file in 
&lt;br&gt;the &amp;quot;pg_log&amp;quot; subdirectory of the PostgreSQL data directory?
&lt;br&gt;&lt;br&gt;--
&lt;br&gt;Craig Ringer
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-bugs mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26605665&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-bugs@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-bugs&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-bugs&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/BUG--5224%3A-After-upgrading-from-vista-to-windows-7%2C-postgres-services-are-missing-tp26604642p26605665.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26605454</id>
	<title>Re: BUG #5222: failed to run initdb: 1!</title>
	<published>2009-12-02T00:51:19Z</published>
	<updated>2009-12-02T00:51:19Z</updated>
	<author>
		<name>Dave Page-7</name>
	</author>
	<content type="html">On Wed, Dec 2, 2009 at 1:12 AM, Craig Ringer
&lt;br&gt;&amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26605454&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;craig@...&lt;/a&gt;&amp;gt; wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; On 2/12/2009 2:25 AM, Nicolas urtizberea wrote:
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; The following bug has been logged online:
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; Bug reference:      5222
&lt;br&gt;&amp;gt;&amp;gt; Logged by:          Nicolas urtizberea
&lt;br&gt;&amp;gt;&amp;gt; Email address:      &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26605454&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;nurtizberea@...&lt;/a&gt;
&lt;br&gt;&amp;gt;&amp;gt; PostgreSQL version: 8.3.1-1
&lt;br&gt;&amp;gt;&amp;gt; Operating system:   Windows XP Fundamentals for Legacy Pc`s SP3
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Wow, really?
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; I'm not at all sure PostgreSQL has been tested on that. It's hard to get
&lt;br&gt;&amp;gt; hold of copies, for one thing.
&lt;/div&gt;&lt;br&gt;Yeah, I can't even get it with my MSDN premium subscription :-(. If I
&lt;br&gt;could, I'd test it....
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Dave Page
&lt;br&gt;EnterpriseDB UK: &lt;a href=&quot;http://www.enterprisedb.com&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.enterprisedb.com&lt;/a&gt;&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-bugs mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26605454&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-bugs@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-bugs&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-bugs&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/BUG--5222%3A-failed-to-run-initdb%3A-1%21-tp26597733p26605454.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26604642</id>
	<title>BUG #5224: After upgrading from vista to windows 7, postgres services are missing</title>
	<published>2009-12-01T20:57:13Z</published>
	<updated>2009-12-01T20:57:13Z</updated>
	<author>
		<name>Sriram Gopalan-4</name>
	</author>
	<content type="html">&lt;br&gt;The following bug has been logged online:
&lt;br&gt;&lt;br&gt;Bug reference: &amp;nbsp; &amp;nbsp; &amp;nbsp;5224
&lt;br&gt;Logged by: &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Sriram Gopalan
&lt;br&gt;Email address: &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26604642&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;sriramgopalan@...&lt;/a&gt;
&lt;br&gt;PostgreSQL version: 8.4.1
&lt;br&gt;Operating system: &amp;nbsp; Windows 7
&lt;br&gt;Description: &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;After upgrading from vista to windows 7, postgres
&lt;br&gt;services are missing
&lt;br&gt;Details: 
&lt;br&gt;&lt;br&gt;I recently upgraded my machine from windows vista to window 7. I had
&lt;br&gt;installed postgresql 8.4.1 on that machine and it was working great.
&lt;br&gt;However, after upgrade, I cannot even see the services related to postgres.
&lt;br&gt;When I try to connect, I get the message that postgres is not running and
&lt;br&gt;listening to its port.
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-bugs mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26604642&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-bugs@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-bugs&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-bugs&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/BUG--5224%3A-After-upgrading-from-vista-to-windows-7%2C-postgres-services-are-missing-tp26604642p26604642.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26602034</id>
	<title>Re: BUG #5222: failed to run initdb: 1!</title>
	<published>2009-12-01T17:12:48Z</published>
	<updated>2009-12-01T17:12:48Z</updated>
	<author>
		<name>Craig Ringer</name>
	</author>
	<content type="html">On 2/12/2009 2:25 AM, Nicolas urtizberea wrote:
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; The following bug has been logged online:
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Bug reference: &amp;nbsp; &amp;nbsp; &amp;nbsp;5222
&lt;br&gt;&amp;gt; Logged by: &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Nicolas urtizberea
&lt;br&gt;&amp;gt; Email address: &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26602034&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;nurtizberea@...&lt;/a&gt;
&lt;br&gt;&amp;gt; PostgreSQL version: 8.3.1-1
&lt;br&gt;&amp;gt; Operating system: &amp;nbsp; Windows XP Fundamentals for Legacy Pc`s SP3
&lt;br&gt;&lt;br&gt;Wow, really?
&lt;br&gt;&lt;br&gt;I'm not at all sure PostgreSQL has been tested on that. It's hard to get 
&lt;br&gt;hold of copies, for one thing. I don't know what Microsoft cut out for 
&lt;br&gt;XP Fundamentals, but I wouldn't be too surprised if it broke PostgreSQL 
&lt;br&gt;since Pg relies on proper, working service accounts and the like.
&lt;br&gt;&lt;br&gt;Another person reported the same issue with a version of Windows Embedded:
&lt;br&gt;&lt;br&gt;&lt;a href=&quot;http://archives.postgresql.org/pgsql-bugs/2009-03/msg00028.php&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://archives.postgresql.org/pgsql-bugs/2009-03/msg00028.php&lt;/a&gt;&lt;br&gt;&lt;br&gt;... which further suggests that it might be problems caused by a limited 
&lt;br&gt;Windows version. Try digging through these search results to see if you 
&lt;br&gt;find anything useful:
&lt;br&gt;&lt;br&gt;&lt;a href=&quot;http://www.google.com.au/search?q=%22The+system+cannot+find+the+file+specified%22+site%3Apostgresql.org&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.google.com.au/search?q=%22The+system+cannot+find+the+file+specified%22+site%3Apostgresql.org&lt;/a&gt;&lt;br&gt;&lt;br&gt;It'd be nice to know why this happens, since it might be easy to work 
&lt;br&gt;around and get Pg working on these versions of Windows. It's hard to 
&lt;br&gt;know what's going on, though.
&lt;br&gt;&lt;br&gt;It'd be helpful if you could provide a process monitor log (in native 
&lt;br&gt;process monitor format) of the installation process, since that might 
&lt;br&gt;shed some light.
&lt;br&gt;&lt;br&gt;--
&lt;br&gt;Craig Ringer
&lt;br&gt;&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-bugs mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26602034&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-bugs@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-bugs&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-bugs&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/BUG--5222%3A-failed-to-run-initdb%3A-1%21-tp26597733p26602034.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26600265</id>
	<title>Re: psql -1 -f - busted</title>
	<published>2009-12-01T14:34:40Z</published>
	<updated>2009-12-01T14:34:40Z</updated>
	<author>
		<name>Bruce Momjian-5</name>
	</author>
	<content type="html">&lt;br&gt;Applied. &amp;nbsp;Thanks for the report.
&lt;br&gt;&lt;br&gt;---------------------------------------------------------------------------
&lt;br&gt;&lt;br&gt;Bruce Momjian wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; Robert Haas wrote:
&lt;br&gt;&amp;gt; &amp;gt; On Fri, Nov 27, 2009 at 1:42 AM, Peter Eisentraut &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26600265&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;peter_e@...&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&amp;gt; &amp;gt; &amp;gt; On tor, 2009-11-26 at 22:59 -0500, Robert Haas wrote:
&lt;br&gt;&amp;gt; &amp;gt; &amp;gt;&amp;gt; ISTM that if you run psql with &amp;quot;-f -&amp;quot;, you shouldn't expect to get an
&lt;br&gt;&amp;gt; &amp;gt; &amp;gt;&amp;gt; interactive shell. ?Rather, you should expect psql to do whatever it
&lt;br&gt;&amp;gt; &amp;gt; &amp;gt;&amp;gt; normally does when given -f somefilename, except using stdin rather
&lt;br&gt;&amp;gt; &amp;gt; &amp;gt;&amp;gt; than the file. ?After all, you could have left out -f altogether if
&lt;br&gt;&amp;gt; &amp;gt; &amp;gt;&amp;gt; you'd wanted the interactive behavior. ?But then IJWH.
&lt;br&gt;&amp;gt; &amp;gt; &amp;gt;
&lt;br&gt;&amp;gt; &amp;gt; &amp;gt; But by that logic, psql &amp;lt; file should also set interactive mode.
&lt;br&gt;&amp;gt; &amp;gt; 
&lt;br&gt;&amp;gt; &amp;gt; Those two cases are not symmetrical. &amp;nbsp;If you're reading from something
&lt;br&gt;&amp;gt; &amp;gt; other than a terminal, you certainly don't want interactive mode. &amp;nbsp;If
&lt;br&gt;&amp;gt; &amp;gt; you ARE reading from a terminal, you might nevertheless want
&lt;br&gt;&amp;gt; &amp;gt; non-interactive mode. &amp;nbsp;And you CERTAINLY might want -1 when reading a
&lt;br&gt;&amp;gt; &amp;gt; pipe, as when you do this:
&lt;br&gt;&amp;gt; &amp;gt; 
&lt;br&gt;&amp;gt; &amp;gt; ssh otherhost pg_dump | psql -1 -f -
&lt;br&gt;&amp;gt; &amp;gt; 
&lt;br&gt;&amp;gt; &amp;gt; Currently, this silently fails to deliver the expected behavior.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; You are right --- there is definitely something wrong with that code. &amp;nbsp;I
&lt;br&gt;&amp;gt; tried to find out why it was coded that way but that code hasn't changed
&lt;br&gt;&amp;gt; since 2000 or 2001. &amp;nbsp;My guess is that is was OK then, but when we added
&lt;br&gt;&amp;gt; &amp;quot;-1&amp;quot; we didn't think about its placement.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; I think the proper, consistent fix is to check for &amp;quot;-&amp;quot; inside
&lt;br&gt;&amp;gt; process_file(), rather than earlier. &amp;nbsp;The attached patch accomplishes
&lt;br&gt;&amp;gt; this. &amp;nbsp;The code still goes into interactive mode, though:
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; 	$ psql -f - test
&lt;br&gt;&amp;gt; 	test=&amp;gt;
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; Should that prompt not appear? &amp;nbsp;Seems OK to me.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; -- 
&lt;br&gt;&amp;gt; &amp;nbsp; Bruce Momjian &amp;nbsp;&amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26600265&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;bruce@...&lt;/a&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;a href=&quot;http://momjian.us&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://momjian.us&lt;/a&gt;&lt;br&gt;&amp;gt; &amp;nbsp; EnterpriseDB &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;a href=&quot;http://enterprisedb.com&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://enterprisedb.com&lt;/a&gt;&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; &amp;nbsp; + If your life is a hard drive, Christ can be your backup. +
&lt;/div&gt;&lt;br&gt;[ text/x-diff is unsupported, treating like TEXT/PLAIN ]
&lt;br&gt;&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; Index: src/bin/psql/command.c
&lt;br&gt;&amp;gt; ===================================================================
&lt;br&gt;&amp;gt; RCS file: /cvsroot/pgsql/src/bin/psql/command.c,v
&lt;br&gt;&amp;gt; retrieving revision 1.211
&lt;br&gt;&amp;gt; diff -c -c -r1.211 command.c
&lt;br&gt;&amp;gt; *** src/bin/psql/command.c	22 Nov 2009 05:20:41 -0000	1.211
&lt;br&gt;&amp;gt; --- src/bin/psql/command.c	30 Nov 2009 13:47:17 -0000
&lt;br&gt;&amp;gt; ***************
&lt;br&gt;&amp;gt; *** 1691,1698 ****
&lt;br&gt;&amp;gt; &amp;nbsp; 	if (!filename)
&lt;br&gt;&amp;gt; &amp;nbsp; 		return EXIT_FAILURE;
&lt;br&gt;&amp;gt; &amp;nbsp; 
&lt;br&gt;&amp;gt; ! 	canonicalize_path(filename);
&lt;br&gt;&amp;gt; ! 	fd = fopen(filename, PG_BINARY_R);
&lt;br&gt;&amp;gt; &amp;nbsp; 
&lt;br&gt;&amp;gt; &amp;nbsp; 	if (!fd)
&lt;br&gt;&amp;gt; &amp;nbsp; 	{
&lt;br&gt;&amp;gt; --- 1691,1703 ----
&lt;br&gt;&amp;gt; &amp;nbsp; 	if (!filename)
&lt;br&gt;&amp;gt; &amp;nbsp; 		return EXIT_FAILURE;
&lt;br&gt;&amp;gt; &amp;nbsp; 
&lt;br&gt;&amp;gt; ! 	if (strcmp(filename, &amp;quot;-&amp;quot;) != 0)
&lt;br&gt;&amp;gt; ! 	{
&lt;br&gt;&amp;gt; ! 		canonicalize_path(filename);
&lt;br&gt;&amp;gt; ! 		fd = fopen(filename, PG_BINARY_R);
&lt;br&gt;&amp;gt; ! 	}
&lt;br&gt;&amp;gt; ! 	else
&lt;br&gt;&amp;gt; ! 		fd = stdin;
&lt;br&gt;&amp;gt; &amp;nbsp; 
&lt;br&gt;&amp;gt; &amp;nbsp; 	if (!fd)
&lt;br&gt;&amp;gt; &amp;nbsp; 	{
&lt;br&gt;&amp;gt; Index: src/bin/psql/startup.c
&lt;br&gt;&amp;gt; ===================================================================
&lt;br&gt;&amp;gt; RCS file: /cvsroot/pgsql/src/bin/psql/startup.c,v
&lt;br&gt;&amp;gt; retrieving revision 1.156
&lt;br&gt;&amp;gt; diff -c -c -r1.156 startup.c
&lt;br&gt;&amp;gt; *** src/bin/psql/startup.c	5 Apr 2009 04:19:58 -0000	1.156
&lt;br&gt;&amp;gt; --- src/bin/psql/startup.c	30 Nov 2009 13:47:17 -0000
&lt;br&gt;&amp;gt; ***************
&lt;br&gt;&amp;gt; *** 225,231 ****
&lt;br&gt;&amp;gt; &amp;nbsp; 	/*
&lt;br&gt;&amp;gt; &amp;nbsp; 	 * process file given by -f
&lt;br&gt;&amp;gt; &amp;nbsp; 	 */
&lt;br&gt;&amp;gt; ! 	if (options.action == ACT_FILE &amp;&amp; strcmp(options.action_string, &amp;quot;-&amp;quot;) != 0)
&lt;br&gt;&amp;gt; &amp;nbsp; 	{
&lt;br&gt;&amp;gt; &amp;nbsp; 		if (!options.no_psqlrc)
&lt;br&gt;&amp;gt; &amp;nbsp; 			process_psqlrc(argv[0]);
&lt;br&gt;&amp;gt; --- 225,231 ----
&lt;br&gt;&amp;gt; &amp;nbsp; 	/*
&lt;br&gt;&amp;gt; &amp;nbsp; 	 * process file given by -f
&lt;br&gt;&amp;gt; &amp;nbsp; 	 */
&lt;br&gt;&amp;gt; ! 	if (options.action == ACT_FILE)
&lt;br&gt;&amp;gt; &amp;nbsp; 	{
&lt;br&gt;&amp;gt; &amp;nbsp; 		if (!options.no_psqlrc)
&lt;br&gt;&amp;gt; &amp;nbsp; 			process_psqlrc(argv[0]);
&lt;/div&gt;&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; -- 
&lt;br&gt;&amp;gt; Sent via pgsql-bugs mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26600265&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-bugs@...&lt;/a&gt;)
&lt;br&gt;&amp;gt; To make changes to your subscription:
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-bugs&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-bugs&lt;/a&gt;&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;&amp;nbsp; Bruce Momjian &amp;nbsp;&amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26600265&amp;i=3&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;bruce@...&lt;/a&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;a href=&quot;http://momjian.us&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://momjian.us&lt;/a&gt;&lt;br&gt;&amp;nbsp; EnterpriseDB &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;a href=&quot;http://enterprisedb.com&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://enterprisedb.com&lt;/a&gt;&lt;br&gt;&lt;br&gt;&amp;nbsp; + If your life is a hard drive, Christ can be your backup. +
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-bugs mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26600265&amp;i=4&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-bugs@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-bugs&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-bugs&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/psql--1--f---busted-tp26016019p26600265.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26599689</id>
	<title>Re: BUG #5216: pgFouine 1.1 not working correctly, when LC_MESSAGES is &quot;es_ES.UTF-8&quot;</title>
	<published>2009-12-01T13:52:38Z</published>
	<updated>2009-12-01T13:52:38Z</updated>
	<author>
		<name>Alvaro Herrera-7</name>
	</author>
	<content type="html">Guillaume Smet escribió:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; Henrik,
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; On Fri, Nov 27, 2009 at 4:15 AM, Henrik Pestano &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26599689&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;hpestano@...&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&amp;gt; &amp;gt; I have a problem with the parameter LC_MESSAGES, where its value is
&lt;br&gt;&amp;gt; &amp;gt; es_ES.UTF-8 (Spanish), the pgFouine 1.1 not work correctly, because csvlog
&lt;br&gt;&amp;gt; &amp;gt; generates a column &amp;quot;duración: 0138 ms sentencia: SELECT format_type (oid,
&lt;br&gt;&amp;gt; &amp;gt; 54) as typname pg_type FROM WHERE oid = 1043&amp;quot; and pgFouine not understand
&lt;br&gt;&amp;gt; &amp;gt; the words &amp;quot;duración&amp;quot; and &amp;quot;sentencia&amp;quot;. This information can be in two
&lt;br&gt;&amp;gt; &amp;gt; columns.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; Please note that pgsql-bugs mailing list is for PostgreSQL bugs only.
&lt;/div&gt;&lt;br&gt;Well, it begs the question: why are those spilled out as translated
&lt;br&gt;words and not as their own columns? &amp;nbsp;It can be construed as a Postgres
&lt;br&gt;bug.
&lt;br&gt;&lt;br&gt;(As a note, I suggested Henrik to report this here for this reason).
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Alvaro Herrera &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;a href=&quot;http://www.CommandPrompt.com/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.CommandPrompt.com/&lt;/a&gt;&lt;br&gt;The PostgreSQL Company - Command Prompt, Inc.
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-bugs mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26599689&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-bugs@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-bugs&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-bugs&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/BUG--5216%3A-pgFouine-1.1-not-working-correctly%2C-when-LC_MESSAGES-is-%22es_ES.UTF-8%22-tp26537524p26599689.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26597733</id>
	<title>BUG #5222: failed to run initdb: 1!</title>
	<published>2009-12-01T10:25:06Z</published>
	<updated>2009-12-01T10:25:06Z</updated>
	<author>
		<name>nicolas urtizberea</name>
	</author>
	<content type="html">&lt;br&gt;The following bug has been logged online:
&lt;br&gt;&lt;br&gt;Bug reference: &amp;nbsp; &amp;nbsp; &amp;nbsp;5222
&lt;br&gt;Logged by: &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Nicolas urtizberea
&lt;br&gt;Email address: &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26597733&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;nurtizberea@...&lt;/a&gt;
&lt;br&gt;PostgreSQL version: 8.3.1-1
&lt;br&gt;Operating system: &amp;nbsp; Windows XP Fundamentals for Legacy Pc`s SP3
&lt;br&gt;Description: &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;failed to run initdb: 1!
&lt;br&gt;Details: 
&lt;br&gt;&lt;br&gt;The files belonging to this database system will be owned by user &amp;quot;SYSTEM&amp;quot;.
&lt;br&gt;This user must also own the server process.
&lt;br&gt;&lt;br&gt;The database cluster will be initialized with locale English_United
&lt;br&gt;States.1252.
&lt;br&gt;The default text search configuration will be set to &amp;quot;english&amp;quot;.
&lt;br&gt;&lt;br&gt;creating directory C:/Program Files/PostgreSQL/8.3/data ... ok
&lt;br&gt;creating subdirectories ... ok
&lt;br&gt;selecting default max_connections ... The system cannot find the file
&lt;br&gt;specified.
&lt;br&gt;The system cannot find the file specified.
&lt;br&gt;The system cannot find the file specified.
&lt;br&gt;The system cannot find the file specified.
&lt;br&gt;The system cannot find the file specified.
&lt;br&gt;The system cannot find the file specified.
&lt;br&gt;10
&lt;br&gt;selecting default shared_buffers/max_fsm_pages ... The system cannot find
&lt;br&gt;the file specified.
&lt;br&gt;The system cannot find the file specified.
&lt;br&gt;The system cannot find the file specified.
&lt;br&gt;The system cannot find the file specified.
&lt;br&gt;The system cannot find the file specified.
&lt;br&gt;The system cannot find the file specified.
&lt;br&gt;The system cannot find the file specified.
&lt;br&gt;The system cannot find the file specified.
&lt;br&gt;The system cannot find the file specified.
&lt;br&gt;The system cannot find the file specified.
&lt;br&gt;The system cannot find the file specified.
&lt;br&gt;The system cannot find the file specified.
&lt;br&gt;The system cannot find the file specified.
&lt;br&gt;The system cannot find the file specified.
&lt;br&gt;The system cannot find the file specified.
&lt;br&gt;The system cannot find the file specified.
&lt;br&gt;The system cannot find the file specified.
&lt;br&gt;400kB/20000
&lt;br&gt;creating configuration files ... ok
&lt;br&gt;creating template1 database in C:/Program Files/PostgreSQL/8.3/data/base/1
&lt;br&gt;... ok
&lt;br&gt;initializing pg_authid ... The system cannot find the file specified.
&lt;br&gt;child process exited with exit code 1
&lt;br&gt;initdb: removing data directory &amp;quot;C:/Program Files/PostgreSQL/8.3/data&amp;quot;
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-bugs mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26597733&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-bugs@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-bugs&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-bugs&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/BUG--5222%3A-failed-to-run-initdb%3A-1%21-tp26597733p26597733.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26596679</id>
	<title>bug</title>
	<published>2009-12-01T10:16:47Z</published>
	<updated>2009-12-01T10:16:47Z</updated>
	<author>
		<name>nicolas urtizberea</name>
	</author>
	<content type="html">The files belonging to this database system will be owned by user &amp;quot;postgres&amp;quot;.&lt;br&gt;This user must also own the server process.&lt;br&gt;&lt;br&gt;The database cluster will be initialized with locale C.&lt;br&gt;&lt;br&gt;fixing permissions on existing directory C:/Program Files/PostgreSQL/8.2/data ... ok&lt;br&gt;
creating subdirectories ... ok&lt;br&gt;selecting default max_connections ... The system cannot find the file specified.&lt;br&gt;The system cannot find the file specified.&lt;br&gt;The system cannot find the file specified.&lt;br&gt;The system cannot find the file specified.&lt;br&gt;
The system cannot find the file specified.&lt;br&gt;The system cannot find the file specified.&lt;br&gt;10&lt;br&gt;selecting default shared_buffers/max_fsm_pages ... The system cannot find the file specified.&lt;br&gt;The system cannot find the file specified.&lt;br&gt;
The system cannot find the file specified.&lt;br&gt;The system cannot find the file specified.&lt;br&gt;The system cannot find the file specified.&lt;br&gt;The system cannot find the file specified.&lt;br&gt;The system cannot find the file specified.&lt;br&gt;
The system cannot find the file specified.&lt;br&gt;The system cannot find the file specified.&lt;br&gt;The system cannot find the file specified.&lt;br&gt;The system cannot find the file specified.&lt;br&gt;The system cannot find the file specified.&lt;br&gt;
The system cannot find the file specified.&lt;br&gt;The system cannot find the file specified.&lt;br&gt;The system cannot find the file specified.&lt;br&gt;The system cannot find the file specified.&lt;br&gt;The system cannot find the file specified.&lt;br&gt;
400kB/20000&lt;br&gt;creating configuration files ... ok&lt;br&gt;creating template1 database in C:/Program Files/PostgreSQL/8.2/data/base/1 ... ok&lt;br&gt;initializing pg_authid ... The system cannot find the file specified.&lt;br&gt;child process exited with exit code 1&lt;br&gt;
initdb: removing contents of data directory &amp;quot;C:/Program Files/PostgreSQL/8.2/data&amp;quot;&lt;br&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;-------------------------------------------------------------------------------------------&lt;br&gt;&lt;/div&gt;&lt;div&gt;
&lt;br&gt;&lt;/div&gt;&lt;div&gt;The files belonging to this database system will be owned by user &amp;quot;SYSTEM&amp;quot;.&lt;br&gt;This user must also own the server process.&lt;br&gt;&lt;br&gt;The database cluster will be initialized with locale English_United States.1252.&lt;br&gt;
The default text search configuration will be set to &amp;quot;english&amp;quot;.&lt;br&gt;&lt;br&gt;creating directory C:/Program Files/PostgreSQL/8.3/data ... ok&lt;br&gt;creating subdirectories ... ok&lt;br&gt;selecting default max_connections ... The system cannot find the file specified.&lt;br&gt;
The system cannot find the file specified.&lt;br&gt;The system cannot find the file specified.&lt;br&gt;The system cannot find the file specified.&lt;br&gt;The system cannot find the file specified.&lt;br&gt;The system cannot find the file specified.&lt;br&gt;
10&lt;br&gt;selecting default shared_buffers/max_fsm_pages ... The system cannot find the file specified.&lt;br&gt;The system cannot find the file specified.&lt;br&gt;The system cannot find the file specified.&lt;br&gt;The system cannot find the file specified.&lt;br&gt;
The system cannot find the file specified.&lt;br&gt;The system cannot find the file specified.&lt;br&gt;The system cannot find the file specified.&lt;br&gt;The system cannot find the file specified.&lt;br&gt;The system cannot find the file specified.&lt;br&gt;
The system cannot find the file specified.&lt;br&gt;The system cannot find the file specified.&lt;br&gt;The system cannot find the file specified.&lt;br&gt;The system cannot find the file specified.&lt;br&gt;The system cannot find the file specified.&lt;br&gt;
The system cannot find the file specified.&lt;br&gt;The system cannot find the file specified.&lt;br&gt;The system cannot find the file specified.&lt;br&gt;400kB/20000&lt;br&gt;creating configuration files ... ok&lt;br&gt;creating template1 database in C:/Program Files/PostgreSQL/8.3/data/base/1 ... ok&lt;br&gt;
initializing pg_authid ... The system cannot find the file specified.&lt;br&gt;child process exited with exit code 1&lt;br&gt;initdb: removing data directory &amp;quot;C:/Program Files/PostgreSQL/8.3/data&amp;quot;&lt;br&gt;&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;
-----------------------------------------------------------------&lt;br clear=&quot;all&quot;&gt;&lt;/div&gt;&lt;div&gt; Windows xp fundamentals for legacy pc`s SP3&lt;/div&gt;&lt;div&gt;AMD Athlon 64 dual (5200)&lt;/div&gt;&lt;div&gt;1.75Gz RAM&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;HELP!&lt;/div&gt;
&lt;br&gt;-- &lt;br&gt;Nicolás Daniel Urtizberea&lt;br&gt;
</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/bug-tp26596679p26596679.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26593694</id>
	<title>Re: BUG #5221: errors converting string to utf8</title>
	<published>2009-12-01T07:30:12Z</published>
	<updated>2009-12-01T07:30:12Z</updated>
	<author>
		<name>Tom Lane-2</name>
	</author>
	<content type="html">Craig Ringer &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26593694&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;craig@...&lt;/a&gt;&amp;gt; writes:
&lt;br&gt;&amp;gt; On 1/12/2009 7:36 PM, DM wrote:
&lt;br&gt;&amp;gt;&amp;gt; select convert('Vall\xe9e','LATIN1','UTF8');
&lt;br&gt;&lt;br&gt;&amp;gt; You expect the result 'VallÃ©e', right? As in the utf-8 bytes
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp;Vall\xc3\xa9e
&lt;br&gt;&amp;gt; ?
&lt;br&gt;&lt;br&gt;The whole thing seems like an exercise in unnecessary pain anyway.
&lt;br&gt;Why not just set client_encoding to LATIN1 and send your strings
&lt;br&gt;as-is, letting the server deal with the encoding conversion
&lt;br&gt;automatically?
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; regards, tom lane
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-bugs mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26593694&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-bugs@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-bugs&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-bugs&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/BUG--5221%3A-errors-converting-string-to-utf8-tp26590427p26593694.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26591375</id>
	<title>Re: BUG #5221: errors converting string to utf8</title>
	<published>2009-12-01T05:03:23Z</published>
	<updated>2009-12-01T05:03:23Z</updated>
	<author>
		<name>Craig Ringer</name>
	</author>
	<content type="html">On 1/12/2009 7:36 PM, DM wrote:
&lt;br&gt;&lt;br&gt;&amp;gt; select convert('Vall\xe9e','LATIN1','UTF8');
&lt;br&gt;&lt;br&gt;You expect the result 'Vallée', right? As in the utf-8 bytes
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp;Vall\xc3\xa9e
&lt;br&gt;&lt;br&gt;?
&lt;br&gt;&lt;br&gt;&amp;gt; ERROR: &amp;nbsp;invalid byte sequence for encoding &amp;quot;UTF8&amp;quot;: 0xe965
&lt;br&gt;&amp;gt; HINT: This error can also happen if the byte sequence does not match the
&lt;br&gt;&amp;gt; encoding expected by the server, which is controlled by &amp;quot;client_encoding&amp;quot;.
&lt;br&gt;&lt;br&gt;The HINT tells you what's going on here.
&lt;br&gt;&lt;br&gt;The error isn't being raised by convert(...). You'll get the same error 
&lt;br&gt;if you just:
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;select 'Vall\xe9e';
&lt;br&gt;&lt;br&gt;... because the problem is that the server is trying to treat that 
&lt;br&gt;literal as a string in your client_encoding, which is UTF-8, and convert 
&lt;br&gt;it to the server encoding.
&lt;br&gt;&lt;br&gt;You will note that the convert(...) function takes a 'bytea' argument 
&lt;br&gt;rather than 'text'. That's because PostgreSQL string literals are 
&lt;br&gt;expected to be valid text in the current encoding. Entering a string 
&lt;br&gt;literal with a byte sequence invalid in the current encoding will be 
&lt;br&gt;problematic. You need to supply a valid bytea value, which involves 
&lt;br&gt;juggling some interesting double-escaping and using octal escapes for 
&lt;br&gt;characters.
&lt;br&gt;&lt;br&gt;The octal escape for the byte 0xe9 is \351, so to correctly submit your 
&lt;br&gt;query to PostgreSQL you'd need to send:
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp;select convert(E'Vall\\351e','LATIN1','UTF8');
&lt;br&gt;&lt;br&gt;or if you really just want to convert to the server encoding:
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp;select convert_from(E'Vall\\351e','LATIN-1');
&lt;br&gt;&lt;br&gt;Here, E'' is used for the string to tell PostgreSQL to interpret 
&lt;br&gt;escapes, and \\351 is used as the octal escape for 0xe9. We double the 
&lt;br&gt;backslashes because the first backslash gets used up parsing the 
&lt;br&gt;literal, and we want the bytea value to actually be 'Val\351e' after 
&lt;br&gt;string literal parsing.
&lt;br&gt;&lt;br&gt;Instead, if standard_conforming_strings is on, you can omit the E'' and 
&lt;br&gt;use single backslashes.
&lt;br&gt;&lt;br&gt;Note that in 8.5 and above you could use E'Val\\xe9e' instead of the 
&lt;br&gt;octal form, as 8.5 understands hex escapes in bytea values.
&lt;br&gt;&lt;br&gt;I guess bytea is kind of ugly to use in a text-based protocol :-( 
&lt;br&gt;because the query string has to be valid text in the client_encoding, so 
&lt;br&gt;bytea values containing data not valid in the client encoding must be 
&lt;br&gt;escaped in the parsed query string. There's nothing much to be done 
&lt;br&gt;about it, though.
&lt;br&gt;&lt;br&gt;--
&lt;br&gt;Craig Ringer
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-bugs mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26591375&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-bugs@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-bugs&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-bugs&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/BUG--5221%3A-errors-converting-string-to-utf8-tp26590427p26591375.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26590427</id>
	<title>BUG #5221: errors converting string to utf8</title>
	<published>2009-12-01T03:36:08Z</published>
	<updated>2009-12-01T03:36:08Z</updated>
	<author>
		<name>DM-13</name>
	</author>
	<content type="html">&lt;br&gt;The following bug has been logged online:
&lt;br&gt;&lt;br&gt;Bug reference: &amp;nbsp; &amp;nbsp; &amp;nbsp;5221
&lt;br&gt;Logged by: &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;DM
&lt;br&gt;Email address: &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26590427&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;dmedri@...&lt;/a&gt;
&lt;br&gt;PostgreSQL version: 8.2 / 8.4
&lt;br&gt;Operating system: &amp;nbsp; linux ubuntu 9.10
&lt;br&gt;Description: &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;errors converting string to utf8
&lt;br&gt;Details: 
&lt;br&gt;&lt;br&gt;I'm using 2 version of pg (8.2, 8.4).
&lt;br&gt;&lt;br&gt;On 8.2:
&lt;br&gt;&lt;br&gt;select convert('Vall\xe9e','LATIN1','UTF8');
&lt;br&gt;&lt;br&gt;convert this string without any kind of error.
&lt;br&gt;&lt;br&gt;&lt;br&gt;On 8.4:
&lt;br&gt;&lt;br&gt;select convert('Vall\xe9e','LATIN1','UTF8');
&lt;br&gt;&lt;br&gt;i receive these messages:
&lt;br&gt;&lt;br&gt;WARNING: &amp;nbsp;nonstandard use of escape in a string literal
&lt;br&gt;RIGA 1: select convert('Vall\xe9e','LATIN1','UTF8');
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;^
&lt;br&gt;HINT: Use the escape string syntax for escapes, e.g., E'\r\n'.
&lt;br&gt;ERROR: &amp;nbsp;invalid byte sequence for encoding &amp;quot;UTF8&amp;quot;: 0xe965
&lt;br&gt;HINT: This error can also happen if the byte sequence does not match the
&lt;br&gt;encoding expected by the server, which is controlled by &amp;quot;client_encoding&amp;quot;.
&lt;br&gt;&lt;br&gt;&lt;br&gt;client charset: utf8
&lt;br&gt;server charset: utf8
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-bugs mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26590427&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-bugs@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-bugs&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-bugs&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/BUG--5221%3A-errors-converting-string-to-utf8-tp26590427p26590427.html" />
</entry>

</feed>
