Commit Graph

31083 Commits

Author SHA1 Message Date
Magnus Hagander 39e911e28a Reorder includes to unbreak MSVC 2011-01-23 22:44:07 +01:00
Heikki Linnakangas 7f508f1c6b Add 'directory' format to pg_dump. The new directory format is compatible
with the 'tar' format, in that untarring a tar format archive produces a
valid directory format archive.

Joachim Wieland and Heikki Linnakangas
2011-01-23 23:10:15 +02:00
Tom Lane f36920796e Fix another portability issue in pg_basebackup.
The target of sscanf with a %o format had better be of integer width,
but "mode_t" conceivably isn't that.  Another compiler warning seen
only on some platforms; this one I think is potentially a real bug
and not just a warning.
2011-01-23 14:26:51 -05:00
Tom Lane dd5f0db96b Improve getObjectDescription's display of pg_amop and pg_amproc entries.
Include the lefttype/righttype columns explicitly (instead of assuming
the reader can deduce them from the operator or function description),
and move the operator or function description to the end of the string,
to make it clearer that it's a referenced object and not the amop or
amproc item itself.  Per extensive discussion of Andreas Karlsson's
original patch.

Andreas Karlsson, Tom Lane
2011-01-23 14:13:46 -05:00
Tom Lane de3c2d6e92 Revert "Factor out functions responsible for caching I/O routines".
This reverts commit 740e54ca84, which seems
to have tickled an optimization bug in gcc 4.5.x, as reported upstream at
https://bugzilla.redhat.com/show_bug.cgi?id=671899
Since this patch had no purpose beyond code beautification, it's not
worth expending a lot of effort to look for another workaround.
2011-01-23 13:12:55 -05:00
Tom Lane 10e99f15d4 Add .gitignore file to silence complaints about pg_basebackup. 2011-01-23 13:07:34 -05:00
Tom Lane b3cfcdaad2 Suppress uninitialized-variable warning. 2011-01-23 13:06:38 -05:00
Andrew Dunstan 6c41cf5977 Silence flex warnings about DOS file paths in MSVC builds 2011-01-23 12:24:15 -05:00
Magnus Hagander d13e0975c9 Use pg_strcasecmp instead of strcasecmp for portability
Per buildfarm.
2011-01-23 17:35:02 +01:00
Magnus Hagander f88a638199 Only show pg_stat_replication details to superusers 2011-01-23 17:28:19 +01:00
Magnus Hagander fe12263c9f filemode is parsed on win32 even if never used
Per buildfarm failure.
2011-01-23 14:45:23 +01:00
Magnus Hagander 048d148fe6 Add pg_basebackup tool for streaming base backups
This tool makes it possible to do the pg_start_backup/
copy files/pg_stop_backup step in a single command.

There are still some steps to be done before this is a
complete backup solution, such as the ability to stream
the required WAL logs, but it's still usable, and
could do with some buildfarm coverage.

In passing, make the checkpoint request optionally
fast instead of hardcoding it.

Magnus Hagander, reviewed by Fujii Masao and Dimitri Fontaine
2011-01-23 12:21:23 +01:00
Robert Haas 6f59777c65 Code cleanup for assign_transaction_read_only.
As in commit fb4c5d2798 on 2011-01-21,
this avoids spurious debug messages and allows idempotent changes at
any time.  Along the way, make assign_XactIsoLevel allow idempotent
changes even when not within a subtransaction, to be consistent with
the new coding of assign_transaction_read_only and because there's
no compelling reason to do otherwise.

Kevin Grittner, with some adjustments.
2011-01-22 20:55:50 -05:00
Tom Lane cc73c16050 Quick hack to un-break plpython regression tests.
It's not clear to me what should happen to the other plpython_unicode
variant expected files, but this patch gets things passing on my own
machines and at least some of the buildfarm.
2011-01-22 20:43:54 -05:00
Tom Lane 0f73aae13d Allow the wal_buffers setting to be auto-tuned to a reasonable value.
If wal_buffers is initially set to -1 (which is now the default), it's
replaced by 1/32nd of shared_buffers, with a minimum of 8 (the old default)
and a maximum of the XLOG segment size.  The allowed range for manual
settings is still from 4 up to whatever will fit in shared memory.

