Commit Graph

7544 Commits

Author SHA1 Message Date
Neil Conway 4744c1a0a1 Complete the following TODO items:
* Add session start time to pg_stat_activity
* Add the client IP address and port to pg_stat_activity

Original patch from Magnus Hagander, code review by Neil Conway. Catalog
version bumped. This patch sends the client IP address and port number in
every statistics message; that's not ideal, but will be fixed up shortly.
2005-05-09 11:31:34 +00:00
Tom Lane 30f540be43 Repair very-low-probability race condition between relation extension
and VACUUM: in the interval between adding a new page to the relation
and formatting it, it was possible for VACUUM to come along and decide
it should format the page too.  Though not harmful in itself, this would
cause data loss if a third transaction were able to insert tuples into
the vacuumed page before the original extender got control back.
2005-05-07 21:32:24 +00:00
Tom Lane b72e5fa17b Adjust time qual checking code so that we always check TransactionIdIsInProgress
before we check commit/abort status.  Formerly this was done in some paths
but not all, with the result that a transaction might be considered
committed for some purposes before it became committed for others.
Per example found by Jan Wieck.
2005-05-07 21:22:01 +00:00
Tom Lane 4cd4ed0cc2 Fix case in which a debug printout would print already-pfreed data. 2005-05-07 18:14:25 +00:00
Bruce Momjian 3adba41a3c Add comment on C locale test for upper/lower/initcap(). 2005-05-07 15:18:17 +00:00
Bruce Momjian b63990c6a8 Add COPY WITH CVS HEADER to allow a heading line as the first line in
COPY.

Andrew Dunstan
2005-05-07 02:22:49 +00:00
Tom Lane 278bd0cc22 For some reason access/tupmacs.h has been #including utils/memutils.h,
which is neither needed by nor related to that header.  Remove the bogus
inclusion and instead include the header in those C files that actually
need it.  Also fix unnecessary inclusions and bad inclusion order in
tsearch2 files.
2005-05-06 17:24:55 +00:00
Bruce Momjian acc4f3e3cb Update comment to mention "Name classification hierarchy" as place to
check for reserved words.
2005-05-06 03:42:17 +00:00
Bruce Momjian 902338e06d Convert some mulit-line comments in copy.c to single line, as appropriate. 2005-05-06 02:56:42 +00:00
Tom Lane fba2a104c6 Marginal performance improvements in dynahash: make sure that everything
associated with a hashtable is allocated in that hashtable's private
context, so that hash_destroy only has to destroy the context and not
do any retail pfree's; and tighten the inner loop of hash_seq_search.
2005-05-06 00:19:14 +00:00
Tom Lane 6f1ca7e457 Fix bogus hashtable setup. (This code has quite a few other problems
too, but that one is in my way at the moment.)
2005-05-05 22:18:27 +00:00
Tom Lane c2e729fa20 Make standalone backends ignore pg_database.datallowconn, so that there
is a way to recover from disabling connections to all databases at once.
2005-05-05 19:53:26 +00:00
Tom Lane db70a31294 Adjust nodeBitmapIndexscan to keep the target index opened from plan
startup to end, rather than re-opening it in each MultiExecBitmapIndexScan
call.  I had foolishly thought that opening/closing wouldn't be much
more expensive than a rescan call, but that was sheer brain fade.

