users/gsingh/postgres.git
14 years agoAdd pg_user_mappings to the table of system views. REL8_4_STABLE
Robert Haas [Thu, 14 Oct 2010 23:12:24 +0000 (19:12 -0400)]
Add pg_user_mappings to the table of system views.

14 years agoComplete the documentation of the USAGE privilege for foreign servers
Peter Eisentraut [Thu, 14 Oct 2010 17:36:42 +0000 (20:36 +0300)]
Complete the documentation of the USAGE privilege for foreign servers

The GRANT reference page failed to mention that the USAGE privilege
allows modifying associated user mappings, although this was already
documented on the CREATE/ALTER/DROP USER MAPPING pages.

14 years agoApplied patch by Itagaki Takahiro to fix incorrect status calculation in
Michael Meskes [Thu, 14 Oct 2010 15:51:53 +0000 (17:51 +0200)]
Applied patch by Itagaki Takahiro to fix incorrect status calculation in
ecpglib. Instead of parsing the statement just as ask the database server.

14 years agoFix assorted bugs in GIN's WAL replay logic.
Tom Lane [Mon, 11 Oct 2010 23:04:53 +0000 (19:04 -0400)]
Fix assorted bugs in GIN's WAL replay logic.

The original coding was quite sloppy about handling the case where
XLogReadBuffer fails (because the page has since been deleted).  This
would result in either "bad buffer id: 0" or an Assert failure during
replay, if indeed the page were no longer there.  In a couple of places
it also neglected to check whether the change had already been applied,
which would probably result in corrupted index contents.  I believe that
bug #5703 is an instance of the first problem.  These issues could show up
without replication, but only if you were unfortunate enough to crash
between modification of a GIN index and the next checkpoint.

Back-patch to 8.2, which is as far back as GIN has WAL support.

14 years agoWarn that views can be safely used to hide columns, but not rows.
Robert Haas [Fri, 8 Oct 2010 13:15:17 +0000 (09:15 -0400)]
Warn that views can be safely used to hide columns, but not rows.

14 years agoImprove WAL reliability documentation, and add more cross-references to it.
Robert Haas [Thu, 7 Oct 2010 16:19:03 +0000 (12:19 -0400)]
Improve WAL reliability documentation, and add more cross-references to it.

In particular, we are now more explicit about the fact that you may need
wal_sync_method=fsync_writethrough for crash-safety on some platforms,
including MaxOS X.  There's also now an explicit caution against assuming
that the default setting of wal_sync_method is either crash-safe or best
for performance.

14 years agoBehave correctly if INSERT ... VALUES is decorated with additional clauses.
Tom Lane [Sun, 3 Oct 2010 00:02:41 +0000 (20:02 -0400)]
Behave correctly if INSERT ... VALUES is decorated with additional clauses.

In versions 8.2 and up, the grammar allows attaching ORDER BY, LIMIT,
FOR UPDATE, or WITH to VALUES, and hence to INSERT ... VALUES.  But the
special-case code for VALUES in transformInsertStmt() wasn't expecting any
of those, and just ignored them, leading to unexpected results.  Rather
than complicate the special-case path, just ensure that the presence of any
of those clauses makes us treat the query as if it had a general SELECT.
Per report from Hitoshi Harada.

14 years agoRemove excess argument to open(2).
Tom Lane [Sat, 2 Oct 2010 22:40:28 +0000 (18:40 -0400)]
Remove excess argument to open(2).

Many compilers don't complain about this, but some do, and it's certainly
wrong.  Back-patch to 8.4 where the error was introduced.

Mark Kirkwood

14 years agoTag 8.4.5 REL8_4_5
Marc G. Fournier [Fri, 1 Oct 2010 13:35:31 +0000 (10:35 -0300)]
Tag 8.4.5

14 years agoUse a separate interpreter for each calling SQL userid in plperl and pltcl.
Tom Lane [Thu, 30 Sep 2010 21:20:25 +0000 (17:20 -0400)]
Use a separate interpreter for each calling SQL userid in plperl and pltcl.

There are numerous methods by which a Perl or Tcl function can subvert
the behavior of another such function executed later; for example, by
redefining standard functions or operators called by the target function.
If the target function is SECURITY DEFINER, or is called by such a
function, this means that any ordinary SQL user with Perl or Tcl language
usage rights can do essentially anything with the privileges of the target
function's owner.

To close this security hole, create a separate Perl or Tcl interpreter for
each SQL userid under which plperl or pltcl functions are executed within
a session.  However, all plperlu or pltclu functions run within a session
still share a single interpreter, since they all execute at the trust
level of a database superuser anyway.

Note: this change results in a functionality loss when libperl has been
built without the "multiplicity" option: it's no longer possible to call
plperl functions under different userids in one session, since such a
libperl can't support multiple interpreters in one process.  However, such
a libperl already failed to support concurrent use of plperl and plperlu,
so it's likely that few people use such versions with Postgres.

Security: CVE-2010-3433

14 years agoTranslation updates for 8.4.5
Peter Eisentraut [Thu, 30 Sep 2010 20:31:19 +0000 (23:31 +0300)]
Translation updates for 8.4.5

14 years agoUpdate release notes for releases 9.0.1, 8.4.5, 8.3.12, 8.2.18, 8.1.22,
Tom Lane [Thu, 30 Sep 2010 18:27:36 +0000 (14:27 -0400)]
Update release notes for releases 9.0.1, 8.4.5, 8.3.12, 8.2.18, 8.1.22,
8.0.26, and 7.4.30.

14 years agoFix another small oversight in command_no_begin patch.
Tom Lane [Tue, 28 Sep 2010 18:47:25 +0000 (14:47 -0400)]
Fix another small oversight in command_no_begin patch.

Need a "return false" to prevent tests from continuing after we've moved
the "query" pointer.  As it stood, it'd accept "DROP DISCARD ALL" as a
match.

14 years agoFix PlaceHolderVar mechanism's interaction with outer joins.
Tom Lane [Tue, 28 Sep 2010 18:15:42 +0000 (14:15 -0400)]
Fix PlaceHolderVar mechanism's interaction with outer joins.

