Commit Graph

1925 Commits

Author SHA1 Message Date
Peter Eisentraut 1eb2231fc4 Allow pg_upgrade with PGCLIENTENCODING set
This used to work, but since PGCLIENTENCODING is now a connection
option variable, pg_upgrade would prevent it.
2011-04-07 19:24:47 +03:00
Bruce Momjian e69d32158c Simplify structure of query used to gather database object information
in pg_upgrade.
2011-04-07 06:23:12 -04:00
Tom Lane 2594cf0e8c Revise the API for GUC variable assign hooks.
The previous functions of assign hooks are now split between check hooks
and assign hooks, where the former can fail but the latter shouldn't.
Aside from being conceptually clearer, this approach exposes the
"canonicalized" form of the variable value to guc.c without having to do
an actual assignment.  And that lets us fix the problem recently noted by
Bernd Helmle that the auto-tune patch for wal_buffers resulted in bogus
log messages about "parameter "wal_buffers" cannot be changed without
restarting the server".  There may be some speed advantage too, because
this design lets hook functions avoid re-parsing variable values when
restoring a previous state after a rollback (they can store a pre-parsed
representation of the value instead).  This patch also resolves a
longstanding annoyance about custom error messages from variable assign
hooks: they should modify, not appear separately from, guc.c's own message
about "invalid parameter value".
2011-04-07 00:12:02 -04:00
Peter Eisentraut c75163842c Replace the confusing exit_nicely() by an atexit/on_exit hook 2011-04-06 23:00:44 +03:00
Robert Haas 595a441ae9 Add missing check on invocation of trusted procedures.
KaiGai Kohei
2011-04-04 13:25:42 -04:00
Bruce Momjian da3418cea9 Mention pg_upgrade sets autovacuum_freeze_max_age to maximum. 2011-03-30 17:45:54 -04:00
Bruce Momjian d609b08ead Expand comment on how pg_upgrade is turning off autovacuum. 2011-03-30 17:37:00 -04:00
Bruce Momjian d67b0bf471 In pg_upgrade, add C comment about how autovacuum is disabled. 2011-03-29 11:11:45 -04:00
Alvaro Herrera e5948e3504 Add missing #include 2011-03-28 10:37:29 -03:00
Bruce Momjian 898a14e1a0 Remove unused copy_dir() function from pg_upgrade. 2011-03-15 20:52:35 -04:00
Bruce Momjian 303b7fcd10 Modify pg_test_fsync to match the behavior of git head in regards to
O_DIRECT behavior.
2011-03-10 20:25:41 -05:00
Itagaki Takahiro 2d8de0a50b Cleanup copyright years and file names in the header comments of some files. 2011-03-10 15:05:33 +09:00
Bruce Momjian d367d41d66 Fix file descriptor leaks in pg_upgrade in failure code paths. 2011-03-08 21:36:17 -05:00
Bruce Momjian 05d93c38a7 Tighten pg_upgrade check for pre-8.4 toast table name matching. 2011-03-06 21:57:37 -05:00
Tom Lane dfe18f18d2 Fix a couple more missing "static" markers. 2011-03-06 20:14:01 -05:00
Bruce Momjian a54ba23c08 Improve pg_upgrade relation name check logic for pre-8.4 servers. 2011-03-06 06:34:58 -05:00
Bruce Momjian 8f87dcd863 Update new pg_upgrade comment about pre-8.4 TOAST tables. 2011-03-05 22:09:35 -05:00
Bruce Momjian 9e5bed2df1 Restructure pg_upgrade checks because pre-8.4 Postgres did not rename
toast file names to match the new relfilenode.
2011-03-05 21:12:21 -05:00
Bruce Momjian f7b70dfc76 Fix pg_upgrade to print the proper database name for file transfer
failures.
2011-03-05 20:18:31 -05:00
Bruce Momjian a3375becfa Print clearer failure message when pg_upgrade fails due to a fatal
error.
2011-03-05 19:32:53 -05:00
Tom Lane 94be9e3f0c Fix citext's upgrade-from-unpackaged script to set its collation correctly.
Although there remains some debate about how CREATE TYPE should represent
the collation property, this doesn't really affect what we need to do in
citext's script, so go ahead and fix that.
2011-03-03 13:22:18 -05:00
Tom Lane 8c4164540b Add -lm to SHLIB_LINK for contrib/btree_gist.
Now that btree_gist contains a reference to isinf(), this is necessary
at least on some platforms.  Per buildfarm.
2011-03-03 01:43:38 -05:00
Tom Lane 8436489c81 Add KNNGIST support to contrib/btree_gist.
This extends GiST's support for nearest-neighbor searches to many of the
standard data types.