Greg Smith, with implementation correction by me.
2011-01-22 20:31:24 -05:00
Tom Lane 518b1e96c0 Suppress "control reaches end of non-void function" warning from gcc 4.5.
Not sure why I'm seeing this on Fedora 14 and not earlier versions.
Seems like a regression that gcc no longer knows that DIE() doesn't return.
Still, adding a dummy return is harmless enough.
2011-01-22 18:01:31 -05:00
Tom Lane e2627258c3 Suppress possibly-uninitialized-variable warnings from gcc 4.5.
It appears that gcc 4.5 can issue such warnings for whole structs, not
just scalar variables as in the past.  Refactor some pg_dump code slightly
so that the OutputContext local variables are always initialized, even
if they won't be used.  It's cheap enough to not be worth worrying about.
2011-01-22 17:56:42 -05:00
Peter Eisentraut 116ce2f4d0 Get rid of the global variable holding the error state
Global error handling led to confusion and was hard to manage.  With
this change, errors from PostgreSQL are immediately reported to Python
as exceptions.  This requires setting a Python exception after
reporting the caught PostgreSQL error as a warning, because PLy_elog
destroys the Python exception state.

Ideally, all places where PostgreSQL errors need to be reported back
to Python should be wrapped in subtransactions, to make going back to
Python from a longjmp safe.  This will be handled in a separate patch.

Jan Urbański
2011-01-22 22:12:32 +02:00
Tom Lane 37eb2cd4ad More pg_test_fsync fixups.
Reduce #includes to minimum actually needed; in particular include
postgres_fe.h not postgres.h, so as to stop build failures on some
platforms.

Use get_progname() instead of hardwired program name; improve error
checking for command line syntax; bring error messages into line with
style guidelines; include strerror result in die() cases.
2011-01-22 15:01:26 -05:00
Tom Lane 3ae28ce8c4 Suppress unused-variables warning when OPEN_SYNC_FLAG isn't defined.
Per buildfarm.
2011-01-22 12:26:44 -05:00
Magnus Hagander f5a0fd2f3b Link libpgport into pg_test_fsync on msvc 2011-01-22 18:18:27 +01:00
Robert Haas a0c75f5539 Avoid treating WAL senders as normal backends.
The previous coding treated anything that wasn't an autovacuum launcher
as a normal backend, which is wrong now that we also have WAL senders.

Fujii Masao, reviewed by Robert Haas, Alvaro Herrera, Tom Lane,
and Bernd Helmle.
2011-01-21 22:23:01 -05:00
Robert Haas fb4c5d2798 Code cleanup for assign_XactIsoLevel.
The new coding avoids a spurious debug message when a transaction
that has changed the isolation level has been rolled back.  It also
allows the property to be freely changed to the current value within
a subtransaction.

Kevin Grittner, with one small change by me.
2011-01-21 21:49:19 -05:00
Tom Lane cb38ab6d3b More pg_test_fsync cleanup.
Un-break Windows build (I hope) by making the HAVE_FSYNC_WRITETHROUGH
code match the backend.  Fix incorrect program help message.  static-ize
all functions.
2011-01-21 19:44:53 -05:00
Tom Lane bc616703e8 Clean up pg_test_fsync commit.
Actually rename the program, rather than just claiming we did.  Hook it
into the build system.  Get rid of useless dependency on libpq.  Clean up
#include list and messy whitespace.
2011-01-21 19:27:25 -05:00
Tom Lane 0cf3db2175 Fix broken markup, also minor copy-editing. 2011-01-21 18:42:46 -05:00
Peter Eisentraut 4609caf364 Correctly add exceptions to the plpy module for Python 3
The way the exception types where added to the module was wrong for
Python 3.  Exception classes were not actually available from plpy.
Fix that by factoring out code that is responsible for defining new
Python exceptions and make it work with Python 3.  New regression test
makes sure the plpy module has the expected contents.

Jan Urbanśki, slightly revised by me
2011-01-21 23:46:56 +02:00
Robert Haas d3b372e92d Emphasize where OVER needs to be when using a window function.
Jeff Turner
2011-01-21 12:59:15 -05:00
Bruce Momjian 5925aa09a9 Update SGML docs to point to new /contrib/pg_test_fsync. 2011-01-21 12:52:16 -05:00
Bruce Momjian b35bfcae93 Update C banner on new pg_test_fsync file. 2011-01-21 12:49:04 -05:00
Bruce Momjian 606a3d54fc Move test_fsync to /contrib. 2011-01-21 12:47:54 -05:00
Heikki Linnakangas 8aea1373d8 Don't require usage privileges on the foreign data wrapper when creating a
foreign table. We check for usage privileges on the foreign server, that ought
to be enough.

