Commit Graph

16538 Commits

Author SHA1 Message Date
Tom Lane 2ad94d382c Fix problems with column name list of CREATE TABLE AS being applied to
the input query's target list too soon, causing it to affect processing
of ORDER BY in the input query.
2006-09-18 16:04:04 +00:00
Tom Lane 18a963778a Fix CREATE TABLE ... AS VALUES ... to work rather than Assert'ing;
oversight in original implementation of VALUES.  Also fix an oversight
in recent addition of options to CREATE TABLE AS: they weren't getting
propagated if the query was a set-operation such as UNION.
2006-09-18 00:52:14 +00:00
Tom Lane da7540b9d1 Change ANALYZE to take ShareUpdateExclusiveLock not AccessShareLock on
the table being analyzed.  This prevents two ANALYZEs from running
concurrently on the same table and possibly suffering concurrent-update
failures while trying to store their results into pg_statistic.  The
downside is that a database-wide ANALYZE executed within a transaction
block will hold ShareUpdateExclusiveLock on many tables simultaneously,
which could lead to concurrency issues or even deadlock against another
such ANALYZE.  However, this seems a corner case of less importance
than getting unexpected errors from a foreground ANALYZE when autovacuum
elects to analyze the same table concurrently.  Per discussion.
2006-09-17 22:50:31 +00:00
Tom Lane 2e5e856f6b Marginal cleanup in arrangements for ensuring StrategyHintVacuum is cleared
after an error during VACUUM.  We have a PG_TRY block anyway around the only
call sites, so just reset it in the CATCH clause instead of having
AtEOXact_Buffers blindly do it during xact end.  I think the old code was
actively wrong for the case of a failure during ANALYZE inside a
subtransaction --- the flag wouldn't get cleared until main transaction end.
Probably not worth back-patching though.
2006-09-17 22:16:22 +00:00
Tom Lane 5ff4f39c0e Rename the recently-added pg_timezonenames view to pg_timezone_abbrevs,
and create a new view pg_timezone_names that provides information about
the zones known in the 'zic' database.  Magnus Hagander, with some
additional work by Tom Lane.
2006-09-16 20:14:34 +00:00
Tom Lane 7ed5df437d Update timezone data files to release 2006k of the zic database. 2006-09-16 17:21:03 +00:00
Tom Lane 801cbe3310 Define errcode as __msvc_errcode not __vc_errcode for MSVC builds,
per Magnus.
2006-09-16 13:35:49 +00:00
Tom Lane 83078e9912 Several fixes for MSVC build scripts, from Magnus. 2006-09-15 21:42:02 +00:00
Tom Lane a22de540cf Fix some uses of str[n]casecmp that should be pg_str[n]casecmp,
per Magnus.
2006-09-15 21:34:23 +00:00
Tom Lane 0b52204f0d Remove WINLDAPAPI decoration from ldap_start_tls_sA typedef, per Magnus. 2006-09-15 21:28:08 +00:00
Tom Lane 0498a08e66 Improve confusing comment for HeapTupleSatisfiesNow, per gripe from Greg Stark. 2006-09-15 16:39:32 +00:00
Bruce Momjian fa6f9ceab6 Make postgresql.conf.sample match the initdb defaults. This fixes
comment alignment on most systems.
2006-09-14 23:21:47 +00:00
Tom Lane 65ab9f4f24 Add a couple of information functions to support direct checks on whether
a schema is our own temp schema or another backend's temp schema, and use
these in place of some former kluges in information_schema.  Per my
proposal of yesterday.
2006-09-14 22:05:06 +00:00
Teodor Sigaev deb66e013c Improve error message. Per discussion
http://archives.postgresql.org/pgsql-general/2006-09/msg00186.php
2006-09-14 11:26:49 +00:00
Michael Meskes 4eef745fb1 Cygwin systems seem to have a different error message when trying to connect to port 0. Let's try port 20 instead. 2006-09-14 08:46:58 +00:00
Michael Meskes 0f0d6765ce Added missing constuctor/destructor for interval and date. 2006-09-14 08:02:38 +00:00
Tom Lane 0b4bf8537f Make logging of extended-protocol commands a bit more consistent, per
discussion with Guillaume Smet.
2006-09-13 21:59:04 +00:00
Tom Lane 33d3ad4657 Code review for patch to avoid second scan when vacuuming index-less
table: avoid invoking LockBufferForCleanup without need, put out the
same log message we would have before, minor code beautification.
2006-09-13 17:47:08 +00:00
Michael Meskes 9c356a6b3e Seems this wasn't committed originally 2006-09-12 09:09:31 +00:00
Tom Lane 568b80168f Move set_pglocale_pgservice() from path.c to exec.c, so that pulling in
path.c does not in itself force linking of both exec.c and libintl.
Should fix current ecpglib build failure on pickier platforms.
2006-09-11 20:10:30 +00:00
Tom Lane 0bdc18d5d1 Add LDAP_LIBS_FE to $(libpq) for static or AIX linking, per Albe Laurenz. 2006-09-11 13:35:08 +00:00
Tom Lane bb87c7b551 Ooops, forgot to update ecpg comparison files to match
source-code change.
2006-09-11 02:50:07 +00:00
Tom Lane 1d0b7e71e3 Fix unportable usage complained of by icc. Per buildfarm results. 2006-09-11 01:41:35 +00:00
Bruce Momjian d18768867e Remove unnecessary brace pair. 2006-09-10 23:33:22 +00:00
Bruce Momjian 94cf48d72b Back out patch added during 8.2.X development:
Allow to_char() "D" format specifiers for interval/time.

It doesn't work, and I doubt it is useful enough to fix ("D" = day of
week).
2006-09-10 22:54:47 +00:00
Tom Lane 4ee24cbb55 Install a cleaner solution to the AIX libpq linking problem, as per
an earlier discussion.  Centralize assumptions about what libpq depends
on in one place in Makefile.global.  I am unconvinced that this list
is complete, but since ecpg seems to have gotten along with just these
entries, we'll try it this way and see what happens.
2006-09-10 22:07:02 +00:00
Tom Lane f5b4d9a9e0 If we're going to advertise the array overlap/containment operators,
we probably should make them work reliably for all arrays.  Fix code
to handle NULLs and multidimensional arrays, move it into arrayfuncs.c.
GIN is still restricted to indexing arrays with no null elements, however.
2006-09-10 20:14:20 +00:00
Tom Lane ba920e1c91 Rename contains/contained-by operators to @> and <@, per discussion that
agreed these symbols are less easily confused.  I made new pg_operator
entries (with new OIDs) for the old names, so as to provide backward
compatibility while making it pretty easy to remove the old names in
some future release cycle.  This commit only touches the core datatypes,
contrib will be fixed separately.
2006-09-10 00:29:35 +00:00
Tom Lane 42c17a6bb0 Revise OpenLDAP configuration and linking to work on more platforms
than before.  Albe Laurenz (but editorialized heavily by me, so if it
doesn't work it's my fault).
2006-09-09 03:15:40 +00:00
Tom Lane bf6b92d6e0 Fix pg_dump for recent change removing separate RULE privilege.
I had thought this code could be left alone, but I was wrong: as-is
it's failing to recognize when to use ALL for table privileges in 8.2.
2006-09-08 18:05:35 +00:00
Tom Lane d09e79deb9 Put back plan-time check for trying to apply SELECT FOR UPDATE/SHARE
to a relation on the nullable side of an outer join.  I had removed
this during the outer join planning rewrite a few months ago ... I think
I intended to put it somewhere else, but forgot ...
2006-09-08 17:49:13 +00:00
Tom Lane b59d31c215 Tweak the behavior of log_duration as proposed by Guillaume Smet: rather
than being equivalent to setting log_min_duration_statement to zero, this
option now forces logging of all query durations, but doesn't force logging
of query text.  Also, add duration logging coverage for fastpath function
calls.
2006-09-08 15:55:53 +00:00
Michael Meskes 0b33c56297 Not all C compilers understand the "//" comment in this test case, so I removed it. 2006-09-08 14:58:27 +00:00
Michael Meskes 460f46816a Replaced complex tests with small ones. 2006-09-08 13:32:29 +00:00
Michael Meskes 52a013bea8 More logic from complex/test* moved to their own testcases. 2006-09-08 09:03:40 +00:00
Tom Lane 893632be4e Clean up logging for extended-query-protocol operations, as per my recent
proposal.  Parameter logging works even for binary-format parameters, and
logging overhead is avoided when disabled.