Teodor Sigaev
2011-03-02 14:44:33 -05:00
Tom Lane a874fe7b4c Refactor the executor's API to support data-modifying CTEs better.
The originally committed patch for modifying CTEs didn't interact well
with EXPLAIN, as noted by myself, and also had corner-case problems with
triggers, as noted by Dean Rasheed.  Those problems show it is really not
practical for ExecutorEnd to call any user-defined code; so split the
cleanup duties out into a new function ExecutorFinish, which must be called
between the last ExecutorRun call and ExecutorEnd.  Some Asserts have been
added to these functions to help verify correct usage.

It is no longer necessary for callers of the executor to call
AfterTriggerBeginQuery/AfterTriggerEndQuery for themselves, as this is now
done by ExecutorStart/ExecutorFinish respectively.  If you really need to
suppress that and do it for yourself, pass EXEC_FLAG_SKIP_TRIGGERS to
ExecutorStart.

Also, refactor portal commit processing to allow for the possibility that
PortalDrop will invoke user-defined code.  I think this is not actually
necessary just yet, since the portal-execution-strategy logic forces any
non-pure-SELECT query to be run to completion before we will consider
committing.  But it seems like good future-proofing.
2011-02-27 13:44:12 -05:00
Alvaro Herrera 0056066d06 Update pageinspect--1.0.sql to match the upgrade script
Per comment from Tom
2011-02-25 19:39:02 -03:00
Alvaro Herrera a338d65461 Fix pageinspect's heap_page_item to return infomasks as 32 bit values
HeapTupleHeader's t_infomask and t_infomask2 are defined as 16-bit
unsigned integers, so when the 16th bit was set, heap_page_item was
returning them as negative values, which was ugly.

The change to pageinspect--unpackaged--1.0.sql allows a module upgraded
from 9.0 to be cleanly updated from the previous definition.
2011-02-25 19:04:25 -03:00
Itagaki Takahiro 3cba8240a1 Add ENCODING option to COPY TO/FROM and file_fdw.
File encodings can be specified separately from client encoding.
If not specified, client encoding is used for backward compatibility.

Cases when the encoding doesn't match client encoding are slower
than matched cases because we don't have conversion procs for other
encodings. Performance improvement would be be a future work.

Original patch by Hitoshi Harada, and modified by me.
2011-02-21 14:32:40 +09:00
Tom Lane 087bd179e6 Minor logic fix for new levenshtein implementation.
Alexander Korotkov
2011-02-20 14:55:07 -05:00
Tom Lane 7c5d0ae707 Add contrib/file_fdw foreign-data wrapper for reading files via COPY.
This is both very useful in its own right, and an important test case
for the core FDW support.

This commit includes a small refactoring of copy.c to expose its option
checking code as a separately callable function.  The original patch
submission duplicated hundreds of lines of that code, which seemed pretty
unmaintainable.