This seems to fix about half of the performance lossage reported by
Sergey Koposov.  I'm still not sure where the other half went.
2005-05-05 03:37:23 +00:00
Tom Lane d468e19a06 Allow implicit cast from any named composite type to RECORD. At the
moment this has no particular use except to allow table rows to be
passed to record_out(), but that case seems to be useful in itself
per recent example from Elein.  Further down the road we could look
at letting PL functions be declared to accept RECORD parameters.
2005-05-05 00:19:47 +00:00
Tom Lane 126eaef651 Clean up MultiXactIdExpand's API by separating out the case where we
are creating a new MultiXactId from two regular XIDs.  The original
coding was unnecessarily complicated and didn't save any code anyway.
2005-05-03 19:42:41 +00:00
Tom Lane 893b57c871 Alter the signature for encoding conversion functions to declare the
output area as INTERNAL not CSTRING.  This is to prevent people from
calling the functions by hand.  This is a permanent solution for the
back branches but I hope it is just a stopgap for HEAD.
2005-05-03 19:17:59 +00:00
Tom Lane 177af51c04 Change tsearch2 to not use the unsafe practice of creating functions
that return INTERNAL without also having INTERNAL arguments.  Since the
functions in question aren't meant to be called by hand anyway, I just
redeclared them to take 'internal' instead of 'text'.  Also add code
to ProcedureCreate() to enforce the restriction, as I should have done
to start with :-(
2005-05-03 16:51:00 +00:00
Bruce Momjian 76668e6eb4 Check the file system on postmaster startup and report any unreferenced
files in the server log.

Heikki Linnakangas
2005-05-02 18:26:54 +00:00
Neil Conway f478856c7f Change SPI functions to use a `long' when specifying the number of tuples
to produce when running the executor. This is consistent with the internal
executor APIs (such as ExecutorRun), which also use a long for this purpose.
It also allows FETCH_ALL to be passed -- since FETCH_ALL is defined as
LONG_MAX, this wouldn't have worked on platforms where int and long are of
different sizes. Per report from Tzahi Fadida.
2005-05-02 00:37:07 +00:00
Tom Lane 6c412f0605 Change CREATE TYPE to require datatype output and send functions to have
only one argument.  (Per recent discussion, the option to accept multiple
arguments is pretty useless for user-defined types, and would be a likely
source of security holes if it was used.)  Simplify call sites of
output/send functions to not bother passing more than one argument.
2005-05-01 18:56:19 +00:00
Tom Lane d7018abe06 Make record_out and record_send extract type information from the passed
record object itself, rather than relying on a second OID argument to be
correct.  This patch just changes the function behavior and not the
catalogs, so it's OK to back-patch to 8.0.  Will remove the now-redundant
second argument in pg_proc in a separate patch in HEAD only.
2005-04-30 20:04:33 +00:00
Tom Lane 93b2477278 Use the standard lock manager to establish priority order when there
is contention for a tuple-level lock.  This solves the problem of a
would-be exclusive locker being starved out by an indefinite succession
of share-lockers.  Per recent discussion with Alvaro.
2005-04-30 19:03:33 +00:00
Neil Conway 47458f8c2f GCC 4.0 includes a new warning option, -Wformat-literal, that emits
a warning when a variable is used as a format string for printf()
and similar functions (if the variable is derived from untrusted
data, it could include unexpected formatting sequences). This
emits too many warnings to be enabled by default, but it does
flag a few dubious constructs in the Postgres tree. This patch
fixes up the obvious variants: functions that are passed a variable
format string but no additional arguments.

Most of these are harmless (e.g. the ruleutils stuff), but there
is at least one actual bug here: if you create a trigger named
"%sfoo", pg_dump will read uninitialized memory and fail to dump
the trigger correctly.
2005-04-30 08:08:51 +00:00
Tom Lane 3a694bb0a1 Restructure LOCKTAG as per discussions of a couple months ago.
Essentially, we shoehorn in a lockable-object-type field by taking
a byte away from the lockmethodid, which can surely fit in one byte
instead of two.  This allows less artificial definitions of all the
other fields of LOCKTAG; we can get rid of the special pg_xactlock
pseudo-relation, and also support locks on individual tuples and
general database objects (including shared objects).  None of those
possibilities are actually exploited just yet, however.

I removed pg_xactlock from pg_class, but did not force initdb for
that change.  At this point, relkind 's' (SPECIAL) is unused and
could be removed entirely.
2005-04-29 22:28:24 +00:00
Tom Lane bedb78d386 Implement sharable row-level locks, and use them for foreign key references
to eliminate unnecessary deadlocks.  This commit adds SELECT ... FOR SHARE
paralleling SELECT ... FOR UPDATE.  The implementation uses a new SLRU
data structure (managed much like pg_subtrans) to represent multiple-
transaction-ID sets.  When more than one transaction is holding a shared
lock on a particular row, we create a MultiXactId representing that set
of transactions and store its ID in the row's XMAX.  This scheme allows
an effectively unlimited number of row locks, just as we did before,
while not costing any extra overhead except when a shared lock actually
has to be shared.   Still TODO: use the regular lock manager to control
the grant order when multiple backends are waiting for a row lock.

Alvaro Herrera and Tom Lane.
2005-04-28 21:47:18 +00:00
Tom Lane c20fb65780 On further experimentation, there were still a couple of bugs in
ExpandIndirectionStar() ... and in markTargetListOrigin() too.
2005-04-25 22:02:30 +00:00
Tom Lane dfc5c72961 Fix ExpandIndirectionStar to handle cases where the expression to be
expanded is of RECORD type, eg
'select (foo).* from (select foo(f1) from t1) ss'
where foo() is a function declared with multiple OUT parameters.
2005-04-25 21:03:25 +00:00
Tom Lane ea19c8772e get_expr_result_type probably needs to be able to handle OpExpr as well
as FuncExpr, to cover cases where a function returning tuple is invoked
via an operator.
2005-04-25 20:59:44 +00:00
Tom Lane a0ea71333a Avoid rechecking lossy operators twice in a bitmap scan plan. 2005-04-25 04:27:12 +00:00
Tom Lane 1fcd4b7a07 While determining the filter clauses for an index scan (either plain
or bitmap), use pred_test to be a little smarter about cases where a
filter clause is logically unnecessary.  This may be overkill for the
plain indexscan case, but it's definitely useful for OR'd bitmap scans.
2005-04-25 03:58:30 +00:00
Tom Lane 79a1b00226 Replace slightly klugy create_bitmap_restriction() function with a
more efficient routine in restrictinfo.c (which can make use of
make_restrictinfo_internal).
2005-04-25 02:14:48 +00:00
Tom Lane 5b05185262 Remove support for OR'd indexscans internal to a single IndexScan plan
node, as this behavior is now better done as a bitmap OR indexscan.
This allows considerable simplification in nodeIndexscan.c itself as
well as several planner modules concerned with indexscan plan generation.
Also we can improve the sharing of code between regular and bitmap
indexscans, since they are now working with nigh-identical Plan nodes.
2005-04-25 01:30:14 +00:00
Tom Lane 186655e9a5 Adjust nodeBitmapIndexscan.c to not keep the index open across calls,
but just to open and close it during MultiExecBitmapIndexScan.  This
avoids acquiring duplicate resources (eg, multiple locks on the same
relation) in a tree with many bitmap scans.  Also, don't bother to
lock the parent heap at all here, since we must be underneath a
BitmapHeapScan node that will be holding a suitable lock.
2005-04-24 18:16:38 +00:00
Tom Lane 8403741796 Actually, nodeBitmapIndexscan.c doesn't need to create a standard
ExprContext at all, since it never evaluates any qual or tlist expressions.
2005-04-24 17:32:46 +00:00
Tom Lane 24475a7618 Put back example of using Result node to execute an INSERT. 2005-04-24 15:32:07 +00:00
Neil Conway 947eb97560 Update some comments to use SQL examples rather than QUEL. From Simon
Riggs.
2005-04-24 11:46:21 +00:00
Bruce Momjian 3b0a5e50d7 Update VACUUM VERBOSE FSM message, per Tom. 2005-04-24 03:51:49 +00:00
Tom Lane 35f9b461f1 Repair two TIME WITH TIME ZONE bugs found by Dennis Vshivkov. Comparison
of timetz values misbehaved in --enable-integer-datetime cases, and
EXTRACT(EPOCH) subtracted the zone instead of adding it in all cases.
Backpatch to all supported releases (except --enable-integer-datetime code
does not exist in 7.2).
2005-04-23 22:53:05 +00:00
Tom Lane 0e99be1c25 Remove useless argtype_inherit() code, and make consequent simplifications.
As I pointed out a few days ago, this code has failed to do anything useful
for some time ... and if we did want to revive the capability to select
functions by nearness of inheritance ancestry, this is the wrong place
and way to do it anyway.  The knowledge would need to go into
func_select_candidate() instead.  Perhaps someday someone will be motivated
to do that, but I am not today.
2005-04-23 22:09:58 +00:00
Tom Lane 9b5b9616f4 Remove explicit FreeExprContext calls during plan node shutdown. The
ExprContexts will be freed anyway when FreeExecutorState() is reached,
and letting that routine do the work is more efficient because it will
automatically free the ExprContexts in reverse creation order.  The
existing coding was effectively freeing them in exactly the worst
possible order, resulting in O(N^2) behavior inside list_delete_ptr,
which becomes highly visible in cases with a few thousand plan nodes.

ExecFreeExprContext is now effectively a no-op and could be removed,
but I left it in place in case we ever want to put it back to use.
2005-04-23 21:32:34 +00:00
Bruce Momjian 714d5a4c37 Update VACUUM VERBOSE update, per Alvaro. 2005-04-23 21:16:34 +00:00
Bruce Momjian 9ba6587f8b Update working of VACUUM VERBOSE. 2005-04-23 21:10:20 +00:00
Bruce Momjian 52e08c35f7 Make VACUUM VERBOSE FSM output all output in a single INFO output
statement.
2005-04-23 20:56:01 +00:00
Tom Lane 19d127548c Add comment about checkpoint panic behavior during shutdown, per
suggestion from Qingqing Zhou.
2005-04-23 18:49:54 +00:00
Tom Lane b1faf3624b Allow -2147483648 to be treated as an INT4 rather than INT8 constant.
Per discussion with Paul Edwards.
2005-04-23 18:35:12 +00:00
Tom Lane 3842892492 Recent changes got the sense of the notnull bit backwards in the 2.0
protocol output routines.  Mea culpa :-(.  Per report from Kris Jurka.
2005-04-23 17:45:35 +00:00
Tom Lane c114e166e5 Define the right-hand input of AT TIME ZONE as a full a_expr instead of
c_expr.  Perhaps the restriction was once needed to avoid bison errors,
but it seems to work just fine now --- and even generates a slightly
smaller state machine.  This change allows examples like
SELECT '13:45'::timetz AT TIME ZONE '-07:00'::interval;
to work without parentheses around the right-hand input.
2005-04-23 17:22:16 +00:00
Bruce Momjian e947e1153a Modify output of VACUUM VERBOSE to be clearer. 2005-04-23 15:20:39 +00:00
Tom Lane 56c8877291 Turns out that my recent elimination of the 'redundant' flatten_andors()
code in prepqual.c had a small drawback: the flatten_andors code was
able to cope with deeply nested AND/OR structures (like 10000 ORs in
a row), whereas eval_const_expressions tends to recurse until it
overruns the stack.  Revise eval_const_expressions so that it doesn't
choke on deeply nested ANDs or ORs.
2005-04-23 04:42:53 +00:00
Tom Lane e092828241 Teach choose_bitmap_and() to actually be choosy --- that is, try to
make some estimate of which available indexes to AND together, rather
than blindly taking 'em all.  This could probably stand further
improvement, but it seems to do OK in simple tests.
2005-04-23 01:57:34 +00:00
Tom Lane 4b89126ccc Fix bogus EXPLAIN display of rowcount estimates for BitmapAnd and
BitmapOr nodes.
2005-04-23 01:29:15 +00:00
Tom Lane bc843d3960 First cut at planner support for bitmap index scans. Lots to do yet,
but the code is basically working.  Along the way, rewrite the entire
approach to processing OR index conditions, and make it work in join
cases for the first time ever.  orindxpath.c is now basically obsolete,
but I left it in for the time being to allow easy comparison testing
against the old implementation.
2005-04-22 21:58:32 +00:00
Tom Lane 14c7fba3f7 Rethink original decision to use AND/OR Expr nodes to represent bitmap
logic operations during planning.  Seems cleaner to create two new Path
node types, instead --- this avoids duplication of cost-estimation code.
Also, create an enable_bitmapscan GUC parameter to control use of bitmap
plans.
2005-04-21 19:18:13 +00:00
Tom Lane e6f7edb9d5 Install some slightly realistic cost estimation for bitmap index scans. 2005-04-21 02:28:02 +00:00
Tom Lane eb4f58ad40 Don't try to run clauseless index scans on index types that don't support
it.  Per report from Marinos Yannikos.
2005-04-20 21:48:04 +00:00
Tom Lane a8ac7d8713 Fix mis-display of negative fractional seconds in interval values for
--enable-integer-datetimes case.  Per report from Oliver Siegmar.
2005-04-20 17:14:50 +00:00
Tom Lane 9d64632144 Minor performance improvement: avoid unnecessary creation/unioning of
bitmaps for multiple indexscans.  Instead just let each indexscan add
TIDs directly into the BitmapOr node's result bitmap.
2005-04-20 15:48:36 +00:00
Tom Lane 4a8c5d0375 Create executor and planner-backend support for decoupled heap and index
scans, using in-memory tuple ID bitmaps as the intermediary.  The planner
frontend (path creation and cost estimation) is not there yet, so none
of this code can be executed.  I have tested it using some hacked planner
code that is far too ugly to see the light of day, however.  Committing
now so that the bulk of the infrastructure changes go in before the tree
drifts under me.
2005-04-19 22:35:18 +00:00
Bruce Momjian aa8bdab272 Attached patch gets rid of the global timezone in the following steps:
* Changes the APIs to the timezone functions to take a pg_tz pointer as
an argument, representing the timezone to use for the selected
operation.

* Adds a global_timezone variable that represents the current timezone
in the backend as set by SET TIMEZONE (or guc, or env, etc).

* Implements a hash-table cache of loaded tables, so we don't have to
read and parse the TZ file everytime we change a timezone. While not
necesasry now (we don't change timezones very often), I beleive this
will be necessary (or at least good) when "multiple timezones in the
same query" is eventually implemented. And code-wise, this was the time
to do it.


There are no user-visible changes at this time. Implementing the
"multiple zones in one query" is a later step...

This also gets rid of some of the cruft needed to "back out a timezone
change", since we previously couldn't check a timezone unless it was
activated first.

Passes regression tests on win32, linux (slackware 10) and solaris x86.

Magnus Hagander
2005-04-19 03:13:59 +00:00
Tom Lane 7aa066f11d record_in and record_recv must be careful to return a separately
pfree'able result, since some callers expect to be able to pfree
the result of a pass-by-reference function.  Per report from Chris Trawick.
2005-04-18 17:11:05 +00:00
Tom Lane db30652135 Initial implementation of lossy-tuple-bitmap data structures.
Not connected to anything useful yet ...
2005-04-17 22:24:02 +00:00
Bruce Momjian 1a6ad669fb Fix comment typo. 2005-04-17 03:04:29 +00:00
Tom Lane d8b1bf4791 Create a new 'MultiExecProcNode' call API for plan nodes that don't
return just a single tuple at a time.  Currently the only such node
type is Hash, but I expect we will soon have indexscans that can return
tuple bitmaps.  A side benefit is that EXPLAIN ANALYZE now shows the
correct tuple count for a Hash node.
2005-04-16 20:07:35 +00:00
Tom Lane 5f0a974ea9 Reduce PANIC to ERROR in several xlog routines that are used in both
critical and noncritical contexts (an example of noncritical being
post-checkpoint removal of dead xlog segments).  In the critical cases
the CRIT_SECTION mechanism will cause ERROR to be promoted to PANIC
anyway, and in the noncritical cases we shouldn't let an error take
down the entire database.  Arguably there should be *no* explicit
PANIC errors in this module, only more START/END_CRIT_SECTION calls,
but I didn't go that far.  (Yet.)
2005-04-15 22:19:48 +00:00
Tom Lane 61b861421b Modify MoveOfflineLogs/InstallXLogFileSegment to avoid O(N^2) behavior
when recycling a large number of xlog segments during checkpoint.
The former behavior searched from the same start point each time,
requiring O(checkpoint_segments^2) stat() calls to relocate all the
segments.  Instead keep track of where we stopped last time through.
2005-04-15 18:48:10 +00:00
Neil Conway ea208aca00 Remove an unused variable "waitingForSignal". From Qingqing Zhou. 2005-04-15 04:18:10 +00:00
Tom Lane 8e14408028 Make equalTupleDescs() compare attlen/attbyval/attalign rather than
assuming comparison of atttypid is sufficient.  In a dropped column
atttypid will be 0, and we'd better check the physical-storage data
to make sure the tupdescs are physically compatible.
I do not believe there is a real risk before 8.0, since before that
we only used this routine to compare successive states of the tupdesc
for a particular relation.  But 8.0's typcache.c might be comparing
arbitrary tupdescs so we'd better play it safer.
2005-04-14 22:34:48 +00:00
Tom Lane 0453a997af Put back blessing of record-function tupledesc, which I removed in a
fit of over-optimization.
2005-04-14 22:09:40 +00:00
Tom Lane 939712ee73 Don't try to constant-fold functions returning RECORD, since the optimizer
isn't presently set up to pass them an expected tuple descriptor.  Bug has
been there since 7.3 but was just recently reported by Thomas Hallgren.
2005-04-14 21:44:09 +00:00
Tom Lane 055467d504 Marginal hack to use a specialized hash function for dynahash hashtables
whose keys are OIDs.  The only one that looks particularly performance
critical is the relcache hashtable, but as long as we've got the function
we may as well use it wherever it's applicable.
2005-04-14 20:32:43 +00:00
Tom Lane 162bd08b3f Completion of project to use fixed OIDs for all system catalogs and
indexes.  Replace all heap_openr and index_openr calls by heap_open
and index_open.  Remove runtime lookups of catalog OID numbers in
various places.  Remove relcache's support for looking up system
catalogs by name.  Bulky but mostly very boring patch ...
2005-04-14 20:03:27 +00:00
Tom Lane 7c13781ee7 First phase of project to use fixed OIDs for all system catalogs and
indexes.  Extend the macros in include/catalog/*.h to carry the info
about hand-assigned OIDs, and adjust the genbki script and bootstrap
code to make the relations actually get those OIDs.  Remove the small
number of RelOid_pg_foo macros that we had in favor of a complete
set named like the catname.h and indexing.h macros.  Next phase will
get rid of internal use of names for looking up catalogs and indexes;
but this completes the changes forcing an initdb, so it looks like a
good place to commit.
Along the way, I made the shared relations (pg_database etc) not be
'bootstrap' relations any more, so as to reduce the number of hardwired
entries and simplify changing those relations in future.  I'm not
sure whether they ever really needed to be handled as bootstrap
relations, but it seems to work fine to not do so now.
2005-04-14 01:38:22 +00:00
Tom Lane 2193a856a2 Simplify initdb-time assignment of OIDs as I proposed yesterday, and
avoid encroaching on the 'user' range of OIDs by allowing automatic
OID assignment to use values below 16k until we reach normal operation.

initdb not forced since this doesn't make any incompatible change;
however a lot of stuff will have different OIDs after your next initdb.
2005-04-13 18:54:57 +00:00
Tom Lane 2fdf9e0be6 Change addRangeTableEntryForRelation() to take a Relation pointer instead
of just a relation OID, thereby not having to open the relation for itself.
This actually saves code rather than adding it for most of the existing
callers, which had the rel open already.  The main point though is to be
able to use this rather than plain addRangeTableEntry in setTargetTable,
thus saving one relation_openrv/relation_close cycle for every INSERT,
UPDATE, or DELETE.  Seems to provide a several percent win on simple
INSERTs.
2005-04-13 16:50:55 +00:00
Tom Lane 7ace43e0c2 Fix oversight in MIN/MAX optimization: must not return NULL entries
from index, since the aggregates ignore NULLs.
2005-04-12 05:11:28 +00:00
Tom Lane 2e7a68896b Add aggsortop column to pg_aggregate, so that MIN/MAX optimization can
be supported for all datatypes.  Add CREATE AGGREGATE and pg_dump support
too.  Add specialized min/max aggregates for bpchar, instead of depending
on text's min/max, because otherwise the possible use of bpchar indexes
cannot be recognized.
initdb forced because of catalog changes.
2005-04-12 04:26:34 +00:00
Tom Lane addc42c339 Create the planner mechanism for optimizing simple MIN and MAX queries
into indexscans on matching indexes.  For the moment, it only handles
int4 and text datatypes; next step is to add a column to pg_aggregate
so that all MIN/MAX aggregates can be handled.  Per my recent proposal.
2005-04-11 23:06:57 +00:00
Tom Lane c3294f1cbf Fix interaction between materializing holdable cursors and firing
deferred triggers: either one can create more work for the other,
so we have to loop till it's all gone.  Per example from andrew@supernews.
Add a regression test to help spot trouble in this area in future.
2005-04-11 19:51:16 +00:00
Tom Lane 0c400f1bbc PersistHoldablePortal must establish the correct value for ActiveSnapshot
while completing execution of the cursor's query.  Otherwise we get wrong
answers or even crashes from non-volatile functions called by the query.
Per report from andrew@supernews.
2005-04-11 15:59:34 +00:00
Tom Lane acde8b3cab Make constant-folding produce sane output for COALESCE(NULL,NULL),
that is a plain NULL and not a COALESCE with no inputs.  Fixes crash
reported by Michael Williamson.
2005-04-10 20:57:32 +00:00
Tom Lane 6985592967 Split out into a separate function the code in grouping_planner() that
decides whether to use hashed grouping instead of sort-plus-uniq
grouping. The function needs an annoyingly large number of parameters,
but this still seems like a win for legibility, since it removes over
a hundred lines from grouping_planner (which is still too big :-().
2005-04-10 19:50:08 +00:00
Tom Lane 313de22c85 SQL functions returning pass-by-reference types were copying the results
into the wrong memory context, resulting in a query-lifespan memory leak.
Bug is new in 8.0, I believe.  Per report from Rae Stiening.
2005-04-10 18:04:20 +00:00
Tom Lane badb83f9ec If we're going to have a non-panic check for held_lwlocks[] overrun,
it must occur *before* we get into the critical state of holding a
lock we have no place to record.  Per discussion with Qingqing Zhou.
2005-04-08 14:18:35 +00:00
Tom Lane e794dfa511 Use an always-there test, not an Assert, to check for overrun of
the held_lwlocks[] array.  Per Qingqing Zhou.
2005-04-08 03:43:54 +00:00
Neil Conway eb4b7a0b77 Change the default setting of "add_missing_from" to false. This has been
the long-term plan for this behavior for quite some time, but it is only
possible now that DELETE has a USING clause so that the user can join
other tables in a DELETE statement without relying on this behavior.
2005-04-08 00:59:59 +00:00
Neil Conway f53cd94a78 Use fork_process() to avoid some fork()-related boilerplate code when
forking the stats collector child process.
2005-04-08 00:55:07 +00:00
Neil Conway f5ab0a14ea Add a "USING" clause to DELETE, which is equivalent to the FROM clause
in UPDATE. We also now issue a NOTICE if a query has _any_ implicit
range table entries -- in the past, we would only warn about implicit
RTEs in SELECTs with at least one explicit RTE.

As a result of the warning change, 25 of the regression tests had to
be updated. I also took the opportunity to remove some bogus whitespace
differences between some of the float4 and float8 variants. I believe
I have correctly updated all the platform-specific variants, but let
me know if that's not the case.

Original patch for DELETE ... USING from Euler Taveira de Oliveira,
reworked by Neil Conway.
2005-04-07 01:51:41 +00:00
Neil Conway be2f825d51 Apply the "nodeAgg" optimization to more of the builtin transition
functions. This patch optimizes int2_sum(), int4_sum(), float4_accum()
and float8_accum() to avoid needing to copy the transition function's
state for each input tuple of the aggregate. In an extreme case
(e.g. SELECT sum(int2_col) FROM table where table has a single column),
it improves performance by about 20%. For more complex queries or tables
with wider rows, the relative performance improvement will not be as
significant.
2005-04-06 23:56:07 +00:00
Tom Lane a6bbfedcf7 Remove test for NULL node in ExecProcNode(). No place ever calls
ExecProcNode() with a NULL value, so the test couldn't do anything
for us except maybe mask bugs.  Removing it probably doesn't save
anything much either, but then again this is a hot-spot routine.
2005-04-06 20:13:49 +00:00
Tom Lane ad161bcc8a Merge Resdom nodes into TargetEntry nodes to simplify code and save a
few palloc's.  I also chose to eliminate the restype and restypmod fields
entirely, since they are redundant with information stored in the node's
contained expression; re-examining the expression at need seems simpler
and more reliable than trying to keep restype/restypmod up to date.

initdb forced due to change in contents of stored rules.
2005-04-06 16:34:07 +00:00
Neil Conway 00a1b1e272 This file was whacked by pgindent before it knew it shouldn't remove
braces around single statements (for PG_TRY macros).  This patch fixes
it. Alvaro Herrera.
2005-04-06 04:34:22 +00:00
Tom Lane fd97cf4df0 plpgsql does OUT parameters, as per my proposal a few weeks ago. 2005-04-05 06:22:17 +00:00
Neil Conway 51b2f8ba55 This patch changes int2_avg_accum() and int4_avg_accum() use the nodeAgg
performance hack Tom introduced recently. This means we can avoid
copying the transition array for each input tuple if these functions
are invoked as aggregate transition functions.

To test the performance improvement, I created a 1 million row table
with a single int4 column. Without the patch, SELECT avg(col) FROM
table took about 4.2 seconds (after the data was cached); with the
patch, it took about 3.2 seconds. Naturally, the performance
improvement for a less trivial query (or a table with wider rows)
would be relatively smaller.
2005-04-04 23:50:27 +00:00
Neil Conway 5b1c607abe Remove an unused variable `ShmemBootstrap', and remove an obsolete
comment. Patch from Alvaro.
2005-04-04 04:34:41 +00:00
Tom Lane 280de290d7 In cost_mergejoin, the early-exit effect should not apply to the
outer side of an outer join.  Per andrew@supernews.
2005-04-04 01:43:12 +00:00
Tom Lane a5dda5dc3a Second try at making examine_variable and friends behave sanely in
cases with binary-compatible relabeling.  My first try was implicitly
assuming that all operators scalarineqsel is used for have binary-
compatible datatypes on both sides ... which is very wrong of course.
Per report from Michael Fuhr.
2005-04-01 20:31:50 +00:00
Bruce Momjian 9e9724e8bd Fix wrong week returnded by date_trunc('week') for early dates in
January --- would return wrong year for 2005-01-01 and 2006-01-01.

per report from Robert Creager.

Backpatch to 8.0.X.
2005-04-01 14:25:23 +00:00
Tom Lane 9336d636e2 Flush any remaining statistics counts out to the collector at process
exit.  Without this, operations triggered during backend exit (such as
temp table deletions) won't be counted ... which given heavy usage of
temp tables can lead to pg_autovacuum falling way behind on the need
to vacuum pg_class and pg_attribute.  Per reports from Steve Crawford
and others.
2005-03-31 23:20:49 +00:00
Tom Lane 47888fe842 First phase of OUT-parameters project. We can now define and use SQL
functions with OUT parameters.  The various PLs still need work, as does
pg_dump.  Rudimentary docs and regression tests included.
2005-03-31 22:46:33 +00:00
Neil Conway aeb502346b Minor code cleanup: ExecHash() was returning a null TupleTableSlot, and an
old comment in the code claimed that this was necessary. Since it is not
actually necessary any more, it is clearer to remove the comment and
just return NULL instead -- the return value of ExecHash() is not used.
2005-03-31 02:02:52 +00:00
Tom Lane 0f085f6e9d Add proallargtypes and proargmodes columns to pg_proc, as per my earlier
proposal for OUT parameter support.  The columns don't actually *do*
anything yet, they are just left NULLs.  But I thought I'd commit this
part separately as a fairly pure example of the tasks needed when adding
a column to pg_proc or one of the other core system tables.
2005-03-29 19:44:23 +00:00
Tom Lane eb47ee4865 Fix grammar for IN/OUT/INOUT parameters. This commit doesn't actually
implement any new feature, it just pushes the 'not implemented' error
message deeper into the backend.  I also tweaked the grammar to accept
Oracle-ish parameter syntax (parameter name first), as well as the
SQL99 standard syntax (parameter mode first), since it was easy and
people will doubtless try to use both anyway.
2005-03-29 17:58:51 +00:00
Tom Lane 8c85a34a3b Officially decouple FUNC_MAX_ARGS from INDEX_MAX_KEYS, and set the
former to 100 by default.  Clean up some of the less necessary
dependencies on FUNC_MAX_ARGS; however, the biggie (FunctionCallInfoData)
remains.
2005-03-29 03:01:32 +00:00
Neil Conway 4f6f5db474 Add SPI_getnspname(), including documentation. 2005-03-29 02:53:53 +00:00
Tom Lane 70c9763d48 Convert oidvector and int2vector into variable-length arrays. This
change saves a great deal of space in pg_proc and its primary index,
and it eliminates the former requirement that INDEX_MAX_KEYS and
FUNC_MAX_ARGS have the same value.  INDEX_MAX_KEYS is still embedded
in the on-disk representation (because it affects index tuple header
size), but FUNC_MAX_ARGS is not.  I believe it would now be possible
to increase FUNC_MAX_ARGS at little cost, but haven't experimented yet.
There are still a lot of vestigial references to FUNC_MAX_ARGS, which
I will clean up in a separate pass.  However, getting rid of it
altogether would require changing the FunctionCallInfoData struct,
and I'm not sure I want to buy into that.
2005-03-29 00:17:27 +00:00
Tom Lane 119191609c Remove dead push/pop rollback code. Vadim once planned to implement
transaction rollback via UNDO but I think that's highly unlikely to
happen, so we may as well remove the stubs.  (Someday we ought to
rip out the stub xxx_undo routines, too.)  Per Alvaro.
2005-03-28 01:50:34 +00:00
Tom Lane 5db2e83852 Rethink the order of expression preprocessing: eval_const_expressions
really ought to run before canonicalize_qual, because it can now produce
forms that canonicalize_qual knows how to improve (eg, NOT clauses).
Also, because eval_const_expressions already knows about flattening
nested ANDs and ORs into N-argument form, the initial flatten_andors
pass in canonicalize_qual is now completely redundant and can be
removed.  This doesn't save a whole lot of code, but the time and
palloc traffic eliminated is a useful gain on large expression trees.
2005-03-28 00:58:26 +00:00
Tom Lane bf3dbb5881 First steps towards index scans with heap access decoupled from index
access: define new index access method functions 'amgetmulti' that can
fetch multiple TIDs per call.  (The functions exist but are totally
untested as yet.)  Since I was modifying pg_am anyway, remove the
no-longer-needed 'rel' parameter from amcostestimate functions, and
also remove the vestigial amowner column that was creating useless
work for Alvaro's shared-object-dependencies project.
Initdb forced due to changes in pg_am.
2005-03-27 23:53:05 +00:00
Tom Lane 351519affc Teach const-expression simplification to simplify boolean equality cases,
that is 'x = true' becomes 'x' and 'x = false' becomes 'NOT x'.  This isn't
all that amazingly useful in itself, but it ensures that we will recognize
the different forms as being logically equivalent when checking partial
index predicates.  Per example from Patrick Clery.
2005-03-27 19:18:02 +00:00
Tom Lane 617dd33b6e Eliminate duplicate hasnulls bit testing in index tuple access, and
clean up itup.h a little bit.
2005-03-27 18:38:27 +00:00
Tom Lane 926e8a00d3 Add a back-link from IndexOptInfo structs to their parent RelOptInfo
structs.  There are many places in the planner where we were passing
both a rel and an index to subroutines, and now need only pass the
index struct.  Notationally simpler, and perhaps a tad faster.
2005-03-27 06:29:49 +00:00
Tom Lane febc9a613c Expand the 'special index operator' machinery to handle special cases
for boolean indexes.  Previously we would only use such an index with
WHERE clauses like 'indexkey = true' or 'indexkey = false'.  The new
code transforms the cases 'indexkey', 'NOT indexkey', 'indexkey IS TRUE',
and 'indexkey IS FALSE' into one of these.  While this is only marginally
useful in itself, I intend soon to change constant-expression simplification
so that 'foo = true' and 'foo = false' are reduced to just 'foo' and
'NOT foo' ... which would lose the ability to use boolean indexes for
such queries at all, if the indexscan machinery couldn't make the
reverse transformation.
2005-03-26 23:29:20 +00:00
Tom Lane 9d388e1f39 Fix a pair of related issues with estimation of inequalities that involve
binary-compatible relabeling of one or both operands.  examine_variable
should avoid stripping RelabelType from non-variable expressions, so that
they will continue to have the correct type; and convert_to_scalar should
just use that type and ignore the other input type.  This isn't perfect
but it beats failing entirely.  Per example from Michael Fuhr.
2005-03-26 20:55:39 +00:00
Tom Lane bb34970f91 Use a bitmapset instead of a list for duplicate-column checking in
checkInsertTargets().  Avoids O(N^2) behavior on wide target lists.
2005-03-26 06:28:59 +00:00
Tom Lane 9e5238137d Rewrite rewriteTargetList() to avoid O(N^2) behavior on wide target lists. 2005-03-26 05:53:01 +00:00
Tom Lane fccde77ecb Prevent to_char(interval) from dumping core on month-related formats
when a zero-month interval is given.  Per discussion with Karel.
Also, some desultory const-labeling of constant tables.  More could be
done along that line.
2005-03-26 00:41:31 +00:00
Tom Lane 73ed6d61bd Remove lazy_update_relstats; go back to having VACUUM just record the
actual number of unremoved tuples as pg_class.reltuples.  The idea of
trying to estimate a steady state condition still seems attractive, but
this particular implementation crashed and burned ...
2005-03-25 22:51:31 +00:00
Tom Lane adb1a6e95b Improve EXPLAIN ANALYZE to show the time spent in each trigger when
executing a statement that fires triggers.  Formerly this time was
included in "Total runtime" but not otherwise accounted for.
As a side benefit, we avoid re-opening relations when firing non-deferred
AFTER triggers, because the trigger code can re-use the main executor's
ResultRelInfo data structure.
2005-03-25 21:58:00 +00:00
Tom Lane 08890b407e Fix resource owner code to generate catcache and relcache leak warnings
when open references remain during normal cleanup of a resource owner.
This restores the system's ability to warn about leaks to what it was
before 8.0.  Not really a user-level bug, but helpful for development.
2005-03-25 18:30:28 +00:00
Tom Lane 410fede0dd Fix two bugs in change_owner_recurse_to_sequences: it was grabbing an
overly strong lock on pg_depend, and it wasn't closing the rel when done.
The latter bug was masked by the ResourceOwner code, which is something
that should be changed.
2005-03-25 18:04:34 +00:00
Tom Lane 519cef22bf Add missing min/max parameters to DefineCustomIntVariable() and
DefineCustomRealVariable().  Thomas Hallgren
2005-03-25 16:17:28 +00:00
Tom Lane 6e26c00297 Fix to_date to behave reasonably when CC and YY fields are both used.
Karel Zak
2005-03-25 16:08:40 +00:00
Tom Lane e6befdc9d1 Kerberos fixes from Magnus Hagander --- in theory Kerberos 5 auth
should work on Windows now.  Also, rename set_noblock to pg_set_noblock;
since it is included in libpq, the former name polluted application
namespace.
2005-03-25 00:34:31 +00:00
Tom Lane 0dca4fcb0e array_map can't use the fn_extra field of the provided fcinfo struct as
its private storage, because that belongs to the function that it is
supposed to call.  Per report from Ezequiel Tolnay.
2005-03-24 21:50:38 +00:00
Tom Lane 208ec47ba3 Tweak planner to use a minimum size estimate of 10 pages for a
never-yet-vacuumed relation.  This restores the pre-8.0 behavior of
avoiding seqscans during initial data loading, while still allowing
reasonable optimization after a table has been vacuumed.  Several
regression test cases revert to 7.4-like behavior, which is probably
a good sign.  Per gripes from Keith Browne and others.
2005-03-24 19:14:49 +00:00
Bruce Momjian 7604267de8 Set socket timer to 58 instead of 60 minutes for hour-old cleaners:
* Touch the socket and lock file at least every hour, to
         * ensure that they are not removed by overzealous /tmp-cleaning
         * tasks.  Set to 58 minutes so a cleaner never sees the
         * file as an hour old.
2005-03-24 18:16:17 +00:00
Bruce Momjian 218705958a Touch postmaster log file every hour, rather than every 10 minutes, to
prevent complaints from laptop users who don't like their hard drives
starting up every 10 minutes.
2005-03-24 05:19:05 +00:00
Bruce Momjian b1f57d88f5 Change Win32 O_SYNC method to O_DSYNC because that is what the method
currently does.  This is now the default Win32 wal sync method because
we perfer o_datasync to fsync.

Also, change Win32 fsync to a new wal sync method called
fsync_writethrough because that is the behavior of _commit, which is
what is used for fsync on Win32.

Backpatch to 8.0.X.
2005-03-24 04:36:20 +00:00
Neil Conway 50ce8ab9fc Revert changes to CREATE TRIGGER and ALTER TABLE ADD FOREIGN KEY locking,
per request from Tom.
2005-03-24 00:03:26 +00:00
Neil Conway f30c76ce8d Adjust CREATE TRIGGER and ALTER TABLE ... ADD FOREIGN KEY to acquire
ExclusiveLock rather than AccessExclusiveLock. This will allow concurrent
SELECT queries to proceed on the table. Per discussion with Andrew at
SuperNews.
2005-03-23 07:44:57 +00:00
Tom Lane cad86e253b WAL must log CREATE and DROP DATABASE operations *without* using any
explicit paths, so that the log can be replayed in a data directory
with a different absolute path than the original had.  To avoid forcing
initdb in the 8.0 branch, continue to accept the old WAL log record
types; they will never again be generated however, and the code can be
dropped after the next forced initdb.  Per report from Oleg Bartunov.
We still need to think about what it really means to WAL-log CREATE
TABLESPACE commands: we more or less have to put the absolute path
into those, but how to replay in a different context??
2005-03-23 00:03:37 +00:00
Tom Lane bd9b4a9d46 Use InitFunctionCallInfoData() macro instead of MemSet in performance
critical places in execQual.  By Atsushi Ogawa; some minor cleanup by moi.
2005-03-22 20:13:09 +00:00
Tom Lane 94e03330cb Create a routine PageIndexMultiDelete() that replaces a loop around
PageIndexTupleDelete() with a single pass of compactification ---
logic mostly lifted from PageRepairFragmentation.  I noticed while
profiling that a VACUUM that's cleaning up a whole lot of deleted
tuples would spend as much as a third of its CPU time in
PageIndexTupleDelete; not too surprising considering the loop method
was roughly O(N^2) in the number of tuples involved.
2005-03-22 06:17:03 +00:00
Tom Lane 775d28302c Fix quote_ident to use quote_identifier rather than its own, not quite
up-to-speed logic; in particular this will cause it to quote names that
match keywords.  Remove unnecessary multibyte cruft from quote_literal
(all backend-internal encodings are 8-bit-safe).
2005-03-21 16:29:20 +00:00
Tom Lane ee4ddac137 Convert index-related tuple handling routines from char 'n'/' ' to bool
convention for isnull flags.  Also, remove the useless InsertIndexResult
return struct from index AM aminsert calls --- there is no reason for
the caller to know where in the index the tuple was inserted, and we
were wasting a palloc cycle per insert to deliver this uninteresting
value (plus nontrivial complexity in some AMs).
I forced initdb because of the change in the signature of the aminsert
routines, even though nothing really looks at those pg_proc entries...
2005-03-21 01:24:04 +00:00
Neil Conway fe7015f5e8 Change the return value of HeapTupleSatisfiesUpdate() to be an enum,
rather than an integer, and fix the associated fallout. From Alvaro
Herrera.
2005-03-20 23:40:34 +00:00
Tom Lane 9e0dd84596 On Windows, use QueryPerformanceCounter instead of gettimeofday for
EXPLAIN ANALYZE instrumentation.  Magnus Hagander
2005-03-20 22:27:52 +00:00
Tom Lane 354049c709 Remove unnecessary calls of FlushRelationBuffers: there is no need
to write out data that we are about to tell the filesystem to drop.
smgr_internal_unlink already had a DropRelFileNodeBuffers call to
get rid of dead buffers without a write after it's no longer possible
to roll back the deleting transaction.  Adding a similar call in
smgrtruncate simplifies callers and makes the overall division of
labor clearer.  This patch removes the former behavior that VACUUM
would write all dirty buffers of a relation unconditionally.
2005-03-20 22:00:54 +00:00
Tom Lane 91728fa26c Add temp_buffers GUC variable to allow users to determine the size
of the local buffer arena for temporary table access.
2005-03-19 23:27:11 +00:00
Tom Lane d65522aeb6 Upgrade localbuf.c to use a hash table instead of linear search to
find already-allocated local buffers.  This is the last obstacle
in the way of setting NLocBuffer to something reasonably large.
2005-03-19 17:39:43 +00:00
Tom Lane 88164799ce Need to reset local buffer pin counts, not only shared buffer pins,
before we attempt any file deletions in ShutdownPostgres.  Per Tatsuo.
2005-03-18 16:16:09 +00:00
Tom Lane cef01c3355 Avoid infinite loop in InvalidateBuffer if we ourselves are holding
a pin on the victim buffer.
2005-03-18 05:25:23 +00:00
Tom Lane afb66ad8dd Need to release buffer pins before attempting to drop files during
backend exit.  Per report from Bruce.
2005-03-18 05:24:13 +00:00
Tom Lane 7a969cad2e Treat EPERM as a non-error case when checking to see if old postmaster
is still alive.  This improves our odds of not getting fooled by an
unrelated process when checking a stale lock file.  Other checks already
in place, plus one newly added in checkDataDir(), ensure that we cannot
attempt to usurp the place of a postmaster belonging to a different userid,
so there is no need to error out.  Add comments indicating the importance
of these other checks.
2005-03-18 03:48:49 +00:00
Neil Conway d344505d1b This patch moves some code for preprocessing FOR UPDATE from
grouping_planner() to preprocess_targetlist(), according to a comment
in grouping_planner(). I think the refactoring makes sense, and moves
some extraneous details out of grouping_planner().
2005-03-17 23:45:09 +00:00
Tom Lane 57fdb2b0d8 Update obsolete comment. 2005-03-17 15:25:51 +00:00
Neil Conway 72cbc5982d Trivial comment tweak. 2005-03-17 05:47:01 +00:00
Tom Lane f97aebd162 Revise TupleTableSlot code to avoid unnecessary construction and disassembly
of tuples when passing data up through multiple plan nodes.  A slot can now
hold either a normal "physical" HeapTuple, or a "virtual" tuple consisting
of Datum/isnull arrays.  Upper plan levels can usually just copy the Datum
arrays, avoiding heap_formtuple() and possible subsequent nocachegetattr()
calls to extract the data again.  This work extends Atsushi Ogawa's earlier
patch, which provided the key idea of adding Datum arrays to TupleTableSlots.
(I believe however that something like this was foreseen way back in Berkeley
days --- see the old comment on ExecProject.)  A test case involving many
levels of join of fairly wide tables (about 80 columns altogether) showed
about 3x overall speedup, though simple queries will probably not be
helped very much.

I have also duplicated some code in heaptuple.c in order to provide versions
of heap_formtuple and friends that use "bool" arrays to indicate null
attributes, instead of the old convention of "char" arrays containing either
'n' or ' '.  This provides a better match to the convention used by
ExecEvalExpr.  While I have not made a concerted effort to get rid of uses
of the old routines, I think they should be deprecated and eventually removed.
2005-03-16 21:38:10 +00:00
Bruce Momjian 83e87e6f2e Add missing include for new lc_ctype_is_c() function.
Per Neil.
2005-03-16 01:49:10 +00:00
Bruce Momjian 494f30c953 Prevent locale-aware handling of upper, lower, and initcap when the
locale is C.

Backpatch to 8.0.X because some operating systems were throwing errors
for such operations, rather than ignoring the locale when it was C.
2005-03-16 00:02:49 +00:00
Neil Conway 963ffe4cc4 Wrap the implementation of fork_process() inside #ifndef WIN32 -- this
should hopefully unbreak the Win32 build. Apologies for breaking it in
the first place.
2005-03-16 00:02:39 +00:00
Bruce Momjian 2c4dea126a Issue free space notices to both the user and the server log file. 2005-03-14 20:15:09 +00:00
Bruce Momjian e7fb9f18bf Add support for Win1252 encoding.
Roland Volkmann
2005-03-14 18:31:25 +00:00
Tom Lane a9b05bdc83 Avoid O(N^2) overhead in repeated nocachegetattr calls when columns of
a tuple are being accessed via ExecEvalVar and the attcacheoff shortcut
isn't usable (due to nulls and/or varlena columns).  To do this, cache
Datums extracted from a tuple in the associated TupleTableSlot.
Also some code cleanup in and around the TupleTable handling.
Atsushi Ogawa with some kibitzing by Tom Lane.
2005-03-14 04:41:13 +00:00
Neil Conway c069655441 Allow ALTER FUNCTION to change a function's strictness, volatility, and
whether or not it is a security definer. Changing a function's strictness
is required by SQL2003, and the other capabilities make sense. Also, allow
an optional RESTRICT noise word to be specified, for SQL conformance.

Some trivial regression tests added and the documentation has been
updated.
2005-03-14 00:19:37 +00:00
Bruce Momjian 41e2a80f57 Update comments for new encoding names. 2005-03-14 00:19:13 +00:00
Tom Lane db5ea2c5cb Add some missing #includes. 2005-03-13 23:27:38 +00:00
Tom Lane dffbbb3e55 Forgot that I had intended to replace division by masking in hash calculation. 2005-03-13 19:59:40 +00:00
Neil Conway ff02d0a052 Make default_with_oids default to false -- user-created tables will now
no longer include OIDs, unless WITH OIDS is specified or the
default_with_oids configuration parameter is enabled. Update the docs
accordingly.
2005-03-13 09:36:31 +00:00
Neil Conway 9423383748 Update obsolete comment. 2005-03-13 05:19:26 +00:00
Bruce Momjian ee1bd33dd0 Document aliases for our supported encodings.
Add a few encodings that were not documented.
2005-03-13 01:26:30 +00:00
Tom Lane 78a572bf0c When cloning template0 (or other fully-frozen databases), set the new
database's datallowconn and datfrozenxid to the current transaction ID
instead of copying the source database's values.  This is OK because we
assume the source DB contains no normal transaction IDs whatsoever.
This keeps VACUUM from immediately starting to complain about unvacuumed
databases in the situation where we are more than 2 billion transactions
out from the XID stamp of template0.  Per discussion with Milen Radev
(although his complaint turned out to be due to something else, but the
problem is real anyway).
2005-03-12 21:33:55 +00:00
Tom Lane c7bbe99452 Fix ALTER DATABASE RENAME to allow the operation if user is a superuser
who for some reason isn't marked usecreatedb.  Per report from Alexander
Pravking.  Also fix sloppy coding in have_createdb_privilege().
2005-03-12 21:11:50 +00:00
Tom Lane fa5e44017a Adjust the API for aggregate function calls so that a C-coded function
can tell whether it is being used as an aggregate or not.  This allows
such a function to avoid re-pallocing a pass-by-reference transition
value; normally it would be unsafe for a function to scribble on an input,
but in the aggregate case it's safe to reuse the old transition value.
Make int8inc() do this.  This gets a useful improvement in the speed of
COUNT(*), at least on narrow tables (it seems to be swamped by I/O when
the table rows are wide).  Per a discussion in early December with
Neil Conway.  I also fixed int_aggregate.c to check this, thereby
turning it into something approaching a supportable technique instead
of being a crude hack.
2005-03-12 20:25:06 +00:00
Bruce Momjian 5fdd9418ee Handle carriage returns and line feeds in COPY CSV mode.
Andrew Dunstan
2005-03-12 05:41:34 +00:00
Bruce Momjian 45905425a0 Add warning about the need to increase "max_fsm_relations" and
"max_fsm_relations" for vacuums.  Also improve VACUUM VERBOSE final
message text.

Ron Mayer
2005-03-12 05:21:52 +00:00
Tom Lane a214e9c996 Fix problem with infinite recursion between write_syslogger_file and
elog if the former has trouble writing its file.  Code review for
Magnus' patch to redirect stderr to syslog on Windows (Bruce's version
seems right, but did some minor prettification).