log_statement = all output for the src/test/examples/testlibpq3.c example
now looks like

LOG:  statement: execute <unnamed>: SELECT * FROM test1 WHERE t = $1
DETAIL:  parameters: $1 = 'joe''s place'
LOG:  statement: execute <unnamed>: SELECT * FROM test1 WHERE i = $1::int4
DETAIL:  parameters: $1 = '2'

and log_min_duration_statement = 0 results in

LOG:  duration: 2.431 ms  parse <unnamed>: SELECT * FROM test1 WHERE t = $1
LOG:  duration: 2.335 ms  bind <unnamed> to <unnamed>: SELECT * FROM test1 WHERE t = $1
DETAIL:  parameters: $1 = 'joe''s place'
LOG:  duration: 0.394 ms  execute <unnamed>: SELECT * FROM test1 WHERE t = $1
DETAIL:  parameters: $1 = 'joe''s place'
LOG:  duration: 1.251 ms  parse <unnamed>: SELECT * FROM test1 WHERE i = $1::int4
LOG:  duration: 0.566 ms  bind <unnamed> to <unnamed>: SELECT * FROM test1 WHERE i = $1::int4
DETAIL:  parameters: $1 = '2'
LOG:  duration: 0.173 ms  execute <unnamed>: SELECT * FROM test1 WHERE i = $1::int4
DETAIL:  parameters: $1 = '2'

(This example demonstrates the folly of ignoring parse/bind steps for duration
logging purposes, BTW.)

Along the way, create a less ad-hoc mechanism for determining which commands
are logged by log_statement = mod and log_statement = ddl.  The former coding
was actually missing quite a few things that look like ddl to me, and it
did not handle EXECUTE or extended query protocol correctly at all.

This commit does not do anything about the question of whether log_duration
should be removed or made less redundant with log_min_duration_statement.
2006-09-07 22:52:01 +00:00
Bruce Momjian b6eab50ce4 Update pgcvslog comments. 2006-09-07 18:13:56 +00:00
Bruce Momjian a0e87ad7a5 Specify lo_write() to take a _const_ buffer, to match documentation. 2006-09-07 15:37:25 +00:00
Michael Meskes 803d9c39dd Changing a test case also changes the output that is expected.
Float/Long aliasing doesn't work on all architecures.
2006-09-07 11:18:47 +00:00
Michael Meskes 1d1868d97e Removed one output because integer/double usage differ 2006-09-07 08:15:58 +00:00
Bruce Momjian 8dc8f44f58 Update Emacs/vim editor info. 2006-09-07 00:10:46 +00:00
Tom Lane 5983a1aaa9 Change processing of extended-Query mode so that an unnamed statement
that has parameters is always planned afresh for each Bind command,
treating the parameter values as constants in the planner.  This removes
the performance penalty formerly often paid for using out-of-line
parameters --- with this definition, the planner can do constant folding,
LIKE optimization, etc.  After a suggestion by Andrew@supernews.
2006-09-06 20:40:48 +00:00
Bruce Momjian 6ca4ea8a80 Add interval division/multiplication regression tests.
Michael Glaesemann
2006-09-06 02:05:41 +00:00
Tom Lane 7bae5a289c Get rid of the separate RULE privilege for tables: now only a table's owner
can create or modify rules for the table.  Do setRuleCheckAsUser() while
loading rules into the relcache, rather than when defining a rule.  This
ensures that permission checks for tables referenced in a rule are done with
respect to the current owner of the rule's table, whereas formerly ALTER TABLE
OWNER would fail to update the permission checking for associated rules.
Removal of separate RULE privilege is needed to prevent various scenarios
in which a grantee of RULE privilege could effectively have any privilege
of the table owner.  For backwards compatibility, GRANT/REVOKE RULE is still
accepted, but it doesn't do anything.  Per discussion here:
http://archives.postgresql.org/pgsql-hackers/2006-04/msg01138.php
2006-09-05 21:08:36 +00:00
Tom Lane d5eb52a511 Make Gen_fmgrtab.sh locale-proof. Per report from Marko Kreen and
fix suggestion from Peter.
2006-09-05 19:18:13 +00:00
Teodor Sigaev 889ec4b998 Fix Intel compiler bug. Per discussion
'GIN FailedAssertions on Itanium2 with Intel compiler' in pgsql-hackers,
http://archives.postgresql.org/pgsql-hackers/2006-08/msg01914.php
2006-09-05 18:25:10 +00:00
Michael Meskes a3242fb42c Lost some changes yet again 2006-09-05 12:17:09 +00:00
Michael Meskes c9970d5948 Started to cleanup complex tests.
Added some interval checks to regression suite.
2006-09-05 12:11:03 +00:00
Michael Meskes 276b3bb3e3 Synced parser.
Fixed ecpglib trying to read one character after end-of-string.
Fixed port number setting in regression suite.
2006-09-05 10:00:53 +00:00
Bruce Momjian 786c3c0355 Fix imprecision from interval rounding of multiplication/division.
Bruce, Michael Glaesemann
2006-09-05 01:13:40 +00:00
Tom Lane 44839ac03e Fix information_schema.key_column_usage to show correct value of
position_in_unique_constraint (column newly added per SQL2003).
Greg Mullane
2006-09-04 23:13:01 +00:00
Bruce Momjian ed8969b187 Trivial patch to double vacuum speed on tables with no indexes (prevent
second scan of table).

Gregory Stark
2006-09-04 21:40:23 +00:00
Bruce Momjian c66939c4aa Add MSVC build tools.
Magnus Hagander
2006-09-04 21:30:40 +00:00
Tom Lane f8bbfad075 Disallow TRUNCATE when there are any pending after-trigger events for
the target relation(s).  There might be some cases where we could discard
the pending event instead, but for the moment a conservative approach
seems sufficient.  Per report from Markus Schiltknecht and subsequent
discussion.
2006-09-04 21:15:56 +00:00
Bruce Momjian 395c8166aa Sequences were not being shown due to the use of lowercase 's' instead
of 'S', and the views were not checking for table visibility with
regards to temporary tables and sequences.