Shigeru Hanada, reviewed by Itagaki Takahiro and Tom Lane
2011-02-20 14:06:59 -05:00
Tom Lane 472f608e43 One more hack to make contrib upgrades from 9.0 match fresh 9.1 installs.
intarray and tsearch2 both reference core support functions in their GIN
opclasses, and the signatures of those functions changed for 9.1.  We added
backwards-compatible pg_proc entries for the functions in order to allow
9.0 dump files to be restored at all, but that hack leaves the opclasses
pointing at pg_proc entries different from what they'd point to if the
contrib modules were installed fresh in 9.1.  To forestall any possibility
of future problems, fix the opclasses to match fresh installs via the
expedient of direct UPDATEs on pg_amproc in the update-from-unpackaged
scripts.  (Yech ... but the alternatives are worse, or require far more
effort than seems justified right now.)

Note: updating pg_amproc is sufficient because there will be no pg_depend
entries corresponding to these dependencies, since the referenced functions
are all pinned.
2011-02-18 11:55:57 -05:00
Tom Lane de623f3335 Fix upgrade of contrib/xml2 from 9.0.
Update script was being sloppy about two functions that have been changed
since 9.0.
2011-02-17 18:11:28 -05:00
Tom Lane 0024e34898 Fix upgrade of contrib/intarray and contrib/unaccent from 9.0.
Take care of a couple of discrepancies between what you get from a fresh
install and what the first-draft update-from-unpackaged scripts produced.
2011-02-17 17:45:09 -05:00
Tom Lane ec65a79db2 Fix upgrade of contrib/btree_gist from 9.0.
The initial version of the update-from-unpackaged script neglected to
include the <> operators that were added to the opclasses during 9.1.
To make this script produce the same final state as the regular install
script, use the same ALTER OPERATOR FAMILY trick as in pg_trgm.
2011-02-17 16:38:04 -05:00
Tom Lane 4eb49db7ae Fix contrib/pg_trgm to have smoother updates from 9.0.
Take care of some loose ends in the update-from-unpackaged script, and
apply some ugly hacks to ensure that it produces the same catalog state
as the fresh-install script.  Per discussion, this seems like a safer
plan than having two different catalog states that both call themselves
"pg_trgm 1.0", even if it's not immediately clear that the subtle
differences would ever matter.

Also, fix the stub function gin_extract_trgm() so that it works instead
of just bleating.  Needed because this function will get called during a
regular dump and reload, if there are any indexes using its opclass.
The user won't have an opportunity to update the extension till later,
so telling him to do so is unhelpful.
2011-02-17 15:04:33 -05:00
Robert Haas 24bc6b3db3 Remove rule to build sepgsql-regtest.pp.
Instead, document how to build it manually.