Shigeru HANADA
2011-01-21 15:05:20 +02:00
Robert Haas 8ceb245680 Make ALTER TABLE revalidate uniqueness and exclusion constraints.
Failure to do so can lead to constraint violations.  This was broken by
commit 1ddc2703a9 on 2010-02-07, so
back-patch to 9.0.

Noah Misch.  Regression test by me.
2011-01-20 22:44:10 -05:00
Peter Eisentraut 14b9f69cb2 Fix wrong comment
Hitoshi Harada
2011-01-20 22:04:36 +02:00
Peter Eisentraut 81f79dbf2e Fix typo
Hitoshi Harada
2011-01-20 22:01:10 +02:00
Peter Eisentraut 740e54ca84 Factor out functions responsible for caching I/O routines
This makes PLy_procedure_create a bit more manageable.

Jan Urbański
2011-01-20 21:23:27 +02:00
Robert Haas 9c5e2c120b Add new psql command \dL to list languages.
Original patch by Fernando Ike, revived by Josh Kuperschmidt, reviewed by Andreas
Karlsson, and in earlier versions by Tom Lane and Peter Eisentraut.
2011-01-20 00:00:30 -05:00
Robert Haas 92f7eebbbd Document that WITH queries are also called Common Table Expressions.
Peter Geoghegan, reviewed by Stephen Frost
2011-01-19 21:19:53 -05:00
Tom Lane 357faea82e Show correct datatype for pg_class.relpersistence, plus a typo fix.
Thom Brown
2011-01-19 16:09:08 -05:00
Peter Eisentraut fbed5d4830 Add braces around an if block, for readability
Jan Urbański, reviewed by Peter Eisentraut, Álvaro Herrera, Tom Lane :-)
2011-01-19 21:56:21 +02:00
Peter Eisentraut 847e8c7783 Free plan values in the PLyPlanObject dealloc function
Jan Urbański
2011-01-19 00:10:19 +02:00
Peter Eisentraut 719461b7a2 Improve message for errors in compiling anonymous PL/Python blocks
The previous code would try to print out a null pointer.

Jan Urbański
2011-01-19 00:04:46 +02:00
Peter Eisentraut d9a95c0adb Use PyObject_New instead of PyObject_NEW
The latter is undocumented and the speed gain is negligible.

Jan Urbański
2011-01-18 23:53:10 +02:00
Peter Eisentraut 41282111e6 Skip dropped attributes when converting Python objects to tuples
Pay attention to the attisdropped field and skip over TupleDesc fields
that have it set.  Not a real problem until we get table returning
functions, but it's the right thing to do anyway.

Jan Urbański
2011-01-18 23:39:09 +02:00
Peter Eisentraut 59ea9ef9aa Use palloc in TopMemoryContext instead of malloc
As discussed, even if the PL needs a permanent memory location, it
should use palloc, not malloc.  It also makes error handling easier.

Jan Urbański
2011-01-18 23:27:53 +02:00
Peter Eisentraut 88047e59ba Fix an error when a set-returning function fails halfway through the execution
If the function using yield to return rows fails halfway, the iterator
stays open and subsequent calls to the function will resume reading
from it.  The fix is to unref the iterator and set it to NULL if there
has been an error.

Jan Urbański
2011-01-18 23:22:37 +02:00
Bruce Momjian 8995440e38 In test_fsync, adjust test headings to match wal_sync_method values;
add more test cases for open_sync of different sizes.
2011-01-18 15:53:55 -05:00
Tom Lane 1b393f4e5d Avoid detoast in texteq/textne/byteaeq/byteane for unequal-length strings.
We can get the length of a compressed or out-of-line datum without actually
detoasting it.  If the lengths of two strings are unequal, we can then
conclude they are unequal without detoasting.  That saves considerable work
in an admittedly less-common case, without costing anything much when the
optimization doesn't apply.

Noah Misch
2011-01-18 14:11:54 -05:00
Magnus Hagander 6e1726d082 Log replication connections only when log_connections is on
Previously we'd always log replication connections, with no
way to turn them off.
2011-01-18 20:02:25 +01:00
Heikki Linnakangas b1dc45c11d Fix thinko in comment. Spotted by Jim Nasby. 2011-01-18 10:46:13 +02:00