Commit Graph

31277 Commits

Author SHA1 Message Date
Peter Eisentraut 2fd77060a2 Allow make check in PL directories
Also add make check-world target, and refactor pg_regress invocation
code in makefiles a bit.
2011-02-15 06:52:12 +02:00
Robert Haas 0d90dc16f8 Avoid a few more SET DATA TYPE table rewrites.
When the new type is an unconstrained domain over the old type, we don't
need to rewrite the table.

Noah Misch and Robert Haas
2011-02-14 23:40:05 -05:00
Robert Haas 8e1124eeeb Delete stray word from comment. 2011-02-14 22:38:08 -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
Simon Riggs 0ff1b73509 Additional required docs for pg_constraint catalog entry
Noted by Bernd Helmle
2011-02-15 00:59:29 +00:00
Simon Riggs 5c588be729 PITR can stop at a named restore point when recovery target = time
though must not update the last transaction timestamp.
Plus comment and message cleanup for recent named restore point.

Fujii Masao, minor changes by me
2011-02-15 00:51:39 +00:00
Tom Lane 01ff8dd756 Fix MSVC build scripts for recent extension-related changes.
Untested, but we'll soon see if the buildfarm likes this.
2011-02-14 19:45:46 -05:00
Tom Lane 555353c0c5 Rearrange extension-related views as per recent discussion.
The original design of pg_available_extensions did not consider the
possibility of version-specific control files.  Split it into two views:
pg_available_extensions shows information that is generic about an
extension, while pg_available_extension_versions shows all available
versions together with information that could be version-dependent.
Also, add an SRF pg_extension_update_paths() to assist in checking that
a collection of update scripts provide sane update path sequences.
2011-02-14 19:22:36 -05:00
Tom Lane cee103da14 Small improvements to external-projects documentation. 2011-02-14 19:22:34 -05:00
Simon Riggs f0b8a79c4b Add version-sensitive SQL for psql when constraints NOT VALID
Bug report and fix by Andres Freund
2011-02-15 00:08:15 +00:00
Tom Lane f1fb4b0e63 Fix obsolete references to old-style contrib installation methods. 2011-02-14 01:10:44 -05:00
Tom Lane 2ee69ff65d Remove no-longer-needed special case hacks in MSVC build scripts. 2011-02-13 23:42:57 -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
Tom Lane e693e97d75 Support replacing MODULE_PATHNAME during extension script file execution.
This avoids the need to find a way to make PGXS' .sql.in-to-.sql rule
insert the right thing.  We'll just deprecate use of that hack for
extensions.
2011-02-13 22:54:43 -05:00
Tom Lane 27d5d7ab10 Change the naming convention for extension files to use double dashes.
This allows us to have an unambiguous rule for deconstructing the names
of script files and secondary control files, without having to forbid
extension and version names from containing any dashes.  We do have to
forbid them from containing double dashes or leading/trailing dashes,
but neither restriction is likely to bother anyone in practice.
Per discussion, this seems like a better solution overall than the
original design.
2011-02-13 22:54:42 -05:00
Bruce Momjian 5569ae52ae Clarify documentation for libpq's PQescapeBytea to mention the new hex
format.

Modify PQescapeStringConn() docs to be consisent with other escaping
functions.

Add mention problems with pre-9.0 versions of libpq using not understanding
bytea hex format to the 9.0 release notes.

Backpatch to 9.0 docs.
2011-02-13 09:29:01 -05:00
Bruce Momjian cebbaa1d5d Back out libpq doc change; not ready yet. 2011-02-13 00:17:55 -05:00
Bruce Momjian 8e7af60872 Fix reverse 'if' test in path_is_relative_and_below_cwd(), per Tom. 2011-02-13 00:14:47 -05:00
Tom Lane 6c2e734f0a Refactor ALTER EXTENSION UPDATE to have cleaner multi-step semantics.
This change causes a multi-step update sequence to behave exactly as if the
updates had been commanded one at a time, including updating the "requires"
dependencies afresh at each step.  The initial implementation took the
shortcut of examining only the final target version's "requires" and
changing the catalog entry but once.  But on reflection that's a bad idea,
since it could lead to executing old update scripts under conditions
different than they were designed/tested for.  Better to expend a few extra
cycles and avoid any surprises.