Backpatch both changes to 8.0 branch.
2005-03-12 01:54:44 +00:00
Bruce Momjian caad817d1c Add fprintf() custom version to libpgport.
Document use of macros for pg_printf functions.

Bump major versions of all interfaces to handle movement of get_progname
from libpq to libpgport in 8.0, and probably other libpgport changes in 8.1.
2005-03-11 19:13:43 +00:00
Neil Conway c129c16492 Slight refactoring and optimization of some code in WaitOnLock(). 2005-03-11 03:52:06 +00:00
Tom Lane 595ed2a855 Make the behavior of HAVING without GROUP BY conform to the SQL spec.
Formerly, if such a clause contained no aggregate functions we mistakenly
treated it as equivalent to WHERE.  Per spec it must cause the query to
be treated as a grouped query of a single group, the same as appearance
of aggregate functions would do.  Also, the HAVING filter must execute
after aggregate function computation even if it itself contains no
aggregate functions.
2005-03-10 23:21:26 +00:00
Neil Conway 164adc4d39 Refactor fork()-related code. We need to do various housekeeping tasks
before we can invoke fork() -- flush stdio buffers, save and restore the
profiling timer on Linux with LINUX_PROFILE, and handle BeOS stuff. This
patch moves that code into a single function, fork_process(), instead of
duplicating it at the various callsites of fork().

