Commit Graph

3340 Commits

Author SHA1 Message Date
Magnus Hagander 3db963d760 Use the correct eventlog severity for error 2011-06-09 18:25:05 +02:00
Magnus Hagander 7e6ec04d96 Support silent mode for service registrations on win32
Using -s when registering a service will now suppress
the application eventlog entries stating that the service
is starting and started.

MauMau
2011-06-09 18:24:59 +02:00
Peter Eisentraut 1bcdd66315 Reorder pg_ctl promote after pg_ctl status
Since start/stop/restart/reload/status is a kind of standard command
set, it seems odd to insert the special-purpose "promote" in between
the closely related "restart" and "reload".  So put it after "status"
in code and documentation.

Put the documentation of the -U option in some sensible place.

Rewrite the synopsis sentence in help and documentation to make it
less of a growing mouthful.
2011-06-08 20:51:25 +03:00
Alvaro Herrera 135a507991 Revert psql bits to display NOT VALID for FKs
These are superseded by pg_get_constraintdef's ability to display the
same when appropriate, which is a better place to do it anyway.
2011-06-07 21:39:43 -04:00
Tom Lane 3c485ca8e6 Further improvements in pg_ctl's new wait-for-postmaster-start logic.
Add a postmaster_is_alive() test to the wait loop, so that we stop waiting
if the postmaster dies without removing its pidfile.  Unfortunately this
only helps after the postmaster has created its pidfile, since until then
we don't know which PID to check.  But if it never does create the pidfile,
we can give up in a relatively short time, so this is a useful addition
in practice.  Per suggestion from Fujii Masao, though this doesn't look
very much like his patch.

In addition, improve pg_ctl's ability to cope with pre-existing pidfiles.
Such a file might or might not represent a live postmaster that is going to
block our postmaster from starting, but the previous code pre-judged the
situation and gave up waiting immediately.  Now, we will wait for up to 5
seconds to see if our postmaster overwrites such a file.  This issue
interacts with Fujii's patch because we would make the wrong conclusion
if we did the postmaster_is_alive() test with a pre-existing PID.

All of this could be improved if we rewrote start_postmaster() so that it
could report the child postmaster's PID, so that we'd know a-priori the
correct PID to test with postmaster_is_alive().  That looks like a bit too
much change for so late in the 9.1 development cycle, unfortunately.
2011-06-01 13:09:07 -04:00
Peter Eisentraut 3001b76308 Suppress foreign data wrappers and foreign servers in partial dumps
This is consistent with the behavior of other global objects such as
languages and extensions.

Omitting foreign servers also omits the respective user mappings.
2011-05-30 23:34:34 +03:00
Alvaro Herrera 5177dfefc5 Make message more consistent 2011-05-30 12:43:14 -04:00
Peter Eisentraut 6fa79755bd Add pg_basebackup -z option for compression with default level 2011-05-30 01:02:02 +03:00
Peter Eisentraut d68714b29c Allow pg_basebackup compressed tar output to stdout 2011-05-29 01:18:17 +03:00
Peter Eisentraut 1b6dabc452 Avoid compiler warning when building without zlib 2011-05-29 01:18:16 +03:00
Tom Lane 0bae3bc9be Improve corner cases in pg_ctl's new wait-for-postmaster-startup code.
With "-w -t 0", we should report "still starting up", not "ok".  If we
fall out of the loop without ever being able to call PQping (because we
were never able to construct a connection string), report "no response",
not "ok".  This gets rid of corner cases in which we'd claim the server
had started even though it had not.