In the same spirit, if a CREATE EXTENSION FROM operation involves applying
a series of update files, it will act as though the CREATE had first been
done using the initial script's target version and then the additional
scripts were invoked with ALTER EXTENSION UPDATE.

I also removed the restriction about not changing encoding in secondary
control files.  The new rule is that a script is assumed to be in whatever
encoding the control file(s) specify for its target version.  Since this
reimplementation causes us to read each intermediate version's control
file, there's no longer any uncertainty about which encoding setting would
get applied.
2011-02-12 16:40:41 -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
Peter Eisentraut b313bca0af DDL support for collations
- collowner field
- CREATE COLLATION
- ALTER COLLATION
- DROP COLLATION
- COMMENT ON COLLATION
- integration with extensions
- pg_dump support for the above
- dependency management
- psql tab completion
- psql \dO command
2011-02-12 15:55:18 +02:00
Robert Haas d31e2a495b Teach ALTER TABLE .. SET DATA TYPE to avoid some table rewrites.
When the old type is binary coercible to the new type and the using
clause does not change the column contents, we can avoid a full table
rewrite, though any indexes on the affected columns will still need
to be rebuilt.  This applies, for example, when changing a varchar
column to be of type text.

The prior coding assumed that the set of operations that force a
rewrite is identical to the set of operations that must be propagated
to tables making use of the affected table's rowtype.  This is
no longer true: even though the tuples in those tables wouldn't
need to be modified, the data type change invalidate indexes built
using those composite type columns.  Indexes on the table we're
actually modifying can be invalidated too, of course, but the
existing machinery is sufficient to handle that case.

Along the way, add some debugging messages that make it possible
to understand what operations ALTER TABLE is actually performing
in these cases.

Noah Misch and Robert Haas
2011-02-12 08:27:55 -05:00
Tom Lane 24d1280c4d Clean up installation directory choices for extensions.
Arrange for the control files to be in $SHAREDIR/extension not
$SHAREDIR/contrib, since we're generally trying to deprecate the term
"contrib" and this is a once-in-many-moons opportunity to get rid of it in
install paths.  Fix PGXS to install the $EXTENSION file into that directory
no matter what MODULEDIR is set to; a nondefault MODULEDIR should only
affect the script and secondary extension files.  Fix the control file
directory parameter to be interpreted relative to $SHAREDIR, to avoid a
surprising disconnect between how you specify that and what you set
MODULEDIR to.

Per discussion with David Wheeler.
2011-02-11 22:53:43 -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
Alvaro Herrera 60141eefaf Fix comment recently obsoleted 2011-02-11 19:42:51 -03:00
Robert Haas 5917574539 Allow tab-completion of :variable even as first word on a line.
Christoph Berg
2011-02-11 16:57:58 -05:00
Robert Haas d309acf201 Typo fixes. receivedUpto should be capitalized consistently. 2011-02-11 11:55:12 -05:00
Robert Haas 2c20ba1fd2 Tweak find_composite_type_dependencies API a bit more.
Per discussion with Noah Misch, the previous coding, introduced by
my commit 65377e0b9c on 2011-02-06,
was really an abuse of RELKIND_COMPOSITE_TYPE, since the caller in
typecmds.c is actually passing the name of a domain.  So go back
having a type name argument, but make the first argument a Relation
rather than just a string so we can tell whether it's a table or
a foreign table and emit the proper error message.
2011-02-11 08:47:38 -05:00
Alvaro Herrera 61cf7bcdf7 Fix isolation tester Makefile so that it runs in a VPATH build 2011-02-10 19:50:43 -03:00
Tom Lane 01467d3e4f Extend "ALTER EXTENSION ADD object" to permit "DROP object" as well.
Per discussion, this is something we should have sooner rather than later,
and it doesn't take much additional code to support it.
2011-02-10 17:37:22 -05:00
Alvaro Herrera 289d730655 Fix the isolation tester compilation on VPATH builds 2011-02-10 19:31:39 -03:00
Bruce Momjian 135724ec35 Fix "variable not used" warnings when USE_WIDE_UPPER_LOWER is not
defined.
2011-02-10 16:58:02 -05:00
Peter Eisentraut ff81aa3eda Update comment
It was still claiming that the keyword list is in keywords.c, when it
is now in kwlist.h.
2011-02-10 22:49:46 +02:00
Bruce Momjian 2432d10bf2 Fix pg_get_encoding_from_locale() function call parameters to match
prototype for cases where there is no multi-language support.
2011-02-10 15:39:41 -05:00
Heikki Linnakangas b186523fd9 Send status updates back from standby server to master, indicating how far
the standby has written, flushed, and applied the WAL. At the moment, this
is for informational purposes only, the values are only shown in
pg_stat_replication system view, but in the future they will also be needed
for synchronous replication.