This patch doesn't address the EXEC_BACKEND case; there is room for
further cleanup there.
2005-03-10 07:14:03 +00:00
Neil Conway 4cd2fd66f8 Unbreak out-of-tree builds, by fixing a typo. 2005-03-07 23:18:06 +00:00
Tom Lane a52b4fb131 Adjust creation/destruction of TupleDesc data structure to reduce the
number of palloc calls.  This has a salutory impact on plpgsql operations
with record variables (which create and destroy tupdescs constantly)
and probably helps a bit in some other cases too.
2005-03-07 04:42:17 +00:00
Bruce Momjian e3d7de6b99 Rename canonical encodings, per Peter:
UNICODE => UTF8
	ALT => WIN866
	WIN => WIN1251
	TCVN => WIN1258

The old codes continue to work.
2005-03-07 04:30:55 +00:00
Neil Conway c6ad5c2eb4 Here's a tiny fix for a harmless typo in catalog.c:
Too much space is allocated for tablespace file path, I guess the
directory name used to be "pg_tablespaces" instead of "pg_tblspc" at
some point.

Heikki Linnakangas
2005-03-07 04:15:34 +00:00
Tom Lane 849074f9ae Revise hash join code so that we can increase the number of batches
on-the-fly, and thereby avoid blowing out memory when the planner has
underestimated the hash table size.  Hash join will now obey the
work_mem limit with some faithfulness.  Per my recent proposal
(hash aggregate part isn't done yet though).
2005-03-06 22:15:05 +00:00
Tom Lane 5d5087363d Replace the BufMgrLock with separate locks on the lookup hashtable and
the freelist, plus per-buffer spinlocks that protect access to individual
shared buffer headers.  This requires abandoning a global freelist (since
the freelist is a global contention point), which shoots down ARC and 2Q
as well as plain LRU management.  Adopt a clock sweep algorithm instead.
Preliminary results show substantial improvement in multi-backend situations.
2005-03-04 20:21:07 +00:00
Tom Lane 3104a92866 Another go at making pred_test() handle all reasonable combinations
of AND and OR clauses.  The key point here is that an OR on the
predicate side has to be treated gingerly: we may be able to prove
that the OR is implied even when no one of its components is implied.
For example (x OR y) implies (x OR y OR z) even though no one of x,
y, or z can be individually proven.  This code handles both the
example shown recently by Sergey Koshcheyev and the one shown last
October by Dawid Kuroczko.
2005-03-02 04:10:53 +00:00
Tom Lane a2ad04f4b0 Release proclock immediately in RemoveFromWaitQueue() if it represents
no held locks.  This maintains the invariant that proclocks are present
only for procs that are holding or awaiting a lock; when this is not
true, LockRelease will fail.  Per report from Stephen Clouse.
2005-03-01 21:14:59 +00:00
Tom Lane ccba1d0c9c Allow Trace_lock_oidmin to be set to zero; this is a reasonable
representation of not wanting tracing to be limited by object OID.
2005-03-01 20:23:34 +00:00
Tom Lane 95871703e3 Adjust OR indexscan logic to not generate redundant condition-free OR
indexscans involving partial indexes.  These would always be dominated
by a simple indexscan on such an index, so there's no point in considering
them.  Fixes overoptimism in a patch I applied last October.
2005-03-01 01:40:05 +00:00
Tom Lane 4e89bae704 Revert the logic for expanding AND/OR conditions in pred_test() to what
it was in 7.4, and add some comments explaining why it has to be this way.
I broke it for OR'd index predicates in a fit of code cleanup last summer.
Per example from Sergey Koshcheyev.
2005-03-01 00:24:52 +00:00
Neil Conway 484f0464ff Implement max() and min() aggregates for array types. Patch from Koju
Iijima, reviewed by Neil Conway. Catalog version number bumped,
regression tests updated.
2005-02-28 03:45:24 +00:00
Neil Conway 5285b35763 Add explicit casts between int4 and boolean. Patch from Sean Chittenden,
editorializing by Neil Conway. Catalog version bumped.
2005-02-27 08:31:30 +00:00
Bruce Momjian 76fa5e6e18 Cause Win32 to output to the event log rather than stderr by default.
Magnus Hagander
2005-02-27 01:02:57 +00:00
Tom Lane 0fc4ecf935 Finish up the flat-files project: get rid of GetRawDatabaseInfo() hack
in favor of looking at the flat file copy of pg_database during backend
startup.  This should finally eliminate the various corner cases in which
backend startup fails unexpectedly because it isn't able to distinguish
live and dead tuples in pg_database.  Simplify locking on pg_database
to be similar to the rules used with pg_shadow and pg_group, and eliminate
FlushRelationBuffers operations that were used only to reduce the odds
of failure of GetRawDatabaseInfo.
initdb forced due to addition of a trigger to pg_database.
2005-02-26 18:43:34 +00:00
Neil Conway 406a942820 Minor code cleanup: remove a variable that was assigned to but never
subsequently referenced.

Found by: Coverity
Fixed by: Sean Chittenden
2005-02-23 23:27:54 +00:00
Neil Conway 3350b3740e This patch optimizes the md5_text() function (which is used to
implement the md5() SQL-level function). The old code did the
following:

1. de-toast the datum
2. convert it to a cstring via textout()
3. get the length of the cstring via strlen()

Since we are treating the datum context as a blob of binary data,
the latter two steps are unnecessary. Once the data has been
detoasted, we can just use it as-is, and derive its length from
the varlena metadata.

This patch improves some run-of-the-mill md5() computations by
just under 10% in my limited tests, and passes the regression tests.

I also noticed that md5_text() wasn't checking the return value
of md5_hash(); encountering OOM at precisely the right moment
could result in returning a random md5 hash. This patch corrects
that. A better fix would be to make md5_hash() only return on
success (and/or allocate via palloc()), but since it's used in
the frontend as well I don't see an easy way to do that.
2005-02-23 22:46:17 +00:00
Bruce Momjian 0542b1e2fe Use _() macro consistently rather than gettext(). Add translation
macros around strings that were missing them.
2005-02-22 04:43:23 +00:00
Tom Lane bb0aed591f Use SnapshotNow instead of SnapshotSelf for reading the catalogs
during flat-file writing.  The only difference is that SnapshotSelf
would consider tuples of the 'current command' within the current
transaction as valid, where SnapshotNow wouldn't.  We can eliminate
the need for this with one extra CommandCounterIncrement call before
we start reading the catalogs.
2005-02-20 22:02:19 +00:00
Tom Lane 4aefe75553 Remove some no-longer-needed kluges for bootstrapping, in particular
the AMI_OVERRIDE flag.  The fact that TransactionLogFetch treats
BootstrapTransactionId as always committed is sufficient to make
bootstrap work, and getting rid of extra tests in heavily used code
paths seems like a win.  The files produced by initdb are demonstrably
the same after this change.
2005-02-20 21:46:50 +00:00
Bruce Momjian 57e3b0c9db Rename macro to MAKE_EXPIRED_TUPLES_VISIBLE. 2005-02-20 15:01:42 +00:00
Bruce Momjian f6a7bef915 Fix MAKE_ALL_TUPLES_VISIBLE define. 2005-02-20 15:00:16 +00:00
Bruce Momjian 5845bfb8bf Move define MAKE_ALL_TUPLES_VISIBLE to a more logical place. 2005-02-20 14:57:47 +00:00
Bruce Momjian 59191b2245 I have added a define, MAKE_ALL_TUPLES_VISIBLE, to help people recover
deleted tuples. Of course it is only to be used for disaster recovery.
2005-02-20 04:56:00 +00:00
Tom Lane 3f9aec50e7 Flat file cleanup phase 2: make it work for pg_group. The flat group
file now identifies group members by usesysid not name; this avoids
needing to depend on SearchSysCache which we can't use during startup.
(The old representation was entirely broken anyway, since we did not
regenerate the file following RENAME USER.)  It's only a 95% solution
because if the group membership list is big enough to be toasted out
of line, we cannot read it during startup.  I think this will do for
the moment, until we have time to implement the planned pg_role
replacement for pg_group.
2005-02-20 04:45:59 +00:00
Tom Lane 60b2444cc3 Add code to prevent transaction ID wraparound by enforcing a safe limit
in GetNewTransactionId().  Since the limit value has to be computed
before we run any real transactions, this requires adding code to database
startup to scan pg_database and determine the oldest datfrozenxid.
This can conveniently be combined with the first stage of an attack on
the problem that the 'flat file' copies of pg_shadow and pg_group are
not properly updated during WAL recovery.  The code I've added to
startup resides in a new file src/backend/utils/init/flatfiles.c, and
it is responsible for rewriting the flat files as well as initializing
the XID wraparound limit value.  This will eventually allow us to get
rid of GetRawDatabaseInfo too, but we'll need an initdb so we can add
a trigger to pg_database.
2005-02-20 02:22:07 +00:00
Tom Lane 617d16f4ff New arrangement to always let the bgwriter do checkpoints broke
CHECKPOINT and some other commands in the context of a standalone
backend.  Allow a standalone backend to do its own checkpoints.
2005-02-19 23:16:15 +00:00
Tom Lane 9650d6c7e6 Ensure that the resolved datatype of any unknown Param is propagated
into the sub-SELECT targetlist when it appears in the context
INSERT INTO foo SELECT $1 ...  Per report from Abhijit Menon-Sen.
2005-02-19 19:33:08 +00:00
Tom Lane a8593a3463 Convert MemoryContextSwitchTo() into an inline function when using GCC. 2005-02-18 21:52:34 +00:00
Bruce Momjian 3110cd237c Update comment on VACUUM FULL.
Manfred Koizar
2005-02-15 03:50:07 +00:00
Bruce Momjian d73e0410bd Improve documentation of signal usage for HAVE_SIGPROCMASK and
non-HAVE_SIGPROCMASK cases in pqinitmask().
2005-02-14 23:02:35 +00:00
Bruce Momjian ad4f06aeb2 Improve documentation of signal usage for HAVE_SIGPROCMASK and
non-HAVE_SIGPROCMASK cases in pqinitmask().
2005-02-14 23:02:03 +00:00
Tom Lane db58ee5be9 ALTER LANGUAGE RENAME has never worked. Per Sergey Yatskevich. 2005-02-14 06:17:44 +00:00
Bruce Momjian 7c44e57331 Move plpgsql DEBUG from DEBUG2 to DEBUG1 because it is a user-requested
DEBUG.

Fix a few places where DEBUG1 crept in that should have been DEBUG2.
2005-02-12 23:53:42 +00:00
Neil Conway 975e27377a Adjust input routines for float4, float8 and oid to reject the empty string
as valid input (it was previously treated as 0). This input was deprecated
in 8.0 (and a warning was emitted). Regression tests updated.
2005-02-11 04:09:05 +00:00
Tom Lane 4db84f0880 Fix ANALYZE to accumulate some minimal statistics for an all-null column.
Per gripes from Mike Mascari and Bernd Heller.
2005-02-11 00:41:12 +00:00
Tom Lane 42599b322d Fix SPI cursor support to allow scanning the results of utility commands
that return tuples (such as EXPLAIN).  Per gripe from Michael Fuhr.
Side effect: fix an old bug that unintentionally disabled backward scans
for all SPI-created cursors.
2005-02-10 20:36:28 +00:00
Neil Conway 3df9abd1a5 ALTER TABLE ADD COLUMN exhibits a significant memory leak when adding a
column with a default expression. In that situation, we need to rewrite
the heap relation. To evaluate the new default expression, we use
ExecEvalExpr(); however, this can allocate memory in the current memory
context, and ATRewriteTable() does not switch out of the active portal's
heap memory context. The end result is a rather large memory leak (on
the order of gigabytes for a reasonably sized table).

This patch changes ATRewriteTable() to switch to the per-tuple memory
context before beginning the per-tuple loop. It also removes an explicit
heap_freetuple() in the loop, since that is no longer needed.

In an unrelated change, I noticed the code was scanning through the
attributes of the new tuple descriptor for each tuple of the old table.
I changed this to use precomputation, which should slightly speed up
the loop.

Thanks to steve@deefs.net for reporting the leak.
2005-02-09 23:17:26 +00:00
Tom Lane 2a6c032503 Repair CLUSTER failure after ALTER TABLE SET WITHOUT OIDS. Turns out
there are corner cases involving dropping toasted columns in which the
previous coding would fail, too: the new version of the table might not
have any TOAST table, but we'd still propagate possibly-wide values of
dropped columns forward.
2005-02-06 20:19:08 +00:00
Tom Lane 4f82112473 Fix bit-rot in ipc_test.c; it didn't include some stuff that pg_shmem.c
now depends on.
2005-02-05 20:07:16 +00:00
Tom Lane 12179c99b1 Marginal hack to merge adjacent ReleaseBuffer/ReadBuffer calls into
ReleaseAndReadBuffer during GIST index searches.  We already did this
in btree and rtree, might as well do it here too.
2005-02-05 19:38:58 +00:00
Neil Conway 11635c3f6f Refactor some duplicated code in lock.c: create UnGrantLock(), move code
from LockRelease() and LockReleaseAll() into it. From Heikki Linnakangas.
2005-02-04 02:04:53 +00:00
Tom Lane cc4f58f4cd Ensure that all details of the ARC algorithm are hidden within freelist.c.
This refactoring does not change any algorithms or data structures, just
remove visibility of the ARC datastructures from other source files.
2005-02-03 23:29:19 +00:00
Tom Lane ad476170e9 Improve performance of fmgr.c calling routines for cases with more than
two arguments.  Per suggestions from A. Ogawa.
2005-02-02 22:40:04 +00:00
Tom Lane fffb5819ca Adjust constant-folding of CASE expressions so that the simple comparison
form of CASE (eg, CASE 0 WHEN 1 THEN ...) can be constant-folded as it
was in 7.4.  Also, avoid constant-folding result expressions that are
certainly unreachable --- the former coding was a bit cavalier about this
and could generate unexpected results for all-constant CASE expressions.
Add regression test cases.  Per report from Vlad Marchenko.
2005-02-02 21:49:09 +00:00
Neil Conway 73f630500b Add support for temporary views, including documentation and regression
tests. Contributed by Koju Iijima, review from Neil Conway, Gavin Sherry
and Tom Lane.

Also, fix error in description of WITH CHECK OPTION clause in the CREATE
VIEW reference page: it should be "CASCADED", not "CASCADE".
2005-02-02 06:36:02 +00:00
Neil Conway f94197ef35 Fix a bug induced by the list-rewrite that resulted in incrementing the
command counter more than necessary. Per report from Michael Fuhr.
2005-02-01 23:28:40 +00:00
Tom Lane a3f945a1b2 Adjust estimate_num_groups() to not clamp per-relation group count
estimate to less than the number of values estimated for any one grouping
Var, as suggested by Manfred.  This is intuitively right, and what's
more it puts the plan choices in the subselect regression test back the
way they were before ...
2005-02-01 23:08:13 +00:00
Tom Lane 0a92c58b7c Sync inet formatting code with recent BIND releases. In particular,
fix bug with inconsistent selection of default mask length for
"class D" addresses.  Per report from Steve Atkins.
2005-02-01 00:59:09 +00:00
Tom Lane 875b0c62fa When dealing with multiple grouping columns coming from the same table,
clamp the estimated number of groups to table row count over 10, instead
of table row count; this reflects a heuristic that people probably won't
group over a near-unique set of columns, and the knowledge that we don't
currently have any way to estimate the correlation of the columns better
than guessing.  This change creates a trivial plan change in one of the
regression tests.
2005-01-28 20:34:27 +00:00
Tom Lane 0bf2587df4 Improve planner's estimation of the space needed for HashAgg plans:
look at the actual aggregate transition datatypes and the actual overhead
needed by nodeAgg.c, instead of using pessimistic round numbers.
Per a discussion with Michael Tiemann.
2005-01-28 19:34:28 +00:00
Tom Lane 5ae5e3bfe6 Check that aggregate creator has the right to execute the transition
functions of the aggregate, at both aggregate creation and execution times.
2005-01-27 23:42:18 +00:00
Neil Conway f76730e35a Small patch to move get_grosysid() from catalog/aclchk.c to
utils/cache/lsyscache.c where it can be used by other things.  Also
cleans up both get_usesysid() and get_grosysid() a bit. From Stephen
Frost.
2005-01-27 23:36:15 +00:00
Neil Conway a885ecd6ef Change heap_modifytuple() to require a TupleDesc rather than a
Relation. Patch from Alvaro Herrera, minor editorializing by
Neil Conway.
2005-01-27 23:24:11 +00:00
Neil Conway ffaaf27eb4 Provide a more descriptive error message when the return type of an SRF
does not match what the query expected. From Brendan Jurd, minor
editorializing by Neil Conway.
2005-01-27 06:36:42 +00:00
Tom Lane f07b9689c9 Generalize TRUNCATE to support truncating multiple tables in one
command.  This is useful because we can allow truncation of tables
referenced by foreign keys, so long as the referencing table is
truncated in the same command.

Alvaro Herrera
2005-01-27 03:19:37 +00:00
Tom Lane aba691b728 Close all cursors created during a failed subtransaction. This is needed
to avoid problems when a cursor depends on objects created or changed in
the same subtransaction.  We'd like to do better someday, but this seems
the only workable answer for 8.0.1.
2005-01-26 23:20:21 +00:00
Tom Lane bf7737a938 On Windows, set the postmaster executable's stack size to 4MB, so that
it agrees with the default value of max_stack_depth.
2005-01-26 21:55:26 +00:00
Tom Lane beaf5ae623 Fix ALTER TABLE ADD COLUMN so that constraints of domain types are
enforced properly when there is no explicit default value for the new
column.  Per report from Craig Perras.
2005-01-24 23:21:57 +00:00
Tom Lane ad538d8bcd Disallow LOAD to non-superusers. Per report from John Heasman. 2005-01-24 17:46:16 +00:00
Tom Lane 0ffe9f7946 Fix memory leak in rtdosplit, per report from Clive Page. 2005-01-24 02:47:26 +00:00
Tom Lane 94e4778a31 The result of a FULL or RIGHT join can't be assumed to be sorted by the
left input's sorting, because null rows may be inserted at various points.
Per report from Ferenc Lutischá¸n.
2005-01-23 02:21:36 +00:00
Neil Conway a341a96c01 Refactor transformExpr() by creating separate functions for most of the
expression types.
2005-01-19 23:45:24 +00:00
Neil Conway b4297c177c This patch makes some improvements to the rtree index implementation:
(1) Keep a pin on the scan's current buffer and mark buffer. This
avoids the need to do a ReadBuffer() for each tuple produced by the
scan. Since ReadBuffer() is expensive, this is a significant win.

(2) Convert a ReleaseBuffer(); ReadBuffer() pair into
ReleaseAndReadBuffer(). Surely not a huge win, but it saves a lock
acquire/release...

(3) Remove a bunch of duplicated code in rtget.c; make rtnext() handle
both the "initial result" and "subsequent result" cases.

(4) Add support for index tuple killing

(5) Remove rtscancache(): it is dead code, for the same reason that
gistscancache() is dead code (an index scan ought not be invoked with
NoMovementScanDirection).

The end result is about a 10% improvement in rtree index scan perf,
according to contrib/rtree_gist/bench.
2005-01-18 23:25:55 +00:00
Neil Conway 1f5299bc3f Replace the use of "0" with "NULL" where appropriate in dllist.c, for
good style and to satisfy sparse. From Alvaro Herrera.
2005-01-18 22:59:32 +00:00
Peter Eisentraut 1723f1f7ae Translation updates 2005-01-17 20:27:44 +00:00
Peter Eisentraut bb60ef23ed Translation updates 2005-01-17 14:55:34 +00:00
Peter Eisentraut f099cb0ede Translation updates 2005-01-17 10:00:06 +00:00
Peter Eisentraut 3332c0722d Fix format string error. 2005-01-17 09:06:31 +00:00
Peter Eisentraut 83ef003f2c Translation updates 2005-01-17 02:41:50 +00:00
Tom Lane 9fa1843454 postgres -boot would print the wrong program name in event of a
failure in SelectConfigFiles().  Cosmetic issue, but ...
2005-01-14 21:08:44 +00:00
Tom Lane 9d83358499 Update obsolete comment, per Alvaro. 2005-01-14 17:53:33 +00:00
Peter Eisentraut f680aaeafa Translation updates 2005-01-13 19:06:37 +00:00
Tom Lane c06b31dc31 get_names_for_var didn't do recursion for unnamed JOIN vars quite right;
got it wrong when the JOIN was in an outer query level.  Per example from
Laurie Burrow.  Also fix same issue in markTargetListOrigin.  I think the
latter is only a latent bug since we currently don't apply markTargetListOrigin
except at the outer level ... but should do it right anyway.
2005-01-13 17:19:10 +00:00
Tom Lane cbd8913245 Remove unportable assumption that it's okay to use the target buffer
of an sprintf() as a source string.  Demonstrably does not work with
recent gcc and/or glibc on some platforms.
2005-01-13 01:40:13 +00:00
Tom Lane 40f32f351a Add conditional inclusion of <com_err.h> to support old 'heimdal'
version of Kerberos.  Per report from Reinhard Max.
2005-01-12 21:37:54 +00:00
Tom Lane 2ec1aa4cb8 Re-allow an untyped literal as the test expression of a CASE, ie
CASE 'a' WHEN 'a' THEN 1 ELSE 2 END.  This worked in 7.4 and before
but had been broken due to premature freezing of the type of the test
expression.  Per gripe from GÄbor SzÃcs.
2005-01-12 17:32:36 +00:00
Tom Lane 8251e0b2fb Increase MAXLISTEN to a more generous value, and add an error message
telling when it has been exceeded.  Per trouble report from
Jean-GÅrard Pailloncy.
2005-01-12 16:38:17 +00:00
Tom Lane d3d00715e2 interval_out failed to mention 'ago' for negative intervals in SQL and
GERMAN datestyles.  Ancient bug reported by Terry Lee Tucker.
2005-01-11 18:33:46 +00:00