Greg Sabino Mullane
2006-09-04 21:03:18 +00:00
Bruce Momjian 497f49a736 Remove trailing slash use in ecpg regression script; caused failures on
some platforms.
2006-09-04 19:36:21 +00:00
Tom Lane ad004ce787 Change ILIKE to invoke lower() and then do plain LIKE comparison when
working in a multibyte encoding.  This fixes the problems exhibited in
bug #1931 and other reports of ILIKE misbehavior in UTF8 encoding.
It's a pretty grotty solution though --- should rethink how to do it
after we install better locale support, someday.
2006-09-04 18:32:55 +00:00
Peter Eisentraut 6dc920de59 sslinfo contrib module - information about current SSL certificate
Author: Victor Wagner <vitus@cryptocom.ru>
2006-09-04 15:07:46 +00:00
Peter Eisentraut c8041474ee Add missing gettext calls for some SSL errors. 2006-09-04 14:57:27 +00:00
Tom Lane 57bfb27e60 Fix interval input parser so that fractional weeks and months are
cascaded first to days and only what is leftover into seconds.  This
seems to satisfy the principle of least surprise given the general
conversion to three-part interval values --- it was an oversight that
these cases weren't dealt with in 8.1.  Michael Glaesemann
2006-09-04 01:26:28 +00:00
Tom Lane 091fe03775 Code review for UPDATE SET (columnlist) patch. Make it handle as much
of the syntax as this fundamentally dead-end approach can, in particular
combinations of single and multi column assignments.  Improve rather
inadequate documentation and provide some regression tests.
2006-09-03 22:37:06 +00:00
Tom Lane 6ca09ad703 Suppress 'unused variable' warnings created by latest commit. 2006-09-03 19:30:43 +00:00
Tom Lane 8fad2e3ff4 Arrange for GetSnapshotData to copy live-subtransaction XIDs from the
PGPROC array into snapshots, and use this information to avoid visits
to pg_subtrans in HeapTupleSatisfiesSnapshot.  This appears to solve
the pg_subtrans-related context swap storm problem that's been reported
by several people for 8.1.  While at it, modify GetSnapshotData to not
take an exclusive lock on ProcArrayLock, as closer analysis shows that
shared lock is always sufficient.
Itagaki Takahiro and Tom Lane
2006-09-03 15:59:39 +00:00
Michael Meskes 246bd83811 Synced parser.
Added another regression test and fixed tcp test.
2006-09-03 12:24:08 +00:00
Bruce Momjian fc51c9186a Properly round months into days and into seconds for interval
multiplication/division queries like select '41 mon 10:00:00'::interval
/ 10 as "pos".

Report from Michael Glaesemann
2006-09-03 03:34:04 +00:00
Bruce Momjian 0e20c48561 Revert FETCH/MOVE int64 patch. Was using incorrect checks for
fetch/move in scan.l.
2006-09-03 03:19:45 +00:00
Bruce Momjian 1d4abf2175 Fix case where "PM" to_timestamp() mask was eating too many characters.
Report from Josh Tolley.
2006-09-03 01:22:56 +00:00
Bruce Momjian 754c7d53a4 Fix LLONG_MAX define used by new int64 FETCH/MOVE patch. 2006-09-03 01:15:40 +00:00
Bruce Momjian b0e5468448 Remove unnecessary copyObject() call in update (values) code. 2006-09-03 00:46:41 +00:00
Bruce Momjian e0938c3f5b Make autovacuum behavior more agressive, per discussion on hackers list
--- was part of autovacuum default 'on' patch that was reverted, but we
want this part.

Peter Eisentraut
2006-09-02 23:12:16 +00:00
Bruce Momjian 946abc7c68 Update postgresql.conf line for default superuser_reserved_connections. 2006-09-02 23:08:36 +00:00
Bruce Momjian 1a84952670 Change "superuser_reserved_connections" default to 3, because of
possible autovacuum use.
2006-09-02 23:04:20 +00:00
Bruce Momjian 1cc9299a7a Small code cleanup for recent UPDATE SET (values) patch. 2006-09-02 20:52:01 +00:00
Bruce Momjian 6e8596a146 Add UPDATE tab SET ROW (col, ...) = (val, ...) for updating
multiple columns

Susanne Ebrecht
2006-09-02 20:34:47 +00:00
Bruce Momjian 6c785d599d Change FETCH/MOVE to use int8.
Dhanaraj M
2006-09-02 18:17:18 +00:00
Bruce Momjian 87eb130ad8 Revert as not needed/inconsistent with SQL REINDEX:
Suppress some NOTICE messages from REINDEX command.

  Euler Taveira de Oliveira
2006-09-02 17:10:17 +00:00
Bruce Momjian e35ea516a4 Remove GUC_REPORT for new "server_version_num" GUC variable. Added
overhead for every connection, per Tom.
2006-09-02 17:08:10 +00:00
Tom Lane 917bbebf7f Apply a simple solution to the problem of making INSERT/UPDATE/DELETE
RETURNING play nice with views/rules.  To wit, have the rule rewriter
rewrite any RETURNING clause found in a rule to produce what the rule's
triggering query asked for in its RETURNING clause, in particular drop
the RETURNING clause if no RETURNING in the triggering query.  This
leaves the responsibility for knowing how to produce the view's output
columns on the rule author, without requiring any fundamental changes
in rule semantics such as adding new rule event types would do.  The
initial implementation constrains things to ensure that there is
exactly one, unconditionally invoked RETURNING clause among the rules
for an event --- later we might be able to relax that, but for a post
feature freeze fix it seems better to minimize how much invention we do.
Per gripe from Jaime Casanova.
2006-09-02 17:06:52 +00:00
Bruce Momjian 04912899e7 Add new variable "server_version_num", which is almost the same as
"server_version" but uses the handy PG_VERSION_NUM which allows apps to
do things like if ($version >= 80200) without having to parse apart the
value of server_version themselves.

Greg Sabino Mullane greg@turnstep.com
2006-09-02 13:12:50 +00:00
Bruce Momjian 819f22a302 Allow PL/python to return composite types and result sets
Sven Suursoho
2006-09-02 12:30:01 +00:00
Bruce Momjian 5e33d6df36 Suppress some NOTICE messages from REINDEX command.
Euler Taveira de Oliveira
2006-09-02 02:43:07 +00:00
Tom Lane a83c71eb24 Clean up rather sloppy fix in HEAD for the ancient bug that CREATE CONVERSION
didn't create a dependency from the new conversion to its schema.  Back-patch
to all supported releases.
2006-08-31 17:31:33 +00:00
Peter Eisentraut 4c0bd228fa Repair interpretation of GB as MB. 2006-08-31 15:10:51 +00:00
Bruce Momjian c23be34a25 Attibution addition: Add Karel Zak also for COPY SELECT. 2006-08-31 03:17:50 +00:00
Bruce Momjian d22164d4c4 Correct attibution:
COPY SELECT work done by Zoltan Boszormenyi
2006-08-31 00:35:32 +00:00
Tom Lane 85188ab883 Extend COPY to support COPY (SELECT ...) TO ...
Bernd Helmle
2006-08-30 23:34:22 +00:00
Bruce Momjian 0d5065781d Update logging of prepare/execute syntax, per comments from Guillaume Smet. 2006-08-30 18:22:02 +00:00
Tom Lane 3a6e2ff08a Fix things so that fopen's, not only open's, pass FILE_SHARE_DELETE
and other special flags on Windows.  May fix intermittent 'Permission
denied' errors.  Magnus Hagander
2006-08-30 18:06:27 +00:00
Tom Lane f6d7ef08a7 Dept. of second thoughts: if query fails part way through, shut down
the pager before reporting the error.
2006-08-29 22:48:55 +00:00
Tom Lane c2f60711d2 Create a FETCH_COUNT parameter that causes psql to execute SELECT-like
queries via a cursor, fetching a limited number of rows at a time and
therefore not risking exhausting memory.  A disadvantage of the scheme
is that 'aligned' output mode will align each group of rows independently
leading to odd-looking output, but all the other output formats work
reasonably well.  Chris Mair, with some additional hacking by moi.
2006-08-29 22:25:08 +00:00
Bruce Momjian 7c5ac5ce22 Separate prepared statement and bind parameters with comma.
Fix printing of NULL bind parameters, use "NULL".
2006-08-29 20:10:42 +00:00
Teodor Sigaev f7efd4ea66 Fix mistyping 2006-08-29 15:47:48 +00:00
Tom Lane 0434c46db0 Invent an assign-hook mechanism for psql variables similar to the one
existing for backend GUC variables, and use this to eliminate repeated
fetching/parsing of psql variables in psql's inner loops.  In a trivial
test with lots of 'select 1;' commands, psql's CPU time went down almost
10%, although of course the effect on total elapsed time was much less.
Per discussion about how to ensure the upcoming FETCH_COUNT patch doesn't
cost any performance when not being used.
2006-08-29 15:19:51 +00:00
Teodor Sigaev b681bfdd59 Fix BUG #2594: Gin Indexes cause server to crash when it builds on empty table 2006-08-29 14:05:44 +00:00
Michael Meskes cda6d0a8d3 Second try committing the path changes. 2006-08-29 13:23:27 +00:00
Michael Meskes 67135eb1ef Removed debug option from pg_regress call.
Changed file paths in expected files too.
2006-08-29 12:33:45 +00:00
Michael Meskes b1710339ba Fixed parser and library to allow empty database names.
Streamlined connection name parsing.
Added Joachim's patch to shorten paths before diffing.
2006-08-29 12:24:52 +00:00
Peter Eisentraut ba9f9bf1b1 Revert change to turn autovacuum on by default. 2006-08-29 11:37:47 +00:00
Bruce Momjian f443258d4f Only call log_after_parse() if necessary. 2006-08-29 02:32:41 +00:00
Bruce Momjian bc24d5b976 Now bind displays prepare as detail, and execute displays prepare and
optionally bind.  I re-added the "statement:" label so people will
understand why the line is being printed (it is log_*statement
behavior).