Per discussion.  KaiGai Kohei, with some wordsmithing by me.
2011-02-17 06:40:32 -05:00
Tom Lane 6595dd04d1 Add backwards-compatible declarations of some core GIN support functions.
These are needed to support reloading dumps of 9.0 installations containing
contrib/intarray or contrib/tsearch2.  Since not only regular dump/reload
but binary upgrade would fail, it seems worth the trouble to carry these
stubs for awhile.  Note that the contrib opclasses referencing these
functions will still work fine, since GIN doesn't actually pay any
attention to the declared signature of a support function.
2011-02-16 17:24:46 -05:00
Bruce Momjian 497e65f822 In pg_upgrade, no need to initialize global struct values; they are
always zeros.  Also no need to free memory before we exit.
2011-02-16 15:17:28 -05:00
Alvaro Herrera b4a7e5980b Cleanup ClusterInfo initialization in pg_upgrade 2011-02-16 14:06:17 -03:00
Bruce Momjian 1cc19cc358 Fix bug in 9.1 pg_upgrade processing of old/new relations; adjust debug
output.
2011-02-15 19:01:33 -05:00
Alvaro Herrera 8b2557553c Make pg_upgrade compile again 2011-02-15 19:52:32 -03:00
Bruce Momjian fe8f15d5d2 Adjust pg_upgrade error message, array freeing, and add error check. 2011-02-15 15:00:47 -05:00
Tom Lane f5fc1de501 Bring hstore's comment into line with style of other contrib comments.
All the other ones that are primarily a new datatype say "data type for
<purpose>", so make this one similar.
2011-02-15 14:21:45 -05:00
Tom Lane 74883d3373 Rethink naming of contrib/intagg extension.
Initially it was called int_aggregate after the old SQL file, but since
the documentation just says "intagg" and that's also the directory name,
let's conform to that instead.
2011-02-14 21:00:24 -05:00
Tom Lane de06cfe834 More fixups for "unpackaged" conversion scripts. 2011-02-13 23:33:18 -05:00
Tom Lane 3b61e57f3c Assorted fixups for "unpackaged" conversion scripts.
From first pass of testing.  Notably, there seems to be no need for
adminpack--unpackaged--1.0.sql because none of the objects that the
old module creates would ever be dumped by pg_dump anyway (they are
all in pg_catalog).
2011-02-13 22:54:53 -05:00
Tom Lane 029fac2264 Avoid use of CREATE OR REPLACE FUNCTION in extension installation files.
It was never terribly consistent to use OR REPLACE (because of the lack of
comparable functionality for data types, operators, etc), and
experimentation shows that it's now positively pernicious in the extension
world.  We really want a failure to occur if there are any conflicts, else
it's unclear what the extension-ownership state of the conflicted object
ought to be.  Most of the time, CREATE EXTENSION will fail anyway because
of conflicts on other object types, but an extension defining only
functions can succeed, with bad results.
2011-02-13 22:54:52 -05:00
Tom Lane 629b3af27d Convert contrib modules to use the extension facility.
This isn't fully tested as yet, in particular I'm not sure that the
"foo--unpackaged--1.0.sql" scripts are OK.  But it's time to get some
buildfarm cycles on it.

sepgsql is not converted to an extension, mainly because it seems to
require a very nonstandard installation process.

Dimitri Fontaine and Tom Lane
2011-02-13 22:54:49 -05:00
Bruce Momjian 0de0cc150a Properly handle Win32 paths of 'E:abc', which can be either absolute or
relative, by creating a function path_is_relative_and_below_cwd() to
check for specific requirements.  It is unclear if this fixes a security
problem or not but the new code is more robust.
2011-02-12 09:47:51 -05:00
Tom Lane 1214749901 Add support for multiple versions of an extension and ALTER EXTENSION UPDATE.
This follows recent discussions, so it's quite a bit different from
Dimitri's original.  There will probably be more changes once we get a bit
of experience with it, but let's get it in and start playing with it.

This is still just core code.  I'll start converting contrib modules
shortly.

Dimitri Fontaine and Tom Lane
2011-02-11 21:25:57 -05:00
Tom Lane caddcb8f4b Fix pg_upgrade to handle extensions.
This follows my proposal of yesterday, namely that we try to recreate the
previous state of the extension exactly, instead of allowing CREATE
EXTENSION to run a SQL script that might create some entirely-incompatible
on-disk state.  In --binary-upgrade mode, pg_dump won't issue CREATE
EXTENSION at all, but instead uses a kluge function provided by
pg_upgrade_support to recreate the pg_extension row (and extension-level
pg_depend entries) without creating any member objects.  The member objects
are then restored in the same way as if they weren't members, in particular
using pg_upgrade's normal hacks to preserve OIDs that need to be preserved.
Then, for each member object, ALTER EXTENSION ADD is issued to recreate the
pg_depend entry that marks it as an extension member.

In passing, fix breakage in pg_upgrade's enum-type support: somebody didn't
fix it when the noise word VALUE got added to ALTER TYPE ADD.  Also,
rationalize parsetree representation of COMMENT ON DOMAIN and fix
get_object_address() to allow OBJECT_DOMAIN.
2011-02-09 19:18:08 -05:00