Also, if the postmaster.pid file is not there at any point after we've
waited 5 seconds, assume the postmaster has failed and report that, rather
than almost-certainly-fruitlessly continuing to wait.  The pidfile should
appear almost instantly even when there is extensive startup work to do,
so 5 seconds is already a very conservative figure.  This part is per a
gripe from MauMau --- there might be better ways to do it, but nothing
simple enough to get done for 9.1.
2011-05-27 14:13:38 -04:00
Tom Lane 7b158d1bae Suppress extensions in partial dumps.
We initially had pg_dump emit CREATE EXTENSION commands unconditionally.
However, pg_dump has long been in the habit of not dumping procedural
language definitions when a --schema or --table switch is given.  It seems
appropriate to handle extensions the same way, since like PLs they are SQL
objects that are not in any particular schema.  Per complaint from Adrian
Schreyer.
2011-05-25 16:27:22 -04:00
Peter Eisentraut 3439e40f9a Put options in some sensible order
For the --help output and reference pages of pg_dump, pg_dumpall,
pg_restore, put the options in some consistent, mostly alphabetical,
and consistent order, rather than newest option last or something like
that.
2011-05-25 21:53:26 +03:00
Peter Eisentraut c8d45152fa Message improvements 2011-05-24 21:35:06 +03:00
Peter Eisentraut c58b945e23 Message style improvements 2011-05-23 21:21:45 +03:00
Peter Eisentraut fae625e7b9 Message style improvements 2011-05-22 20:04:07 +03:00
Peter Eisentraut 8932e28100 Message improvement 2011-05-22 00:37:27 +03:00
Heikki Linnakangas 27c7875d95 In binary-upgrade mode, dump dropped attributes of composite types.
Noah Misch
2011-05-21 08:24:34 -04:00
Peter Eisentraut c8e0c32119 Rename pg_dump --no-security-label to --no-security-labels
Other similar options also use the plural form.
2011-05-19 23:20:11 +03:00
Magnus Hagander a937b07121 Add example for replication in pg_hba.conf
Selena Deckelmann
2011-05-19 14:03:15 -04:00
Tom Lane b3bc63efbc Fix pg_dump's handling of extension-member casts and languages.
pg_dump has some heuristic rules for whether to dump casts and procedural
languages, since it's not all that easy to distinguish built-in ones from
user-defined ones.  However, we should not apply those rules to objects
that belong to an extension, but just use the perfectly well-defined rules
for what to do with extension member objects.  Otherwise we might
mistakenly lose extension member objects during a binary upgrade (which is
the only time that we'd want to dump extension members).
2011-05-16 16:41:52 -04:00
Robert Haas 9bb6d97952 More cleanup of FOREIGN TABLE permissions handling.
This commit fixes psql, pg_dump, and the information schema to be
consistent with the backend changes which I made as part of commit
be90032e0d, and also includes a
related documentation tweak.

Shigeru Hanada, with slight adjustment.
2011-05-13 15:51:03 -04:00
Bruce Momjian 7ff7711919 For create/dropdb, only connect once to the server since we now have a
shared description table for pg_database comments.

Also update comments about database name selection.
2011-05-10 19:44:47 -04:00
Tom Lane 853c1750f9 Be more wary in initdb's creation of platform-dependent collations.
Discard any collation aliases that match the built-in pg_collation entries
(ie, "default", "C", "POSIX").  Such aliases would be refused by a CREATE
COLLATION command, but since initdb is injecting them via a simple INSERT,
it has to make the corresponding check for itself.  Per Martin Pitt's
report of funny behavior in a machine that had a bogus "C.UTF-8" locale.

Also, use E'' syntax for the output of escape_quotes, as per its header
comment.
2011-05-10 12:08:47 -04:00
Peter Eisentraut 7f1f1bfdbb Remove redundant port number check
pg_basebackup doesn't need to police the format of port numbers.
libpq already does that.
2011-05-04 21:02:02 +03:00
Peter Eisentraut bff074b1ab Message style cleanup 2011-05-04 20:56:52 +03:00
Peter Eisentraut ce2fc20071 Fix alignment of --help output
Tabs replaced by spaces.
2011-05-04 20:29:40 +03:00
Andrew Dunstan c02d5b7c27 Use a macro variable PG_PRINTF_ATTRIBUTE for the style used for checking printf type functions.
The style is set to "printf" for backwards compatibility everywhere except
on Windows, where it is set to "gnu_printf", which eliminates hundreds of
false error messages from modern versions of gcc arising from  %m and %ll{d,u}
formats.
2011-04-28 10:56:14 -04:00
Peter Eisentraut b2ef8929ae Fix binary upgrade of altered typed tables
Instead of dumping them as CREATE TABLE ... OF, dump them as normal
tables with the usual special processing for dropped columns, and then
attach them to the type afterward, using ALTER TABLE ... OF.  This is
analogous to the existing handling of inherited tables.
2011-04-27 22:11:09 +03:00
Magnus Hagander 6693eb72c0 timeline is not needed in BaseBackup()
This code was accidentally part of the patch, it's only
needed for the code that's for 9.2. Not needing the timeline
also removes the need to call IDENTIFY_SYSTEM.

Noted by Peter E.
2011-04-27 20:39:20 +02:00
Andrew Dunstan 860be17ec3 Assorted minor changes to silence Windows compiler warnings.
Mostly to do with macro redefinitions or object signedness.
2011-04-25 12:56:53 -04:00
Heikki Linnakangas 2b919118c2 Quotes in strings injected into bki file need to escaped. In particular,
"People's Republic of China" locale on Windows was causing initdb to fail.

This fixes bug #5818 reported by yulei. On master, this makes the mapping
of "People's Republic of China" to just "China" obsolete. In 9.0 and 8.4,
just fix the escaping. Earlier versions didn't have locale names in bki
file.
2011-04-20 09:59:52 +03:00
Tom Lane c29abc8b6f Fix assorted infelicities in collation handling in psql's describe.c.
In \d, be more careful to print collation only if it's not the default for
the column's data type.  Avoid assuming that the name "default" is magic.

Fix \d on a composite type so that it will print per-column collations.
It's no longer the case that a composite type cannot have modifiers.
(In consequence, the expected outputs for composite-type regression tests
change.)

Fix \dD so that it will print collation for a domain, again only if it's
not the same as the base type's collation.
2011-04-17 18:09:22 -04:00
Tom Lane acfa1f45ed Fix pg_dump to handle collations applied to columns of composite types.
CREATE TYPE and ALTER TYPE ADD ATTRIBUTE handle this, so I suppose it's
an intended feature, but pg_dump didn't know about it.
2011-04-17 16:55:04 -04:00
Tom Lane ff5565f0a4 Suppress unused-function warning on non-WIN32 builds. 2011-04-15 19:27:48 -04:00
Heikki Linnakangas d5a7bf8c11 setlocale() on Windows doesn't work correctly if the locale name contains
apostrophes or dots. There isn't much hope of Microsoft fixing it any time
soon, it's been like that for ages, so we better work around it. So, map a
few common Windows locale names known to cause problems to aliases that work.
2011-04-15 20:48:10 +03:00
Heikki Linnakangas 1f943dc8fe On Windows, if the encoding implied by locale is not allowed as a
server-encoding, fall back to UTF-8. It happens at least with the Chinese
locale, which implies BIG5. This is safe, because on Windows all locales
are compatible with UTF-8.
2011-04-15 20:48:00 +03:00
Peter Eisentraut 5caa3479c2 Clean up most -Wunused-but-set-variable warnings from gcc 4.6
This warning is new in gcc 4.6 and part of -Wall.  This patch cleans
up most of the noise, but there are some still warnings that are
trickier to remove.
2011-04-11 22:28:45 +03:00
Bruce Momjian bf50caf105 pgindent run before PG 9.1 beta 1. 2011-04-10 11:42:00 -04:00
Peter Eisentraut 11745364d0 Add collation support on Windows (MSVC build)
There is not yet support in initdb to populate the pg_collation
catalog, but if that is done manually, the rest should work.
2011-04-10 00:15:41 +03:00
Tom Lane 7c76906b7e Don't show unusable collations in psql's \dO command.
"Unusable" collations are those not matching the current database's
encoding.  The former behavior inconsistently showed such collations
some of the time, depending on the details of the pattern argument.
2011-04-09 14:08:41 -04:00
Robert Haas cba9cd4192 Make psql use pg_table_size instead of pg_relation_size on 9.0+ servers.
Per discussion, pg_table_size() is a more helpful number than
pg_relation_size().

Bernd Helmle, reviewed by Susanne Ebrecht and me.
2011-04-08 15:52:49 -04:00
Tom Lane d4c810d570 Modify initdb to complain only when no usable system locales are found.
Per discussion, the original behavior seems too noisy.  But if things
are so broken that none of the locales reported by "locale -a" are usable,
that's probably worth warning about.
2011-04-08 15:39:25 -04:00
Bruce Momjian 9c38bce29c Have pg_upgrade properly preserve relfrozenxid in toast tables.
This fixes a pg_upgrade bug that could lead to query errors when clog
files are improperly removed.
2011-04-08 11:46:34 -04:00
Tom Lane 1471a147f0 Fix SortTocFromFile() to cope with lines that are too long for its buffer.
The original coding supposed that a dump TOC file could never contain lines
longer than 1K.  The folly of that was exposed by a recent report from
Per-Olov Esgard.  We only really need to see the first dozen or two bytes
of each line, since we're just trying to read off the numeric ID at the
start of the line; so there's no need for a particularly huge buffer.
What there is a need for is logic to not process continuation bufferloads.

Back-patch to all supported branches, since it's always been like this.
2011-04-07 11:40:23 -04:00
Bruce Momjian 82a4f37073 Preserve pg_largeobject_metadata.relfrozenxid in pg_upgrade.
This is needed only in 9.1 because only 9.0 had this and no one is
upgrading from a 9.0 beta to 9.0 anymore.  We basically don't backpatch
9.0 beta fixes at this point.
2011-04-07 09:57:09 -04:00
Robert Haas e49ad77ff9 Tab completion for COMMENT ON FOREIGN DATA WRAPPER / SERVER. 2011-04-01 13:15:49 -04:00
Robert Haas dd095b623e pg_dump support for comments on FOREIGN DATA WRAPPER and SERVER objects.
Shigeru Hanada, with some corrections.
2011-04-01 11:41:07 -04:00
Greg Stark 7b66e2c086 fix up a couple non-prototypes of the form foo() to be foo(void) -- found using -Wstrict-prototypes 2011-03-27 21:31:41 +01:00
Tom Lane 5d1d679dbf Make initdb ignore locales for client-only encodings.
While putting such entries into pg_collation is harmless (since backends
will ignore entries that don't match the database encoding), it's also
useless.
2011-03-22 17:20:50 -04:00