Use single quotes for bind values, instead of double quotes, and double
literal single quotes in bind values (and document that).  I also made
use of the DETAIL line to have much cleaner output.
2006-08-29 02:11:30 +00:00
Tom Lane 1832cefda1 Fix pgstat_report_waiting() to not dump core if called before
pgstat_bestart() has been called; else any lock-block occurring
during InitPostgres() is disastrous.  I believe this explains
recent wasp regression failure; at least it explains the crash I
got while trying to duplicate the problem.  I also made
pgstat_report_activity() safe against the same scenario, just
in case.  The report_waiting hazard was created by my patch of
19-Aug to include waiting status in pg_stat_activity.
2006-08-28 19:38:09 +00:00
Tom Lane ae28cfe673 Partial fix for ecpg's VPATH problems. It compiles and successfully
builds all the files needed for its regression tests, but the tests
themselves fail because of diffs in the #line directives output by
ecpg itself.  Not sure what to do about that.
2006-08-28 16:13:11 +00:00
Tom Lane fcba3b82e2 Tweak trivial_subqueryscan() to consider a SubqueryScan's targetlist
trivial if it contains either Vars referencing the corresponding subplan
columns, or Consts equaling the corresponding subplan columns.  This
lets the planner eliminate the SubqueryScan in some cases generated by
generate_setop_tlist().
2006-08-28 14:32:41 +00:00
Peter Eisentraut 88b8110443 Turn autovacuum on by default. (stats_row_level is also on by default.)
Threshold and scale factor are cut in half for more aggressive behavior.
2006-08-28 13:37:18 +00:00
Tom Lane ea2e263539 Add new return codes SPI_OK_INSERT_RETURNING etc to the SPI API.
Fix all the standard PLs to be able to return tuples from FOO_RETURNING
statements as well as utility statements that return tuples.  Also,
fix oversight that SPI_processed wasn't set for a utility statement
returning tuples.  Per recent discussion.
2006-08-27 23:47:58 +00:00
Tom Lane 7a2fe85b03 Add some notes about why it's not a bug that RI_FKey_check calls
HeapTupleSatisfiesItself without doing LockBuffer first.  This code
is a bit fragile, but AFAICS it's not actually broken.
2006-08-27 21:41:21 +00:00
Tom Lane e06fda0a8b Add a function GetLockConflicts() to lock.c to report xacts holding
locks that would conflict with a specified lock request, without
actually trying to get that lock.  Use this instead of the former ad hoc
method of doing the first wait step in CREATE INDEX CONCURRENTLY.
Fixes problem with undetected deadlock and in many cases will allow the
index creation to proceed sooner than it otherwise could've.  Per
discussion with Greg Stark.
2006-08-27 19:14:34 +00:00
Tom Lane ca1fd0ea5b Move xact.c's partial support for Lists of TransactionIds into pg_list.h.
Needed because lock.c is now going to use the same type of list.
2006-08-27 19:11:46 +00:00
Michael Meskes 99a5619e7b - Enabled single-quoted connection targets.
- Fixed a memory leak/segfault in unsuccessful connection.
- Some changes to test files.
2006-08-27 16:15:42 +00:00
Tom Lane 162e8f1fd5 Make saveHistory work properly on OS X when HISTFILE is set to /dev/null.
Per discussion with Martin Atukunda.
2006-08-27 15:05:20 +00:00
Michael Meskes 445a61297e Changed double output. 2006-08-26 11:50:00 +00:00
Tom Lane e093dcdd28 Add the ability to create indexes 'concurrently', that is, without
blocking concurrent writes to the table.  Greg Stark, with a little help
from Tom Lane.
2006-08-25 04:06:58 +00:00
Michael Meskes e96df81b17 Synced parser 2006-08-24 12:31:33 +00:00
Michael Meskes 8d9cf79437 Needed more stuff from c.h. 2006-08-24 10:48:21 +00:00
Michael Meskes e8d1dcbfde Fixed of by one variable size. 2006-08-24 10:35:58 +00:00
Michael Meskes b7d5a88dbb Need more defines in ecpg_config.h, patch sent by Rocco Altier <RoccoA@Routescape.com> 2006-08-24 09:37:07 +00:00
Tom Lane f836c2e37e Add some debug logging code to AllocateFile's failure path to log the
specific Windows error code (GetLastError).  This is a hopefully temporary
hack to try to diagnose rare failures.  Magnus Hagander
2006-08-24 03:15:43 +00:00
Tom Lane 08ae5edc5c Optimize the case where a btree indexscan has current and mark positions
on the same index page; we can avoid data copying as well as buffer refcount
manipulations in this common case.  Makes for a small but noticeable
improvement in mergejoin speed.

Heikki Linnakangas
2006-08-24 01:18:34 +00:00
Michael Meskes a6558b068d Somehow my version compiled but the change didn't make it to CVS. 2006-08-23 13:57:27 +00:00
Michael Meskes 02c3cdbaad Argh, forgot the new file yet again. 2006-08-23 12:51:26 +00:00
Michael Meskes 9bade3ff84 Replaced double-quote-fix with a hopefully better version.
Use initializer string length as size for character strings.
Added ecpg_config.h file that is created via configure.
2006-08-23 12:01:53 +00:00
Michael Meskes 54f5527606 Descriptor values were quoted twice.
Fixed some regression test problems.
2006-08-22 12:46:18 +00:00
Bruce Momjian a3132359fd In new "invalid byte sequence" error hint, call it "error", not
"failure".
2006-08-22 12:11:28 +00:00
Bruce Momjian e11cab650c Add hint for "invalid byte sequence for encoding" error message,
suggesting review of client_encoding.
2006-08-22 03:30:20 +00:00
Tom Lane daebd5257c Ooops, ldap fix for win32 broke the non-win32 case. 2006-08-22 02:23:45 +00:00
Tom Lane 5405576a22 Fix encrypted-LDAP support so that it doesn't cause the server to fail
entirely on older Windows platforms without the needed library function.
Magnus Hagander
2006-08-21 19:21:38 +00:00
Tom Lane d7c310c1fa Minor code rearrangement to save a few cycles in RI_FKey_check when
the subject tuple is already deleted: we need not open the pk_rel
until after we check that.
2006-08-21 19:15:29 +00:00
Tom Lane 35af5422f6 Make the server track an 'XID epoch', that is, maintain higher-order bits
of the transaction ID counter.  Nothing is done with the epoch except to
store it in checkpoint records, but this provides a foundation with which
add-on code can pretend that XIDs never wrap around.  This is a severely
trimmed and rewritten version of the xxid patch submitted by Marko Kreen.
Per discussion, the epoch counter seems the only part of xxid that really
needs to be in the core server.
2006-08-21 16:16:31 +00:00
Michael Meskes 333bc29fcb Fixed a few memory leaks. One indeed was part of a loop. 2006-08-21 10:48:21 +00:00
Tom Lane 2b2a50722c Fix all known problems with pg_dump's handling of serial sequences
by abandoning the idea that it should say SERIAL in the dump.  Instead,
dump serial sequences and column defaults just like regular ones.
Add a new backend command ALTER SEQUENCE OWNED BY to let pg_dump recreate
the sequence-to-column dependency that was formerly created "behind the
scenes" by SERIAL.  This restores SERIAL to being truly "just a macro"
consisting of component operations that can be stated explicitly in SQL.
Furthermore, the new command allows sequence ownership to be reassigned,
so that old mistakes can be cleaned up.