Extracted from Simon riggs' synchronous replication patch by Robert Haas, with
some tweaking by me.
2011-02-10 21:04:02 +02:00
Magnus Hagander 4c468b37a2 Track last time for statistics reset on databases and bgwriter
Tracks one counter for each database, which is reset whenever
the statistics for any individual object inside the database is
reset, and one counter for the background writer.

Tomas Vondra, reviewed by Greg Smith
2011-02-10 15:14:04 +01:00
Magnus Hagander a2e61ec319 Use NOWAIT when including WAL in base backup
Avoids warning and waiting for the last segment to be
archived, which isn't necessary when we're including the
required WAL in the backup itself.
2011-02-10 12:11:23 +01:00
Heikki Linnakangas cecb5901b8 Allocate all entries in the serializable xid hash up-front, so that you don't
run out of shared memory when you try to assign an xid to a transaction.

Kevin Grittner
2011-02-10 12:03:21 +02:00
Andrew Dunstan 2ad0348677 Use correct name and URL for MinGW-w64, error noticed by Gurjeet Singh. 2011-02-10 04:47:32 -05:00
Tom Lane e617f0d7e4 Fix improper matching of resjunk column names for FOR UPDATE in subselect.
Flattening of subquery range tables during setrefs.c could lead to the
rangetable indexes in PlanRowMark nodes not matching up with the column
names previously assigned to the corresponding resjunk ctid (resp. tableoid
or wholerow) columns.  Typical symptom would be either a "cannot extract
system attribute from virtual tuple" error or an Assert failure.  This
wasn't a problem before 9.0 because we didn't support FOR UPDATE below the
top query level, and so the final flattening could never renumber an RTE
that was relevant to FOR UPDATE.  Fix by using a plan-tree-wide unique
number for each PlanRowMark to label the associated resjunk columns, so
that the number need not change during flattening.

Per report from David Johnston (though I'm darned if I can see how this got
past initial testing of the relevant code).  Back-patch to 9.0.
2011-02-09 23:27:42 -05:00
Itagaki Takahiro 5478f991c9 Fix typo in the documentation.
by Kevin Grittner
2011-02-10 10:58:18 +09: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
Peter Eisentraut 2e2d56fea9 Information schema views for collation support
Add the views character_sets, collations, and
collation_character_set_applicability.
2011-02-09 23:26:48 +02:00
Tom Lane 183d3cff85 Rethink order of operations for dumping extension member objects.
My original idea of doing extension member identification during
getDependencies() didn't work correctly: we have to mark member tables as
not-to-be-dumped rather earlier than that, else their subsidiary objects
like indexes get dumped anyway.  Rearrange code to mark them early enough.
2011-02-09 14:05:34 -05:00
Tom Lane 5bc178b89f Implement "ALTER EXTENSION ADD object".
This is an essential component of making the extension feature usable;
first because it's needed in the process of converting an existing
installation containing "loose" objects of an old contrib module into
the extension-based world, and second because we'll have to use it
in pg_dump --binary-upgrade, as per recent discussion.

Loosely based on part of Dimitri Fontaine's ALTER EXTENSION UPGRADE
patch.
2011-02-09 11:56:37 -05:00
Bruce Momjian 70802e0dbe Remove more SGML tabs. 2011-02-09 08:16:49 -05:00
Bruce Momjian ee4b67fcff Remove tabs in SGML file. 2011-02-09 08:15:38 -05:00