The point of a PlaceHolderVar is to allow a non-strict expression to be
evaluated below an outer join, after which its value bubbles up like a Var
and can be forced to NULL when the outer join's semantics require that.
However, there was a serious design oversight in that, namely that we
didn't ensure that there was actually a correct place in the plan tree
to evaluate the placeholder :-(.  It may be necessary to delay evaluation
of an outer join to ensure that a placeholder that should be evaluated
below the join can be evaluated there.  Per recent bug report from Kirill
Simonov.

Back-patch to 8.4 where the PlaceHolderVar mechanism was introduced.

14 years agoOnly DISCARD ALL should be in the command_no_begin list.
Itagaki Takahiro [Tue, 28 Sep 2010 06:57:19 +0000 (15:57 +0900)]
Only DISCARD ALL should be in the command_no_begin list.
We allowes DISCARD PLANS and TEMP in a transaction.

14 years agoAdd DISCARD to the command_no_begin list for AUTOCOMMIT=off.
Itagaki Takahiro [Tue, 28 Sep 2010 05:26:03 +0000 (14:26 +0900)]
Add DISCARD to the command_no_begin list for AUTOCOMMIT=off.
Backpatch to 8.3.

Reported by Sergey Burladyan.

14 years agoFurther fixes to the pg_get_expr() security fix in back branches.
Tom Lane [Sat, 25 Sep 2010 19:57:05 +0000 (15:57 -0400)]
Further fixes to the pg_get_expr() security fix in back branches.

It now emerges that the JDBC driver expects to be able to use pg_get_expr()
on an output of a sub-SELECT.  So extend the check logic to be able to recurse
into a sub-SELECT to see if the argument is ultimately coming from an
appropriate column.  Per report from Thomas Kellerer.

14 years agoStill more .gitignore cleanup.
Tom Lane [Fri, 24 Sep 2010 17:48:26 +0000 (13:48 -0400)]
Still more .gitignore cleanup.

Fix overly-enthusiastic ignores, as identified by
git ls-files -i --exclude-standard

14 years agoAdd contrib/xml2/pgxml.sql to .gitignore
Robert Haas [Fri, 24 Sep 2010 02:00:26 +0000 (22:00 -0400)]
Add contrib/xml2/pgxml.sql to .gitignore

Kevin Grittner

14 years agoPrevent show_session_authorization from crashing when session_authorization
Tom Lane [Thu, 23 Sep 2010 20:53:28 +0000 (16:53 -0400)]
Prevent show_session_authorization from crashing when session_authorization
hasn't been set.

The only known case where this can happen is when show_session_authorization
is invoked in an autovacuum process, which is possible if an index function
calls it, as for example in bug #5669 from Andrew Geery.  We could perhaps
try to return a sensible value, such as the name of the cluster-owning
superuser; but that seems like much more trouble than the case is worth,
and in any case it could create new possible failure modes.  Simply
returning an empty string seems like the most appropriate fix.

Back-patch to all supported versions, even those before autovacuum, just
in case there's another way to provoke this crash.

14 years agoAvoid sharing subpath list structure when flattening nested AppendRels.
Tom Lane [Thu, 23 Sep 2010 23:34:56 +0000 (19:34 -0400)]
Avoid sharing subpath list structure when flattening nested AppendRels.

In some situations the original coding led to corrupting the child AppendRel's
subpaths list, effectively adding other members of the parent's list to it.
This was usually masked because we never made any further use of the child's
list, but given the right combination of circumstances, we could do so.  The
visible symptom would be a relation getting scanned twice, as in bug #5673
from David Schmitt.

Backpatch to 8.2, which is as far back as the risky coding appears.  The
example submitted by David only fails in 8.4 and later, but I'm not convinced
that there aren't any even-more-obscure cases where 8.2 and 8.3 would fail.

14 years agoInitialize tableoid field correctly when dumping foreign data wrappers and
Heikki Linnakangas [Thu, 23 Sep 2010 11:49:00 +0000 (14:49 +0300)]
Initialize tableoid field correctly when dumping foreign data wrappers and
servers. AFAICT it's harmless at the moment because nothing can depend on
either, but as soon as we introduce an object type with such dependencies,
tableoid needs to be set or pg_dump will fail to interpret the dependencies
correctly. In theory, I guess the uninitialized garbage in tableoid could
cause the object to be mistaken for some other object with same OID as well.

14 years agoRe-allow input of Julian dates prior to 0001-01-01 AD.
Tom Lane [Thu, 23 Sep 2010 03:48:20 +0000 (23:48 -0400)]
Re-allow input of Julian dates prior to 0001-01-01 AD.

This was unintentionally broken in 8.4 while tightening up checking of
ordinary non-Julian date inputs to forbid references to "year zero".
Per bug #5672 from Benjamin Gigot.

14 years agoMore fixes for libpq's .gitignore file.
Tom Lane [Thu, 23 Sep 2010 02:32:30 +0000 (22:32 -0400)]
More fixes for libpq's .gitignore file.

The previous patches failed to cover a lot of symlinks that are only
added in platform-specific cases.  Make the lists match what's in the
Makefile for each branch.

14 years agoDo some copy-editing on the Git usage docs.
Tom Lane [Thu, 23 Sep 2010 00:22:42 +0000 (20:22 -0400)]
Do some copy-editing on the Git usage docs.

14 years agoFix documentation gitignore for pre-9.0 doc build methods.
Tom Lane [Wed, 22 Sep 2010 22:26:13 +0000 (18:26 -0400)]
Fix documentation gitignore for pre-9.0 doc build methods.

14 years agoSome more gitignore cleanups: cover contrib and PL regression test outputs.
Tom Lane [Wed, 22 Sep 2010 21:22:06 +0000 (17:22 -0400)]
Some more gitignore cleanups: cover contrib and PL regression test outputs.

Also do some further work in the back branches, where quite a bit wasn't
covered by Magnus' original back-patch.

14 years agoAdd gitignore files for ecpg regression tests.
Magnus Hagander [Wed, 22 Sep 2010 19:49:09 +0000 (21:49 +0200)]
Add gitignore files for ecpg regression tests.

Backpatch to 8.2 as that's how far the structure looks the same.

14 years agoRemove anonymous cvs instructions, and replace them with instructions
Magnus Hagander [Wed, 22 Sep 2010 18:10:32 +0000 (20:10 +0200)]
Remove anonymous cvs instructions, and replace them with instructions
for git. Change other references from cvs to git as well.

14 years agoConvert cvsignore to gitignore, and add .gitignore for build targets.
Magnus Hagander [Wed, 22 Sep 2010 10:57:08 +0000 (12:57 +0200)]
Convert cvsignore to gitignore, and add .gitignore for build targets.

14 years agoBack-patch replacement of README.CVS with README.git.
Tom Lane [Tue, 21 Sep 2010 18:43:06 +0000 (14:43 -0400)]
Back-patch replacement of README.CVS with README.git.

In older branches, also git-ify the "make distdir" rule.

14 years agoTreat exit code 128 (ERROR_WAIT_NO_CHILDREN) as non-fatal on Win32,
Magnus Hagander [Thu, 16 Sep 2010 20:37:16 +0000 (20:37 +0000)]
Treat exit code 128 (ERROR_WAIT_NO_CHILDREN) as non-fatal on Win32,
since it can happen when a process fails to start when the system
is under high load.

Per several bug reports and many peoples investigation.

Back-patch to 8.4, which is as far back as the "deadman-switch"
for shared memory access exists.

14 years agoFix up flushing of composite-type typcache entries to be driven directly by
Tom Lane [Thu, 2 Sep 2010 03:16:59 +0000 (03:16 +0000)]
Fix up flushing of composite-type typcache entries to be driven directly by
SI invalidation events, rather than indirectly through the relcache.

In the previous coding, we had to flush a composite-type typcache entry
whenever we discarded the corresponding relcache entry.  This caused problems
at least when testing with RELCACHE_FORCE_RELEASE, as shown in recent report
from Jeff Davis, and might result in real-world problems given the kind of
unexpected relcache flush that that test mechanism is intended to model.

The new coding decouples relcache and typcache management, which is a good
thing anyway from a structural perspective.  The cost is that we have to
search the typcache linearly to find entries that need to be flushed.  There
are a couple of ways we could avoid that, but at the moment it's not clear
it's worth any extra trouble, because the typcache contains very few entries
in typical operation.

Back-patch to 8.2, the same as some other recent fixes in this general area.
The patch could be carried back to 8.0 with some additional work, but given
that it's only hypothetical whether we're fixing any problem observable in
the field, it doesn't seem worth the work now.

14 years agoReduce PANIC to ERROR in some occasionally-reported btree failure cases.
Tom Lane [Sun, 29 Aug 2010 19:33:29 +0000 (19:33 +0000)]
Reduce PANIC to ERROR in some occasionally-reported btree failure cases.

This patch changes _bt_split() and _bt_pagedel() to throw a plain ERROR,
rather than PANIC, for several cases that are reported from the field
from time to time:
* right sibling's left-link doesn't match;
* PageAddItem failure during _bt_split();
* parent page's next child isn't right sibling during _bt_pagedel().
In addition the error messages for these cases have been made a bit
more verbose, with additional values included.

The original motivation for PANIC here was to capture core dumps for
subsequent analysis.  But with so many users whose platforms don't capture
core dumps by default, or who are unprepared to analyze them anyway, it's hard
to justify a forced database restart when we can fairly easily detect the
problems before we've reached the critical sections where PANIC would be
necessary.  It is not currently known whether the reports of these messages
indicate well-hidden bugs in Postgres, or are a result of storage-level
malfeasance; the latter possibility suggests that we ought to try to be more
robust even if there is a bug here that's ultimately found.

Backpatch to 8.2.  The code before that is sufficiently different that
it doesn't seem worth the trouble to back-port further.

14 years agoRemove obsolete remark that PQprepare() is more flexible than PREPARE.
Tom Lane [Sun, 29 Aug 2010 15:19:19 +0000 (15:19 +0000)]
Remove obsolete remark that PQprepare() is more flexible than PREPARE.

Spotted by Dmitriy Igrishin.  Back-patch to 8.2, which is when the PREPARE
statement was improved to allow parameter types to be omitted.

14 years agoUpdate time zone data files to tzdata release 2010l: DST law changes in
Tom Lane [Thu, 26 Aug 2010 19:59:00 +0000 (19:59 +0000)]
Update time zone data files to tzdata release 2010l: DST law changes in
Egypt and Palestine.  Added new names for two Micronesian timezones:
Pacific/Chuuk is now preferred over Pacific/Truk (and the preferred
abbreviation is CHUT not TRUT) and Pacific/Pohnpei is preferred over
Pacific/Ponape.  Historical corrections for Finland.

14 years agoFix ExecMakeTableFunctionResult to verify that all rows returned by a SRF
Tom Lane [Thu, 26 Aug 2010 18:54:52 +0000 (18:54 +0000)]
Fix ExecMakeTableFunctionResult to verify that all rows returned by a SRF
returning "record" actually do have the same rowtype.  This is needed because
the parser can't realistically enforce that they will all have the same typmod,
as seen in a recent example from David Wheeler.

Back-patch to 8.0, which is as far back as we have the notion of RECORD
subtypes being distinguished by typmod.  Wheeler's example depends on
8.4-and-up features, but I suspect there may be ways to provoke similar
failures before 8.4.

14 years agoCatch null pointer returns from PyCObject_AsVoidPtr and PyCObject_FromVoidPtr
Peter Eisentraut [Wed, 25 Aug 2010 19:37:48 +0000 (19:37 +0000)]
Catch null pointer returns from PyCObject_AsVoidPtr and PyCObject_FromVoidPtr

This is reproducibly possible in Python 2.7 if the user turned
PendingDeprecationWarning into an error, but it's theoretically also possible
in earlier versions in case of exceptional conditions.

backpatched to 8.0

14 years agoImprove parallel restore's ability to cope with selective restore (-L option).
Tom Lane [Sat, 21 Aug 2010 13:59:58 +0000 (13:59 +0000)]
Improve parallel restore's ability to cope with selective restore (-L option).

The original coding tended to break down in the face of modified restore
orders, as shown in bug #5626 from Albert Ullrich, because it would flip over
into parallel-restore operation too soon.  That causes problems because we
don't have sufficient dependency information in dump archives to allow safe
parallel processing of SECTION_PRE_DATA items.  Even if we did, it's probably
undesirable to allow that to override the commanded restore order.

To fix the problem of omitted items causing unexpected changes in restore
order, tweak SortTocFromFile so that omitted items end up at the head of
the list not the tail.  This ensures that they'll be examined and their
dependencies will be marked satisfied before we get to any interesting
items.

In HEAD and 9.0, we can easily change restore_toc_entries_parallel so that
all SECTION_PRE_DATA items are guaranteed to be processed in the initial
serial-restore loop, and hence in commanded order.  Only DATA and POST_DATA
items are candidates for parallel processing.  For them there might be
variations from the commanded order because of parallelism, but we should
do it in a safe order thanks to dependencies.

In 8.4 it's much harder to make such a guarantee.  I settled for not
letting the initial loop break out into parallel processing mode if
it sees a DATA/POST_DATA item that's not to be restored; this at least
prevents a non-restorable item from causing premature exit from the loop.
This means that 8.4 will be more likely to fail given a badly-ordered -L
list than 9.x, but we don't really promise any such thing will work anyway.

14 years agoAllow USING and INTO clauses of plpgsql's EXECUTE to appear in either order.
Tom Lane [Thu, 19 Aug 2010 18:58:11 +0000 (18:58 +0000)]
Allow USING and INTO clauses of plpgsql's EXECUTE to appear in either order.

Aside from being more forgiving, this prevents a rather surprising misbehavior
when the "wrong" order was used: the old code didn't throw a syntax error,
but absorbed the INTO clause into the last USING expression, which then did
strange things downstream.

Intentionally not changing the documentation; we'll continue to advertise
only the "standard" clause order.

Backpatch to 8.4, where the USING clause was added to EXECUTE.

14 years agoKeep exec_simple_check_plan() from thinking "SELECT foo INTO bar" is simple.
Tom Lane [Thu, 19 Aug 2010 18:11:02 +0000 (18:11 +0000)]
Keep exec_simple_check_plan() from thinking "SELECT foo INTO bar" is simple.

It's not clear if this situation can occur in plpgsql other than via the
EXECUTE USING case Heikki illustrated, which I will shortly close off.
However, ignoring the intoClause if it's there is surely wrong, so let's
patch it for safety.

Backpatch to 8.3, which is as far back as this code has a PlannedStmt
to deal with.  There might be another way to make an equivalent test
before that, but since this is just preventing hypothetical bugs,
I'm not going to obsess about it.

14 years agoBe a bit less cavalier with both the code and the comment for UNKNOWN fix.
Tom Lane [Thu, 19 Aug 2010 17:31:56 +0000 (17:31 +0000)]
Be a bit less cavalier with both the code and the comment for UNKNOWN fix.

14 years agoRevert patch to coerce 'unknown' type parameters in the backend. As Tom
Heikki Linnakangas [Thu, 19 Aug 2010 16:54:51 +0000 (16:54 +0000)]
Revert patch to coerce 'unknown' type parameters in the backend. As Tom
pointed out, it would need a 2nd pass after the whole query is processed to
correctly check that an unknown Param is coerced to the same target type
everywhere. Adding the 2nd pass would add a lot more code, which doesn't
seem worth the risk given that there isn't much of a use case for passing
unknown Params in the first place. The code would work without that check,
but it might be confusing and the behavior would be different from the
varparams case.

Instead, just coerce all unknown params in a PL/pgSQL USING clause to text.
That's simple, and is usually what users expect.

Revert the patch in CVS HEAD and master, and backpatch the new solution to
8.4. Unlike the previous solution, this applies easily to 8.4 too.

14 years agoFix possible corruption of AfterTriggerEventLists in subtransaction rollback.
Tom Lane [Thu, 19 Aug 2010 15:46:30 +0000 (15:46 +0000)]
Fix possible corruption of AfterTriggerEventLists in subtransaction rollback.

afterTriggerInvokeEvents failed to adjust events->tailfree when truncating
the last chunk of an event list.  This could result in the data being
"de-truncated" by afterTriggerRestoreEventList during a subsequent
subtransaction abort.  Even that wouldn't kill us, because the re-added data
would just be events marked DONE --- unless the data had been partially
overwritten by new events.  Then we might crash, or in any case misbehave
(perhaps fire triggers twice, or fire triggers with the wrong event data).
Per bug #5622 from Thue Janus Kristensen.

Back-patch to 8.4 where the current trigger list representation was introduced.

14 years agoAdd missing handling of PlannedStmt.transientPlan in copyfuncs/outfuncs.
Tom Lane [Wed, 18 Aug 2010 15:22:09 +0000 (15:22 +0000)]
Add missing handling of PlannedStmt.transientPlan in copyfuncs/outfuncs.

_outPlannedStmt is only debug support, so the omission there was not very
serious, but the omission in _copyPlannedStmt is a real bug.  The consequence
would be that a copied plan tree would never be marked as a transient plan,
so that we would forget we ought to replan it after some not-yet-ready index
becomes ready for use.  This might explain some past complaints about indexes
created with CREATE INDEX CONCURRENTLY not being used right away.  Problem
spotted by Yeb Havinga.

Back-patch to 8.3, where the field was added.

14 years agoApplied Zoltan's patch to fix a few memleaks in ecpg's pgtypeslib.
Michael Meskes [Tue, 17 Aug 2010 09:41:49 +0000 (09:41 +0000)]
Applied Zoltan's patch to fix a few memleaks in ecpg's pgtypeslib.

14 years agoBackpatch some blatant spelling mistakes
Peter Eisentraut [Tue, 17 Aug 2010 04:49:33 +0000 (04:49 +0000)]
Backpatch some blatant spelling mistakes

14 years agoArrange to fsync the contents of lockfiles (both postmaster.pid and the
Tom Lane [Mon, 16 Aug 2010 17:33:01 +0000 (17:33 +0000)]
Arrange to fsync the contents of lockfiles (both postpid and the
socket lockfile) when writing them.  The lack of an fsync here may well
explain two different reports we've seen of corrupted lockfile contents,
which doesn't particularly bother the running server but can prevent a
new server from starting if the old one crashes.  Per suggestion from
Alvaro.

Back-patch to all supported versions.

14 years agoFix psql's copy of utf2ucs() to match the backend's copy exactly;
Tom Lane [Mon, 16 Aug 2010 00:06:31 +0000 (00:06 +0000)]
Fix psql's copy of utf2ucs() to match the backend's copy exactly;
in particular, propagate a fix in the test to see whether a UTF8 character has
length 4 bytes.  This is likely of little real-world consequence because
5-or-more-byte UTF8 sequences are not supported by Postgres nor seen anywhere
in the wild, but still we may as well get it right.  Problem found by Joseph
Adams.

Bug is aboriginal, so back-patch all the way.

14 years agoAdd link and additional index reference to pgcrypto.
Robert Haas [Sun, 15 Aug 2010 01:57:21 +0000 (01:57 +0000)]
Add link and additional index reference to pgcrypto.

Kevin Grittner, with markup adjustments.

14 years agoFix planner to make a reasonable assumption about the amount of memory space
Tom Lane [Sat, 14 Aug 2010 15:47:30 +0000 (15:47 +0000)]
Fix planner to make a reasonable assumption about the amount of memory space
used by array_agg(), string_agg(), and similar aggregate functions that use
"internal" as their transition datatype.  The previous coding thought this
took *no* extra space, since "internal" is pass-by-value; but actually these
aggregates typically consume a great deal of space.  Per bug #5608 from
Itagaki Takahiro, and fix suggestion from Hitoshi Harada.

Back-patch to 8.4, where array_agg was introduced.

14 years agoFix Assert failure in PushOverrideSearchPath when trying to restore a search
Tom Lane [Fri, 13 Aug 2010 16:27:28 +0000 (16:27 +0000)]
Fix Assert failure in PushOverrideSearchPath when trying to restore a search
path that specifies useTemp, but there is no active temp schema in the
current session.  (This can happen if the path was saved during a transaction
that created a temp schema and was later rolled back.)  For existing callers
it's sufficient to ignore the useTemp flag in this case, though we might
later want to offer an option to create a fresh temp schema.  So far as I can
tell this is just an Assert failure: in a non-assert build, the code would
push a zero onto the new search path, which is useless but not very harmful.
Per bug report from Heikki.

Back-patch to 8.3; prior versions don't have this code.

14 years agoFix one more incorrect errno definition in the ECPG manual.
Robert Haas [Wed, 11 Aug 2010 19:03:36 +0000 (19:03 +0000)]
Fix one more incorrect errno definition in the ECPG manual.

Again, back-patch all the way to 7.4.

14 years agoFix incorrect errno definitions in ECPG manual.
Robert Haas [Wed, 11 Aug 2010 18:52:23 +0000 (18:52 +0000)]
Fix incorrect errno definitions in ECPG manual.

ecpgerrno.h hasn't materially changed since PostgreSQL 7.4, so this has
been wrong for a very long time.  Back-patch all the way.

Satoshi Nagayasu

14 years agoUse double quotes rather than double quotes for libpq target anchors.
Robert Haas [Tue, 10 Aug 2010 02:57:19 +0000 (02:57 +0000)]
Use double quotes rather than double quotes for libpq target anchors.

Per observation from Tom Lane that the previous patch to these files was
not consistent with what is done elsewhere in the docs.

14 years agoFix incorrect logic in plpgsql for cleanup after evaluation of non-simple
Tom Lane [Mon, 9 Aug 2010 18:50:29 +0000 (18:50 +0000)]
Fix incorrect logic in plpgsql for cleanup after evaluation of non-simple
expressions.  We need to deal with this when handling subscripts in an array
assignment, and also when catching an exception.  In an Assert-enabled build
these omissions led to Assert failures, but I think in a normal build the
only consequence would be short-term memory leakage; which may explain why
this wasn't reported from the field long ago.

Back-patch to all supported versions.  7.4 doesn't have exceptions, but
otherwise these bugs go all the way back.

Heikki Linnakangas and Tom Lane

14 years agoProvide stable target anchors for libpq functions.
Robert Haas [Mon, 9 Aug 2010 12:00:53 +0000 (12:00 +0000)]
Provide stable target anchors for libpq functions.

Daniele Varrazzo

14 years agoFix indexterm spelling
Peter Eisentraut [Fri, 6 Aug 2010 20:09:00 +0000 (20:09 +0000)]
Fix indexterm spelling

14 years agoFix inheritance count tracking in ALTER TABLE .. ADD CONSTRAINT.
Robert Haas [Tue, 3 Aug 2010 15:47:16 +0000 (15:47 +0000)]
Fix inheritance count tracking in ALTER TABLE .. ADD CONSTRAINT.

Without this patch, constraints inherited by children of a parent
table which itself has multiple inheritance parents can end up with
the wrong coninhcount.  After dropping the constraint, the children
end up with a leftover copy of the constraint that is not dumped
and cannot be dropped.  There is a similar problem with ALTER TABLE
.. ADD COLUMN, but that looks significantly more difficult to
resolve, so I'm committing this fix separately.

Back-patch to 8.4, which is the first release that has coninhcount.

Report by Hank Enting.

14 years agoFix core dump in QTNodeCompare when tsquery_cmp() is applied to two empty
Tom Lane [Tue, 3 Aug 2010 00:10:52 +0000 (00:10 +0000)]
Fix core dump in QTNodeCompare when tsquery_cmp() is applied to two empty
tsqueries.  CompareTSQ has to have a guard for the case rather than blindly
applying QTNodeCompare to random data past the end of the datums.  Also,
change QTNodeCompare to be a little less trusting: use an actual test rather
than just Assert'ing that the input is sane.  Problem encountered while
investigating another issue (I saw a core dump in autoanalyze on a table
containing multiple empty tsquery values).

Back-patch to all branches with tsquery support.

In HEAD, also fix some bizarre (though not outright wrong) coding in
tsq_mcontains().

14 years agoFix an additional set of problems in GIN's handling of lossy page pointers.
Tom Lane [Sun, 1 Aug 2010 19:16:55 +0000 (19:16 +0000)]
Fix an additional set of problems in GIN's handling of lossy page pointers.
Although the key-combining code claimed to work correctly if its input
contained both lossy and exact pointers for a single page in a single TID
stream, in fact this did not work, and could not work without pretty
fundamental redesign.  Modify keyGetItem so that it will not return such a
stream, by handling lossy-pointer cases a bit more explicitly than we did
before.

Per followup investigation of a gripe from Artur Dabrowski.
An example of a query that failed given his data set is
select count(*) from search_tab where
(to_tsvector('german', keywords ) @@ to_tsquery('german', 'ee:* | dd:*')) and
(to_tsvector('german', keywords ) @@ to_tsquery('german', 'aa:*'));

Back-patch to 8.4 where the lossy pointer code was introduced.

14 years agoTweak tsmatchsel() so that it examines the structure of the tsquery whenever
Tom Lane [Sat, 31 Jul 2010 03:27:57 +0000 (03:27 +0000)]
Tweak tsmatchsel() so that it examines the structure of the tsquery whenever
possible (ie, whenever the tsquery is a constant), even when no statistics
are available for the tsvector.  For example, foo @@ 'a & b'::tsquery
can be expected to be more selective than foo @@ 'a'::tsquery, whether
or not we know anything about foo.  We use DEFAULT_TS_MATCH_SEL as the assumed
selectivity of individual query terms when no stats are available, then
combine the terms according to the query's AND/OR structure as usual.

Per experimentation with Artur Dabrowski's example.  (The fact that there
are no stats available in that example is a problem in itself, but
nonetheless tsmatchsel should be smarter about the case.)

Back-patch to 8.4 to keep all versions of tsmatchsel() in sync.

14 years agoRewrite the key-combination logic in GIN's keyGetItem() and scanGetItem()
Tom Lane [Sat, 31 Jul 2010 00:31:12 +0000 (00:31 +0000)]
Rewrite the key-combination logic in GIN's keyGetItem() and scanGetItem()
routines to make them behave better in the presence of "lossy" index pointers.
The previous coding was outright incorrect for some cases, as recently
reported by Artur Dabrowski: scanGetItem would fail to return index entries in
cases where one index key had multiple exact pointers on the same page as
another key had a lossy pointer.  Also, keyGetItem was extremely inefficient
for cases where a single index key generates multiple "entry" streams, such as
an @@ operator with a multiple-clause tsquery.  The presence of a lossy page
pointer in any one stream defeated its ability to use the opclass
consistentFn, resulting in probing many heap pages that didn't really need to
be visited.  In Artur's example case, a query like
WHERE tsvector @@ to_tsquery('a & b')
was about 50X slower than the theoretically equivalent
WHERE tsvector @@ to_tsquery('a') AND tsvector @@ to_tsquery('b')
The way that I chose to fix this was to have GIN call the consistentFn
twice with both TRUE and FALSE values for the in-doubt entry stream,
returning a hit if either call produces TRUE, but not if they both return
FALSE.  The code handles this for the case of a single in-doubt entry stream,
but punts (falling back to the stupid behavior) if there's more than one lossy
reference to the same page.  The idea could be scaled up to deal with multiple
lossy references, but I think that would probably be wasted complexity.  At
least to judge by Artur's example, such cases don't occur often enough to be
worth trying to optimize.

Back-patch to 8.4.  8.3 did not have lossy GIN index pointers, so not
subject to these problems.

14 years agoImproved version of patch to protect pg_get_expr() against misuse:
Tom Lane [Fri, 30 Jul 2010 17:56:59 +0000 (17:56 +0000)]
Improved version of patch to protect pg_get_expr() against misuse:
look through join alias Vars to avoid breaking join queries, and
move the test to someplace where it will catch more possible ways
of calling a function.  We still ought to throw away the whole thing
in favor of a data-type-based solution, but that's not feasible in
the back branches.

Completion of back-port of my patch of yesterday.

14 years agoFix another longstanding problem in copy_relation_data: it was blithely
Tom Lane [Thu, 29 Jul 2010 19:23:37 +0000 (19:23 +0000)]
Fix another longstanding problem in copy_relation_data: it was blithely
assuming that a local char[] array would be aligned on at least a word
boundary.  There are architectures on which that is pretty much guaranteed to
NOT be the case ... and those arches also don't like non-aligned memory
accesses, meaning that log_newpage() would crash if it ever got invoked.
Even on Intel-ish machines there's a potential for a large performance penalty
from doing I/O to an inadequately aligned buffer.  So palloc it instead.

Backpatch to 8.0 --- 7.4 doesn't have this code.

14 years agoFix possible page corruption by ALTER TABLE .. SET TABLESPACE.
Robert Haas [Thu, 29 Jul 2010 16:14:55 +0000 (16:14 +0000)]
Fix possible page corruption by ALTER TABLE .. SET TABLESPACE.

If a zeroed page is present in the heap, ALTER TABLE .. SET TABLESPACE will
set the LSN and TLI while copying it, which is wrong, and heap_xlog_newpage()
will do the same thing during replay, so the corruption propagates to any
standby.  Note, however, that the bug can't be demonstrated unless archiving
is enabled, since in that case we skip WAL logging altogether, and the LSN/TLI
are not set.

Back-patch to 8.0; prior releases do not have tablespaces.

Analysis and patch by Jeff Davis.  Adjustments for back-branches and minor
wordsmithing by me.

14 years agoFix potential failure when hashing the output of a subplan that produces
Tom Lane [Wed, 28 Jul 2010 04:51:08 +0000 (04:51 +0000)]
Fix potential failure when hashing the output of a subplan that produces
a pass-by-reference datatype with a nontrivial projection step.
We were using the same memory context for the projection operation as for
the temporary context used by the hashtable routines in execGrouping.c.
However, the hashtable routines feel free to reset their temp context at
any time, which'd lead to destroying input data that was still needed.
Report and diagnosis by Tao Ma.

Back-patch to 8.1, where the problem was introduced by the changes that
allowed us to work with "virtual" tuples instead of materializing intermediate
tuple values everywhere.  The earlier code looks quite similar, but it doesn't
suffer the problem because the data gets copied into another context as a
result of having to materialize ExecProject's output tuple.

14 years agoFix typo in PL/pgsql code example.
Robert Haas [Tue, 27 Jul 2010 20:02:27 +0000 (20:02 +0000)]
Fix typo in PL/pgsql code example.

Backpatch to 8.4.

Marc Cousin.  Review by Kevin Grittner.

14 years agoSpelling fixes
Peter Eisentraut [Tue, 27 Jul 2010 18:56:22 +0000 (18:56 +0000)]
Spelling fixes

14 years agoFix grammar
Peter Eisentraut [Mon, 26 Jul 2010 20:29:09 +0000 (20:29 +0000)]
Fix grammar

backpatched to 8.1

14 years agoAvoid deep recursion when assigning XIDs to multiple levels of subxacts.
Robert Haas [Fri, 23 Jul 2010 00:43:17 +0000 (00:43 +0000)]
Avoid deep recursion when assigning XIDs to multiple levels of subxacts.

Backpatch to 8.0.

Andres Freund, with cleanup and adjustment for older branches by me.

14 years agoFix several problems in pg_dump's handling of SQL/MED objects, notably failure
Tom Lane [Wed, 14 Jul 2010 21:21:23 +0000 (21:21 +0000)]
Fix several problems in pg_dump's handling of SQL/MED objects, notably failure
to dump a PUBLIC user mapping correctly, as per bug #5560 from Shigeru Hanada.
Use the pg_user_mappings view rather than trying to access pg_user_mapping
directly, so that the code doesn't fail when run by a non-superuser.  And
clean up some minor carelessness such as unsafe usage of fmtId().

Back-patch to 8.4 where this code was added.

14 years agoAllow full SSL certificate verification (wherein libpq checks its host name
Tom Lane [Wed, 14 Jul 2010 17:10:03 +0000 (17:10 +0000)]
Allow full SSL certificate verification (wherein libpq checks its host name
parameter against server cert's CN field) to succeed in the case where
both host and hostaddr are specified.  As with the existing precedents
for Kerberos, GSSAPI, SSPI, it is the calling application's responsibility
that host and hostaddr match up --- we just use the host name as given.
Per bug #5559 from Christopher Head.

In passing, make the error handling and messages for the no-host-name-given
failure more consistent among these four cases, and correct a lie in the
documentation: we don't attempt to reverse-lookup host from hostaddr
if host is missing.

Back-patch to 8.4 where SSL cert verification was introduced.

14 years agoOops, in the previous fix to prevent a cursor that's being used in a FOR
Heikki Linnakangas [Tue, 13 Jul 2010 09:02:40 +0000 (09:02 +0000)]
Oops, in the previous fix to prevent a cursor that's being used in a FOR
loop from being dropped, I missed subtransaction cleanup. Pinned portals
must be dropped at subtransaction cleanup just as they are at main
transaction cleanup.

Per bug #5556 by Robert Walker. Backpatch to 8.0, 7.4 didn't have
subtransactions.

14 years agoAvoid an Assert failure in deconstruct_array() by making get_attstatsslot()
Tom Lane [Fri, 9 Jul 2010 22:57:54 +0000 (22:57 +0000)]
Avoid an Assert failure in deconstruct_array() by making get_attstatsslot()
use the actual element type of the array it's disassembling, rather than
trusting the type OID passed in by its caller.  This is needed because
sometimes the planner passes in a type OID that's only binary-compatible
with the target column's type, rather than being an exact match.  Per an
example from Bernd Helmle.

Possibly we should refactor get_attstatsslot/free_attstatsslot to not expect
the caller to supply type ID data at all, but for now I'll just do the
minimum-change fix.

Back-patch to 7.4.  Bernd's test case only crashes back to 8.0, but since
these subroutines are the same in 7.4, I suspect there may be variant
cases that would crash 7.4 as well.

14 years agoFix "cannot handle unplanned sub-select" error that can occur when a
Tom Lane [Thu, 8 Jul 2010 00:14:10 +0000 (00:14 +0000)]
Fix "cannot handle unplanned sub-select" error that can occur when a
sub-select contains a join alias reference that expands into an expression
containing another sub-select.  Per yesterday's report from Merlin Moncure
and subsequent off-list investigation.

Back-patch to 7.4.  Older versions didn't attempt to flatten sub-selects in
ways that would trigger this problem.

14 years agoThe previous fix in CVS HEAD and 8.4 for handling the case where a cursor
Heikki Linnakangas [Mon, 5 Jul 2010 09:27:24 +0000 (09:27 +0000)]
The previous fix in CVS HEAD and 8.4 for handling the case where a cursor
being used in a PL/pgSQL FOR loop is closed was inadequate, as Tom Lane
pointed out. The bug affects FOR statement variants too, because you can
close an implicitly created cursor too by guessing the "<unnamed portal X>"
name created for it.

To fix that, "pin" the portal to prevent it from being dropped while it's
being used in a PL/pgSQL FOR loop. Backpatch all the way to 7.4 which is
the oldest supported version.

14 years agoAllow REASSIGNED OWNED to handle opclasses and opfamilies.
Robert Haas [Sat, 3 Jul 2010 13:53:26 +0000 (13:53 +0000)]
Allow REASSIGNED OWNED to handle opclasses and opfamilies.

Backpatch to 8.3, which is as far back as we have opfamilies.
The opclass portion could probably be backpatched to 8.2, when
REASSIGN OWNED was added, but for now I have not done that.

Asko Tiidumaa, with minor adjustments by me.

14 years agoFix assorted misstatements and poor wording in the descriptions of the I/O
Tom Lane [Sat, 3 Jul 2010 04:03:14 +0000 (04:03 +0000)]
Fix assorted misstatements and poor wording in the descriptions of the I/O
formats for geometric types.  Per bug #5536 from Jon Strait, and my own
testing.

Back-patch to all supported branches, since this doco has been wrong right
along -- we certainly haven't changed the I/O behavior of these types in
many years.

14 years agoUnbreak MSVC builds by removing copydir.c from list of libpgport files
Andrew Dunstan [Sat, 3 Jul 2010 00:58:23 +0000 (00:58 +0000)]
Unbreak MSVC builds by removing copydir.c from list of libpgport files

14 years agoMove copydir.c from src/port to src/backend/storage/file
Robert Haas [Fri, 2 Jul 2010 17:03:38 +0000 (17:03 +0000)]
Move copydir.c from src/port to src/backend/storage/file

The previous commit to make copydir() interruptible prevented
postgres.exe from linking on MinGW and Cygwin, because on those
platforms libpgport_srv.a can't freely reference symbols defined
by the backend.  Since that code is already backend-specific anyway,
just move the whole file into the backend rather than adding further
kludges to deal with the symbols needed by CHECK_FOR_INTERRUPTS().

This probably needs some further cleanup, but this commit just moves
the file as-is, which should hopefully be enough to turn the
buildfarm green again.

14 years agoAllow copydir() to be interrupted.
Robert Haas [Thu, 1 Jul 2010 20:13:06 +0000 (20:13 +0000)]
Allow copydir() to be interrupted.

This makes ALTER DATABASE .. SET TABLESPACE and CREATE DATABASE more
sensitive to interrupts.  Backpatch to 8.4, where ALTER DATABASE .. SET
TABLESPACE was introduced.  We could go back further, but in the absence
of complaints about the CREATE DATABASE case it doesn't seem worth it.

Guillaume Lelarge, with a small correction by me.

14 years agoAllow ALTER TABLE .. SET TABLESPACE to be interrupted.
Robert Haas [Thu, 1 Jul 2010 14:12:04 +0000 (14:12 +0000)]
Allow ALTER TABLE .. SET TABLESPACE to be interrupted.

Backpatch to 8.0, where tablespaces were introduced.

Guillaume Lelarge

14 years agostringToNode() and deparse_expression_pretty() crash on invalid input,
Heikki Linnakangas [Wed, 30 Jun 2010 18:10:37 +0000 (18:10 +0000)]
stringToNode() and deparse_expression_pretty() crash on invalid input,
but we have nevertheless exposed them to users via pg_get_expr(). It would
be too much maintenance effort to rigorously check the input, so put a hack
in place instead to restrict pg_get_expr() so that the argument must come
from one of the system catalog columns known to contain valid expressions.

Per report from Rushabh Lathia. Backpatch to 7.4 which is the oldest
supported version at the moment.

14 years agoImprove pg_dump's checkSeek() function to verify the functioning of ftello
Tom Lane [Mon, 28 Jun 2010 02:07:09 +0000 (02:07 +0000)]
Improve pg_dump's checkSeek() function to verify the functioning of ftello
as well as fseeko, and to not assume that fseeko(fp, 0, SEEK_CUR) proves
anything.  Also improve some related comments.  Per my observation that
the SEEK_CUR test didn't actually work on some platforms, and subsequent
discussion with Robert Haas.

Back-patch to 8.4.  In earlier releases it's not that important whether
we get the hasSeek test right, but with parallel restore it matters.

14 years agoFix pg_restore so parallel restore doesn't fail when the input file doesn't
Tom Lane [Sun, 27 Jun 2010 19:07:30 +0000 (19:07 +0000)]
Fix pg_restore so parallel restore doesn't fail when the input file doesn't
contain data offsets (which it won't, if pg_dump thought its output wasn't
seekable).  To do that, remove an unnecessarily aggressive error check, and
instead fail if we get to the end of the archive without finding the desired
data item.  Also improve the error message to be more specific about the
cause of the problem.  Per discussion of recent report from Igor Neyman.

Back-patch to 8.4 where parallel restore was introduced.

14 years agoDeprecate the use of => as an operator name.
Robert Haas [Tue, 22 Jun 2010 11:36:28 +0000 (11:36 +0000)]
Deprecate the use of => as an operator name.

In HEAD, emit a warning when an operator named => is defined.
In both HEAD and the backbranches (except in 8.2, where contrib
modules do not have documentation), document that hstore's text =>
text operator may be removed in a future release, and encourage the
use of the hstore(text, text) function instead.  This function only
exists in HEAD (previously, it was called tconvert), so backpatch
it back to 8.2, when hstore was added.  Per discussion.

14 years agoIn a PL/pgSQL "FOR cursor" statement, the statements executed in the loop
Heikki Linnakangas [Mon, 21 Jun 2010 09:49:58 +0000 (09:49 +0000)]
In a PL/pgSQL "FOR cursor" statement, the statements executed in the loop
might close the cursor,  rendering the Portal pointer to it invalid.
Closing the cursor in the middle of the loop is not a very sensible thing
to do, but we must handle it gracefully and throw an error instead of
crashing.

14 years agoFix mishandling of whole-row Vars referencing a view or sub-select.
Tom Lane [Mon, 21 Jun 2010 00:14:54 +0000 (00:14 +0000)]
Fix mishandling of whole-row Vars referencing a view or sub-select.
If such a Var appeared within a nested sub-select, we failed to translate it
correctly during pullup of the view, because the recursive call to
replace_rte_variables_mutator was looking for the wrong sublevels_up value.
Bug was introduced during the addition of the PlaceHolderVar mechanism.
Per bug #5514 from Marcos Castedo.

14 years agoFix typo, init => int, per KOIZUMI Satoru.
Tom Lane [Thu, 17 Jun 2010 16:03:36 +0000 (16:03 +0000)]
Fix typo, init => int, per KOIZUMI Satoru.

14 years agoFix dblink_build_sql_insert() and related functions to handle dropped
Tom Lane [Tue, 15 Jun 2010 19:04:22 +0000 (19:04 +0000)]
Fix dblink_build_sql_insert() and related functions to handle dropped
columns correctly.  In passing, get rid of some dead logic in the
underlying get_sql_insert() etc functions --- there is no caller that
will pass null value-arrays to them.

Per bug report from Robert Voinea.

14 years agoConsolidate and improve checking of key-column-attnum arguments for
Tom Lane [Tue, 15 Jun 2010 16:22:26 +0000 (16:22 +0000)]
Consolidate and improve checking of key-column-attnum arguments for
dblink_build_sql_insert() and related functions.  In particular, be sure to
reject references to dropped and out-of-range column numbers.  The numbers
are still interpreted as physical column numbers, though, for backward
compatibility.

This patch replaces Joe's patch of 2010-02-03, which handled only some aspects
of the problem.

14 years agoRearrange dblink's dblink_build_sql_insert() and related routines to open and
Tom Lane [Mon, 14 Jun 2010 20:49:39 +0000 (20:49 +0000)]
Rearrange dblink's dblink_build_sql_insert() and related routines to open and
lock the target relation just once per SQL function call.  The original coding
obtained and released lock several times per call.  Aside from saving a
not-insignificant number of cycles, this eliminates possible race conditions
if someone tries to modify the relation's schema concurrently.  Also
centralize locking and permission-checking logic.

Problem noted while investigating a trouble report from Robert Voinea --- his
problem is still to be fixed, though.

14 years agoAdd index entry for ::, per complaint from John Gage.
Alvaro Herrera [Wed, 9 Jun 2010 16:43:52 +0000 (16:43 +0000)]
Add index entry for ::, per complaint from John Gage.

14 years agoMake the walwriter close it's handle to an old xlog segment if it's no longer
Magnus Hagander [Wed, 9 Jun 2010 10:54:53 +0000 (10:54 +0000)]
Make the walwriter close it's handle to an old xlog segment if it's no longer
the current one. Not doing this would leave the walwriter with a handle to a
deleted file if there was nothing for it to do for a long period of time,
preventing the file from  being completely removed.

Reported by Tollef Fog Heen, and thanks to Heikki for some hand-holding with
the patch.

14 years agoAvoid "identifier will be truncated" warning in dblink
Itagaki Takahiro [Wed, 9 Jun 2010 03:40:16 +0000 (03:40 +0000)]
Avoid "identifier will be truncated" warning in dblink
when connection string is longer than NAMEDATALEN.
The previous fix for long connection name broke the behavior.

14 years agoFix connection leak in dblink when dblink_connect() or dblink_connect_u()
Itagaki Takahiro [Wed, 9 Jun 2010 00:56:25 +0000 (00:56 +0000)]
Fix connection leak in dblink when dblink_connect() or dblink_connect_u()
end with "duplicate connection name" errors.

Backported to release 7.4.

14 years agoAdd missed function dblink_connect_u(text[,text]) to uninstall script
Teodor Sigaev [Mon, 7 Jun 2010 15:14:50 +0000 (15:14 +0000)]
Add missed function dblink_connect_u(text[,text]) to uninstall script

14 years agoEnsure default-only storage parameters for TOAST relations
Itagaki Takahiro [Mon, 7 Jun 2010 03:01:35 +0000 (03:01 +0000)]
Ensure default-only storage parameters for TOAST relations
to be initialized with proper values. Affected parameters are
fillfactor, analyze_threshold, and analyze_scale_factor.

Especially uninitialized fillfactor caused inefficient page usage
because we built a StdRdOptions struct in which fillfactor is zero
if any reloption is set for the toast table.

In addition, we disallow toast.autovacuum_analyze_threshold and
toast.autovacuum_analyze_scale_factor because we didn't actually
support them; they are always ignored.

Report by Rumko on pgsql-bugs on 12 May 2010.
Analysis by Tom Lane and Alvaro Herrera. Patch by me.

Backpatch to 8.4.

14 years agoData returned by RETURNING clause wasn't correctly processed by ecpg. Patch backporte...
Michael Meskes [Fri, 4 Jun 2010 10:48:05 +0000 (10:48 +0000)]
Data returned by RETURNING clause wasn't correctly processed by ecpg. Patch backported from HEAD.