Also, downgrade the OWNED-BY dependency from INTERNAL to AUTO, since there
is no longer any very compelling argument why the sequence couldn't be
dropped while keeping the column.  (This forces initdb, to be sure the
right kinds of dependencies are in there.)

Along the way, add checks to prevent ALTER OWNER or SET SCHEMA on an
owned sequence; you can now only do this indirectly by changing the
owning table's owner or schema.  This is an oversight in previous
releases, but probably not worth back-patching.
2006-08-21 00:57:26 +00:00
Alvaro Herrera df18c51f29 Fix DROP OWNED BY to correctly consider the implicitly-deleted objects list for
each object to be deleted, instead of the previous hack that just skipped
INTERNAL dependencies, which didn't really work.  Per report from Tom Lane.

To do this, introduce a new performMultipleDeletions entry point in
dependency.c to delete multiple objects at once.  The dependency code then has
the responsability of tracking INTERNAL and AUTO dependencies as needed.

Along the way, change ObjectAddresses so that we can allocate an ObjectAddress
list from outside dependency.c and not have to export the internal
representation.
2006-08-20 21:56:16 +00:00
Michael Meskes 4e23d6e07d Fixed a few trivial memory leaks reported by Coverity just to test my setup. 2006-08-20 16:08:09 +00:00
Michael Meskes fc19744e58 Added another test 2006-08-19 15:10:00 +00:00
Michael Meskes 84844bab2c More SoC stuff 2006-08-19 13:42:40 +00:00
Tom Lane fb9e56eea1 Suppress subquery pullup/pushdown when a subquery contains volatile
functions in its targetlist, to avoid introducing multiple evaluations
of volatile functions that textually appear only once.  This is a
slightly tighter version of Jaime Casanova's recent patch.
2006-08-19 02:48:53 +00:00
Tom Lane 9bf760f7de Add a 'waiting' column to pg_stat_activity to carry the same information
that ps_status provides by appending 'waiting' to the PS display.  This
completes the project of making it feasible to turn off process title
updates and instead rely on pg_stat_activity.  Per my suggestion a few
weeks ago.
2006-08-19 01:36:34 +00:00
Tom Lane 9a8920e1d7 Add PQdescribePrepared, PQdescribePortal, and related functions to libpq
to allow obtaining information about previously prepared statements and
open cursors.  Volkan Yazici
2006-08-18 19:52:39 +00:00
Michael Meskes 46d61eb218 Fixed a buffer overrun that was masked on Linux systems. 2006-08-18 16:30:53 +00:00
Tom Lane 7aa772f03e Now that we've rearranged relation open to get a lock before touching
the rel, it's easy to get rid of the narrow race-condition window that
used to exist in VACUUM and CLUSTER.  Did some minor code-beautification
work in the same area, too.
2006-08-18 16:09:13 +00:00
Michael Meskes e91600d1c2 Changed lexer to no longer use the default rule.
Synced parser and keyword list.
Fixed parsing of CONNECT statement so it accepts a C string again.
2006-08-18 15:59:35 +00:00
Bruce Momjian 63b71c3229 Update Win32 CMD quoting rules information location, CMD /?, from
Magnus.
2006-08-18 15:47:08 +00:00
Tom Lane e8ea9e9587 Implement archive_timeout feature to force xlog file switches to occur no more
than N seconds apart.  This allows a simple, if not very high performance,
means of guaranteeing that a PITR archive is no more than N seconds behind
real time.  Also make pg_current_xlog_location return the WAL Write pointer,
add pg_current_xlog_insert_location to return the Insert pointer, and fix
pg_xlogfile_name_offset to return its results as a two-element record instead
of a smashed-together string, as per recent discussion.

Simon Riggs
2006-08-17 23:04:10 +00:00
Tom Lane 92c651f8b3 Fix an oversight in mergejoin planning: the planner would reject a
mergejoin possibility where the inner rel was less well sorted than
the outer (ie, it matches some but not all of the merge clauses that
can work with the outer), if the inner path in question is also the
overall cheapest path for its rel.  This is an old bug, but I'm not
sure it's worth back-patching, because it's such a corner case.
Noted while investigating a test case from Peter Hardman.
2006-08-17 17:06:37 +00:00
Tom Lane 144b0ae8ee Teach convert_subquery_pathkeys() to handle the case where the
subquery's pathkey is a RelabelType applied to something that appears
in the subquery's output; for example where the subquery returns a
varchar Var and the sort order is shown as that Var coerced to text.
This comes up because varchar doesn't have its own sort operator.
Per example from Peter Hardman.
2006-08-17 17:02:49 +00:00
Peter Eisentraut b2281fcd3a Put probes.o file in right directory, fixes dtrace compilation 2006-08-16 14:57:37 +00:00
Tom Lane d6ac61cd64 Seems some C compilers think 'restrict' is a fully reserved word.
Per buildfarm results from warthog.
2006-08-16 04:32:49 +00:00
Tom Lane 1395ac6c67 Add a hack so that get_type_io_data() can work from bootstrap.c's
internal TypInfo table in bootstrap mode.  This allows array_in and
array_out to be used during early bootstrap, which eliminates the
former obstacle to giving OUT parameters to built-in functions.
2006-08-15 22:36:17 +00:00
Tom Lane 355865c5a7 Add hooks to allow debugging and performance measurement plugins
to instrument PL/pgSQL.  Korry Douglas
2006-08-15 19:01:17 +00:00
Tom Lane abc3120e9b Add server support for "plugin" libraries that can be used for add-on tasks
such as debugging and performance measurement.  This consists of two features:
a table of "rendezvous variables" that allows separately-loaded shared
libraries to communicate, and a new GUC setting "local_preload_libraries"
that allows libraries to be loaded into specific sessions without explicit
cooperation from the client application.  To make local_preload_libraries
as flexible as possible, we do not restrict its use to superusers; instead,
it is restricted to load only libraries stored in $libdir/plugins/.  The
existing LOAD command has also been modified to allow non-superusers to
LOAD libraries stored in this directory.

This patch also renames the existing GUC variable preload_libraries to
shared_preload_libraries (after a suggestion by Simon Riggs) and does some
code refactoring in dfmgr.c to improve clarity.

Korry Douglas, with a little help from Tom Lane.
2006-08-15 18:26:59 +00:00
Michael Meskes 2834fb6a83 Fixed a typo and made two mallocs Coverity friendly. 2006-08-15 12:46:25 +00:00
Michael Meskes 4a445f5d97 Sorry, forgot the new files. 2006-08-15 06:48:24 +00:00
Michael Meskes b30da7ba5f Added lots of SoC stuff made by Joachim.
Fixed broken newline on Windows.
Fixed a nasty buffer underrun that only occured when using Informix
no_indicator NULL setting on timestamps and intervals.
2006-08-15 06:40:20 +00:00
Tom Lane 58538a0ffc Cause '*' and 'foo.*' notations to mark the referenced RTE(s) as
requiring read permissions.  Up till now there was no possible case
in which the RTEs wouldn't already have ACL_SELECT set ... but now that
you can say something like 'INSERT INTO foo ... RETURNING *' this is
an essential step.  With this commit, a RETURNING clause adds the
requirement for SELECT permissions on the target table if and only if
the clause actually reads the value of at least one target-table column.
2006-08-14 23:39:32 +00:00
Tom Lane 65b2f93b58 Fix oversight in initial implementation of PORTAL_ONE_RETURNING mode: we
cannot assume that there's exactly one Query in the Portal, as we can for
ONE_SELECT mode, because non-SELECT queries might have extra queries added
during rule rewrites.  Fix things up so that we'll use ONE_RETURNING mode
when a Portal contains one primary (canSetTag) query and that query has
a RETURNING list.  This appears to be a second showstopper reason for running
the Portal to completion before we start to hand anything back --- we want
to be sure that the rule-added queries get run too.
2006-08-14 22:57:15 +00:00
Tom Lane 3d1e01caa4 Support INSERT/UPDATE/DELETE RETURNING in plpgsql, with rowcount checking
as per yesterday's proposal.  Also make things a tad more orthogonal by
adding the recent STRICT addition to EXECUTE INTO.
Jonah Harris and Tom Lane
2006-08-14 21:14:42 +00:00
Tom Lane 29fa051316 When executing a list of queries derived from rule expansion,
_SPI_execute_plan's return code should reflect the type of the query
that is marked canSetTag, not necessarily the last one in the list.

This is arguably a bug fix, but I'm hesitant to back-patch it because
it's the sort of subtle change that might break someone's code, and it's
best not to do that kind of thing in point releases.
2006-08-14 13:40:18 +00:00
Tom Lane c859294ca2 Remove hash_destroy calls in hash_create's failure paths. As noted by
a Coverity warning, these are risky since the hashtable isn't necessarily
fully set up yet.  They're unnecessary anyway: a deletable hashtable
should be in a memory context that will be cleared following elog(ERROR).
Per report from Martijn van Oosterhout.
2006-08-14 12:39:55 +00:00
Bruce Momjian f058451871 Revert (again) GUC patch to return commented fields to their default
values, due to concern about the patch.
2006-08-14 02:27:27 +00:00
Tom Lane 3648147401 Get rid of "lookahead" functionality in plpgsql's yylex() function,
and instead make the grammar production for the RETURN statement do the
heavy lifting.  The lookahead idea was copied from the main parser, but
it does not work in plpgsql's parser because here gram.y looks explicitly
at the scanner's yytext variable, which will be out of sync after a
failed lookahead step.  A minimal example is

create or replace function foo() returns void language plpgsql as '
begin
  perform return foo bar;
end';

which can be seen by testing to deliver "foo foo bar" to the main parser
instead of the expected "return foo bar".  This isn't a huge bug since
RETURN is not found in the main grammar, but it could bite someone who
tried to use "return" as an identifier.

Back-patch to 8.1.  Bug exists further back, but HEAD patch doesn't apply
cleanly, and given the lack of field complaints it doesn't seem worth
the effort to develop adjusted patches.
2006-08-14 00:46:53 +00:00
Tom Lane 1b67e0cc52 Fix core dump in duration logging for a V3-protocol Execute message
when what's being executed is a COMMIT or ROLLBACK.  Per report from
Sergey Koposov.  Backpatch to 8.1; 8.0 and before don't have the bug
due to lack of any logging at all here.
2006-08-13 22:18:08 +00:00
Tom Lane b475d25f6c Cause psql to report both the returned data and the command status tag
for INSERT/UPDATE/DELETE RETURNING.  Per discussion.
2006-08-13 21:10:04 +00:00
Tom Lane fbc7f59bfe If test postmaster fails to start within 60 seconds, try to kill -9 it
so that it won't interfere with later trials.  Per recent buildfarm
experience.  Anyone know how to do this on Windows?
2006-08-13 20:39:07 +00:00
Tom Lane a1dad99c63 Extend 'guc' regression test to check manipulations of datestyle as
well as vacuum_cost_delay.  Since datestyle is a string variable,
this exercises memory allocation issues that might not appear when
modifying an integer GUC variable.  Also, we can observe the side
effects of changing datestyle to check that assign hooks are called
at the right times.
2006-08-13 19:31:06 +00:00
Tom Lane d2ccc707af Original coding of 'returning' regression test inadvertently chose a
nonunique join value, leading to plan-choice-dependent results ... and
it seems some platforms will choose a different plan.  Tweak the test
so that it has well-defined results.  Per report from Olivier Prenant.
2006-08-13 17:58:49 +00:00
Bruce Momjian 12cf0fdf19 Back out plperl OUT hash/array parameter patch, again. 2006-08-13 17:31:10 +00:00
Bruce Momjian e0d6630bd8 Fix recent guc comment-to-default patch for custom variables. 2006-08-13 15:37:02 +00:00
Michael Meskes ab6aa40b64 Applied patch for VPATH builds by Alvaro Herrera <alvherre@commandprompt.com>
Merged dyntest.pgc and dyntest2.pgc.
Hopefully fixed the last Coverity reports (finally)
2006-08-13 10:18:31 +00:00
Bruce Momjian b5633943cb Re-apply plperl patch that allows OUT parameters to be placed into Perl
hash and array variables.  (regression output updated)
2006-08-13 02:37:11 +00:00
Bruce Momjian f09fb71af9 Recommit patch to allow commented GUC variables to return to their
default values.
2006-08-13 02:22:24 +00:00
Bruce Momjian e7da38bf31 Re-apply guc cleanup patch, with memory allocation bugs fixed. 2006-08-13 01:30:17 +00:00
Tom Lane 3f8db37c2f Tweak SPI_cursor_open to allow INSERT/UPDATE/DELETE RETURNING; this was
merely a matter of fixing the error check, since the underlying Portal
infrastructure already handles it.  This in turn allows these statements
to be used in some existing plpgsql and plperl contexts, such as a
plpgsql FOR loop.  Also, do some marginal code cleanup in places that
were being sloppy about distinguishing SELECT from SELECT INTO.
2006-08-12 20:05:56 +00:00
Tom Lane 883f4b42d7 Remove ancient, obsolete comment. 2006-08-12 18:58:54 +00:00
Bruce Momjian 4178de3d43 Back out patch for plperl to handle OUT paramaters into arrays and
hashes.  Was causing regression failures.
2006-08-12 04:16:45 +00:00
Bruce Momjian fb55af227e Back out patch to reorganize guc processing. Was causing regression
failures.
2006-08-12 04:12:41 +00:00
Bruce Momjian 2d2eec6ef2 Back out patch that allowed commented guc variables to return to their
default values.  Was causing regression failures.
2006-08-12 04:11:50 +00:00
Tom Lane 7a3e30e608 Add INSERT/UPDATE/DELETE RETURNING, with basic docs and regression tests.
plpgsql support to come later.  Along the way, convert execMain's
SELECT INTO support into a DestReceiver, in order to eliminate some ugly
special cases.

Jonah Harris and Tom Lane
2006-08-12 02:52:06 +00:00
Bruce Momjian 5c9e9c0c42 Set Win32 server-size socket buffer to 32k, for performance reasons.
Yoshiyuki Asaba
2006-08-11 20:44:20 +00:00
Bruce Momjian 262a7bc14c Allow commenting of variables in postgresql.conf to restore them to
defaults.

Zdenek Kotala
2006-08-11 20:15:16 +00:00
Bruce Momjian f91ddb768b Refactor GUC set_config_option function:
The main reason for refactoring was that set_config_option() was too
overloaded function and its behavior did not consistent. Old version of
set_config_function hides some messages. For example if you type:

tcp_port = 5432.1

then old implementation ignore this error without any message to log
file in the signal context (configuration reload). Main problem was that
semantic analysis of postgresql.conf is not perform in the
ProcessConfigFile function, but in the set_config_options *after*
context check. This skipped check for variables with PG_POSTMASTER
context. There was request from Joachim Wieland to add more messages
about ignored changes in the config file as well.

Zdenek Kotala
2006-08-11 20:08:28 +00:00
Bruce Momjian c07fbcf577 plperl:
Allow conversion from perl to postgresql array in OUT parameters. Second,
allow hash form output from procedures with one OUT argument.

Pavel Stehule
2006-08-11 19:42:35 +00:00
Bruce Momjian 33bf73a79a Make the psql line counter 64-bit so it can handle files > 4gig lines.
David Fetter
2006-08-11 19:20:59 +00:00
Tom Lane 0ee26100b6 Fix UNION/INTERSECT/EXCEPT so that when two inputs being merged have
same data type and same typmod, we show that typmod as the output
typmod, rather than generic -1.  This responds to several complaints
over the past few years about UNIONs unexpectedly dropping length or
precision info.
2006-08-10 02:36:29 +00:00
Bruce Momjian e860e746e1 Return inline to win32.h because code was OK, but keep additional
comment.  8.1.X is not affected by this commit.
2006-08-10 01:41:29 +00:00
Bruce Momjian 3929b6e9f6 Move "#define inline __inline" from port/win32.h to c.h because Win32
interface builds like libpq need it.

Backpatch addition to 8.1.X.
2006-08-10 01:35:21 +00:00
Bruce Momjian a4f14fd109 Fix display of log duration so it is milliseconds.microseconds "ms".
Greg Sabino Mullane
2006-08-10 00:44:01 +00:00
Tom Lane 0bf9d3a59e Fix inadequate makefile-fu in ecpg regression tests. I think this
will fix current platypus build failure.
2006-08-09 22:48:17 +00:00
Bruce Momjian 6a7d3d093e Round microseconds on setitimer upwards. 2006-08-09 21:18:13 +00:00
Bruce Momjian 0553a0507c On Win32, make minimum setitimer() sleep be 1ms, so sleeps < 1ms aren't
rounded down to zero.

Backpatch to 8.1.X.
2006-08-09 20:40:56 +00:00
Bruce Momjian 8f73c88c7c Fix statement_timeout on Win32 so that it properly treats micro-seconds
as micro-seconds, rather than as 100 microseconds, as it does now.  This
actually fixes all setitimer calls on Win32, but statement_timeout is
the most visible fix.

Backpatch to 8.1.X.  8.0 works as documented.
2006-08-09 17:47:03 +00:00
Bruce Momjian f896b5e146 Formatting improvement. 2006-08-09 17:33:52 +00:00
Michael Meskes e6e61afe16 Fixed some memory bugs that somehow reappeared.
Also fixed a new Coverity report.
2006-08-09 09:08:32 +00:00
Michael Meskes 7c9e2c75da Fixed error handling in numeric conversion (Joachim).
Further regression cleanup.
2006-08-09 07:30:56 +00:00
Bruce Momjian 8a7a6afe2d Suppress MSVC warnings about weak functions by using
_CRT_SECURE_NO_DEPRECATE.

Hiroshi Saito
2006-08-09 03:09:56 +00:00
Bruce Momjian 9d5d87a5db Fix win32.mak for config cleanup.
Hiroshi Saito
2006-08-08 22:44:05 +00:00
Tom Lane 644e3fe368 Fix 'make clean' for change of regression.diffs file name. 2006-08-08 19:43:11 +00:00
Tom Lane b09bfcaa57 Add a feature for automatic initialization and finalization of dynamically
loaded libraries: call functions _PG_init() and _PG_fini() if the library
defines such symbols.  Hence we no longer need to specify an initialization
function in preload_libraries: we can assume that the library used the
_PG_init() convention, instead.  This removes one source of pilot error
in use of preloaded libraries.  Original patch by Ralf Engelschall,
preload_libraries changes by me.
2006-08-08 19:15:09 +00:00
Bruce Momjian c554bf878f Fix definition of "errcode" for MSVC.
Hiroshi Saito
2006-08-08 18:49:14 +00:00
Michael Meskes 79a1a2ec6b Cleaned up log output a little bit more. 2006-08-08 15:30:39 +00:00
Michael Meskes 6e11202dbe Made parser check for valid copy to/from stdin/stdout combinations.
Lots of small changes in regression test suite
2006-08-08 11:51:25 +00:00
Bruce Momjian 3716f90c39 For protocol-level prepare/bind/execute:
o  print user name for all
	o  print portal name if defined for all
	o  print query for all
	o  reduce log_statement header to single keyword
	o  print bind parameters as DETAIL if text mode
2006-08-08 01:23:15 +00:00
Tom Lane 2dd7ab0627 Put back another improperly-removed #include. 2006-08-07 21:56:25 +00:00
Tom Lane 2dc7c88c2e On some platforms, pg_usleep isn't interruptible by signals; fix
archiver to behave per original coder's expectation on these machines.
We already know this everywhere else AFAICT.
2006-08-07 17:41:42 +00:00
Tom Lane e002836913 Make recovery from WAL be restartable, by executing a checkpoint-like
operation every so often.  This improves the usefulness of PITR log
shipping for hot standby: formerly, if the standby server crashed, it
was necessary to restart it from the last base backup and replay all
the WAL since then.  Now it will only need to reread about the same
amount of WAL as the master server would.  The behavior might also
come in handy during a long PITR replay sequence.  Simon Riggs,
with some editorialization by Tom Lane.
2006-08-07 16:57:57 +00:00
Michael Meskes 977ac90001 Joachim fixed some bugs in numeric handling in pgtypeslib.
Fixed and cleaned up some regression tests. Also added a new one.
2006-08-07 13:17:02 +00:00
Tom Lane 23dc308245 Tweak sanity_check regression test to display more tables (viz, those
without indexes) but not to display temp tables.  It's a bit hard to
credit that sanity_check could get through a database-wide VACUUM
while the preceding create_index test is still trying to clean up
its temp tables ... but I see no other explanation for the current
failure report from buildfarm member sponge.
2006-08-06 04:35:21 +00:00
Tom Lane 704ddaaa09 Add support for forcing a switch to a new xlog file; cause such a switch
to happen automatically during pg_stop_backup().  Add some functions for
interrogating the current xlog insertion point and for easily extracting
WAL filenames from the hex WAL locations displayed by pg_stop_backup
and friends.  Simon Riggs with some editorialization by Tom Lane.
2006-08-06 03:53:44 +00:00
Bruce Momjian c0dc166adc Use better named loop variable for large loop, rather than 'i'. 2006-08-06 02:00:52 +00:00
Tom Lane 635d42e9c3 Fix inheritance_planner() to delete dummy subplans from its Append plan
list, when some of the child rels have been excluded by constraint
exclusion.  This doesn't save a huge amount of time but it'll save some,
and it makes the EXPLAIN output look saner.  We already did the
equivalent thing in set_append_rel_pathlist(), but not here.
2006-08-05 17:21:52 +00:00
Michael Meskes 1d28bf2589 Two more changes to regression tests to fix two differences in different setups. 2006-08-05 16:48:48 +00:00
Tom Lane 5f789c5ead Extend relation_excluded_by_constraints() to check for mutually
contradictory WHERE-clauses applied to a relation.  This makes the
GUC variable constraint_exclusion rather inappropriately named,
but I've refrained for the moment from renaming it.
Per example from Martin Lesser.
2006-08-05 00:22:49 +00:00
Tom Lane 6357f4ea72 Teach predicate_refuted_by() how to do proofs involving NOT-clauses.
This doesn't matter too much for ordinary NOTs, since prepqual.c does
its best to get rid of those, but it helps with IS NOT TRUE clauses
which the rule rewriter likes to insert.  Per example from Martin Lesser.
2006-08-05 00:21:14 +00:00
Bruce Momjian 3f23f4eec8 Add some blank lines for formatting. 2006-08-04 22:20:06 +00:00
Tom Lane c68489863c Fix domain_in() bug exhibited by Darcy Buskermolen. The idea of an EState
that's shorter-lived than the expression state being evaluated in it really
doesn't work :-( --- we end up with fn_extra caches getting deleted while
still in use.  Rather than abandon the notion of caching expression state
across domain_in calls altogether, I chose to make domain_in a bit cozier
with ExprContext.  All we really need for evaluating variable-free
expressions is an ExprContext, not an EState, so I invented the notion of a
"standalone" ExprContext.  domain_in can prevent resource leakages by doing
a ReScanExprContext on this rather than having to free it entirely; so we
can make the ExprContext have the same lifespan (and particularly the same
per_query memory context) as the expression state structs.
2006-08-04 21:33:36 +00:00
Bruce Momjian bf7b205e16 #ifdef fix for MSVC builds of libpq.
Hiroshi Saito
2006-08-04 18:58:33 +00:00
Bruce Momjian c8961bf1ce Improve logging of protocol-level prepared statements. 2006-08-04 18:53:46 +00:00
Bruce Momjian ad269d5e3b Fix bug in new pg_dump -T/-N handling that was dumping system schemas if
these options were used before -n/-t.
2006-08-04 18:32:15 +00:00
Tom Lane 6db6714ffc Remove redeclaration of struct sqlca_t --- unnecessary and provokes
warnings on some compilers.
2006-08-04 16:54:05 +00:00
Tom Lane 3467758809 Fix missing 'static' keywords --- some compilers gripe about this. 2006-08-04 16:42:56 +00:00
Tom Lane 5d844d3271 'make clean' must remove the create subdirectories results/ and log/,
not merely remove their contents.  Else 'cvs update' complains.
2006-08-04 14:18:09 +00:00
Tom Lane e2d34d75e7 Teach eval_const_expressions to simplify BooleanTest nodes that have
constant input.  Seems worth doing because rule rewriter inserts
IS NOT TRUE tests into WHERE clauses.
2006-08-04 14:09:51 +00:00
Michael Meskes 3ceaa97b3c Regression test updates and fixes 2006-08-04 08:52:18 +00:00
Bruce Momjian 9ac2f2e8ea Add missing ecpg function prototype needed when in threaded mode ---
supresses compiler warning.
2006-08-04 03:23:37 +00:00
Tom Lane c82264291e Add some basic tests of GUC behavior.
Joachim Wieland
2006-08-04 00:00:14 +00:00
Tom Lane 7946f77220 Cause ALTER TABLE to perform ALTER COLUMN DROP DEFAULT operations during
the DROP pass rather than the ADD_CONSTR pass.  On examining the code I
think this was just an oversight rather than intentional, and it seems
to satisfy the principle of least surprise better than the alternative
solution that was discussed.  Add an example to the ref page showing how
to do ALTER TYPE and update the default in one command.  Per gripe from
Markus Bertheau that that wasn't possible.
2006-08-03 20:57:06 +00:00
Tom Lane 89c07b18a6 Remove use of a regex character class in resultmap (for freebsd version
check).  This isn't supported by pg_regress since the recent rewrite
into C.  While we could add char classes to pg_regress.c's code, it's
not really needed at the moment: thanks to Andrew's patch to make
pg_regress always accept the 'standard' comparison file, we can just
drop the version check.
2006-08-03 17:04:00 +00:00
Tom Lane f5b78fa51f Fix AfterTriggerExecute() to pass tg_trigtuple and tg_newtuple as NULLs
rather than pointers to garbage, when calling AFTER STATEMENT triggers.
Michael Fuhr
2006-08-03 16:04:41 +00:00
Tom Lane bc8ac3ce40 Add missing pgstat_count_index_scan(), per Andreas Seltenreich. 2006-08-03 15:22:09 +00:00
Tom Lane d841cc44c5 A few regression tests for VALUES, from Gavin Sherry. 2006-08-03 14:54:44 +00:00
Michael Meskes 4b8378a671 Removed compiler warnings 2006-08-03 14:50:11 +00:00
Michael Meskes 27458bb4fa Applied test suite update by Joachim Wieland <joe@mcknight.de>. 2006-08-03 13:11:04 +00:00
Bruce Momjian 961ec0ce9c Move 'ddl' right after 'none' in postgresql.conf. It used to be between
'mod' and 'all', which is not the right order.  SGML documentation order
was correct. Report from Chander Ganesan.
2006-08-02 21:48:43 +00:00
Bruce Momjian f1fa94a415 Fix logic to prevent pg_dump from dumping system schemas; bug introduced
in recent -t/-n/-T/-N patch.

Small style cleanups.
2006-08-02 21:43:43 +00:00
Andrew Dunstan 959aee5bbf remove extraneous space after -L flag. 2006-08-02 19:02:34 +00:00
Tom Lane 0dfb595d7a Arrange for ValuesScan to keep per-sublist expression eval state in a
temporary context that can be reset when advancing to the next sublist.
This is faster and more thorough at recovering space than the previous
method; moreover it will do the right thing if something in the sublist
tries to register an expression context callback.
2006-08-02 18:58:21 +00:00
Michael Meskes efc861a842 And finally the Makefiles 2006-08-02 14:19:14 +00:00
Tom Lane e79aed7cba Wups, got the test for contain_vars_of_level-not-needed wrong in
transformInsertStmt: the target table is already in p_rtable at that point.
2006-08-02 14:14:22 +00:00
Michael Meskes 1f0a6cd60c Hopefully that's it. The remaining files for ecpg regression tests. 2006-08-02 14:14:04 +00:00
Tom Lane 6392518c69 Add a HINT per suggestion from Michael Glaesemann. Also, tweak OLD/NEW
test to avoid expensive contain_vars_of_level() scan in the normal case
where we're not inside a rule.
2006-08-02 13:58:52 +00:00
Michael Meskes b737f85e84 Some more regression test files 2006-08-02 13:53:45 +00:00
Michael Meskes 2682a4c01d One more file to remove 2006-08-02 13:52:11 +00:00
Michael Meskes 36e8d4e780 Removed old test files 2006-08-02 13:51:32 +00:00
Michael Meskes 1fa6be6f69 ynced parser and keyword list.
Implemented EXEC SQL UNDEF.
Applied first version of the regression test patch by Joachim Wieland <joe@mcknight.de>.
2006-08-02 13:43:23 +00:00
Joe Conway 9caafda579 Add support for multi-row VALUES clauses as part of INSERT statements
(e.g. "INSERT ... VALUES (...), (...), ...") and elsewhere as allowed
by the spec. (e.g. similar to a FROM clause subselect). initdb required.
Joe Conway and Tom Lane.
2006-08-02 01:59:48 +00:00
Bruce Momjian d307c428cb Fix bug I introduced while cleaning up pg_dump -t/-n patch. 2006-08-01 21:05:00 +00:00
Bruce Momjian 2c6d96cef6 Add support for loadable modules to allocated shared memory and
lightweight locks.

Marc Munro
2006-08-01 19:03:11 +00:00
Bruce Momjian c61607bd52 Add pg_dump -X no-data-for-failed-tables option to suppress loading data
if table creation failed (the table already exists).

Martin Pitt
2006-08-01 18:21:44 +00:00
Bruce Momjian 8977b68a42 Allow multiple -n (schema) and -t (table) pg_dump options, and add -T
and -N options to exclude objects.  Also support regular expressions for
option object names.

Greg Sabino Mullane
2006-08-01 18:05:04 +00:00
Bruce Momjian 9a4eaa9440 Remove extra argument to printf(). 2006-08-01 18:01:36 +00:00
Andrew Dunstan a3bae60813 have pg_regress fall back on testing with the canonical results file if an
alternative test is specified but none succeeds.
2006-08-01 14:56:29 +00:00
Tom Lane 09d3670df3 Change the relation_open protocol so that we obtain lock on a relation
(table or index) before trying to open its relcache entry.  This fixes
race conditions in which someone else commits a change to the relation's
catalog entries while we are in process of doing relcache load.  Problems
of that ilk have been reported sporadically for years, but it was not
really practical to fix until recently --- for instance, the recent
addition of WAL-log support for in-place updates helped.

Along the way, remove pg_am.amconcurrent: all AMs are now expected to support
concurrent update.
2006-07-31 20:09:10 +00:00