Tom Lane [Sun, 15 May 2005 21:19:55 +0000 (21:19 +0000)]
Fix latent bug in ExecSeqRestrPos: it leaves the plan node's result slot
in an inconsistent state. (This is only latent because in reality
ExecSeqRestrPos is dead code at the moment ... but someday maybe it won't
be.) Add some comments about what the API for plan node mark/restore
actually is, because it's not immediately obvious.
Tom Lane [Sat, 14 May 2005 20:29:13 +0000 (20:29 +0000)]
Minor speed hacks in AllocSetReset: avoid clearing the freelist headers
when the blocks list is empty (there can surely be no freelist items if
the context contains no memory), and use MemSetAligned not MemSet to
clear the headers (we assume alignof(pointer) >= alignof(int32)).
Per discussion with Atsushi Ogawa. He proposes some further hacking
that I'm not yet sold on, but these two changes are unconditional wins
since there is no case in which they make things slower.
Tom Lane [Sat, 14 May 2005 17:55:22 +0000 (17:55 +0000)]
Convert the existing regression test scripts for the various optional
PLs to use the standard pg_regress infrastructure. No changes in the
tests themselves. Andrew Dunstan
Tom Lane [Fri, 13 May 2005 21:20:16 +0000 (21:20 +0000)]
Revise nodeMergejoin in light of example provided by Guillaume Smet.
When one side of the join has a NULL, we don't want to uselessly try
to match it against every remaining tuple of the other side. While
at it, rewrite the comparison machinery to avoid multiple evaluations
of the left and right input expressions and to use a btree comparator
where available, instead of double operator calls. Also revise the
state machine to eliminate redundant comparisons and hopefully make it
more readable too.
Tom Lane [Fri, 13 May 2005 16:31:43 +0000 (16:31 +0000)]
Update createuser examples to match the current program behavior,
and add an example showing assignment of a password. Per suggestion
from Jari Aalto (via Martin Pitt).
Neil Conway [Fri, 13 May 2005 06:33:40 +0000 (06:33 +0000)]
Add regression test for consecutive newlines in COPY CSV mode. (There is
no bug related to this functionality in HEAD, but it's worth adding a test
for anyway.) From Andrew Dunstan.
Tom Lane [Thu, 12 May 2005 20:41:56 +0000 (20:41 +0000)]
Remove some unnecessary code: since ExecMakeFunctionResultNoSets does not
want to handle set inputs, it should just pass NULL for isDone, not make
its own failure check.
Neil Conway [Thu, 12 May 2005 00:39:37 +0000 (00:39 +0000)]
This patch makes some minor style cleanups to contrib/btree_gist: remove
the "extern" keyword from function definitions, reorganize some
PG_GETARG_XXX() usage, and similar.
Bruce Momjian [Wed, 11 May 2005 18:05:37 +0000 (18:05 +0000)]
This patch will ensure that the hash table iteration performed by
AtCommit_Portals is restarted when a portal is deleted. This is
necessary since the deletion of a portal may cause the deletion of
another which on rare occations may cause the iterator to return a
deleted portal an thus a renewed attempt delete.
Neil Conway [Wed, 11 May 2005 06:24:55 +0000 (06:24 +0000)]
This patch refactors away some duplicated code in the index AM build
methods: they all invoke UpdateStats() since they have computed the
number of heap tuples, so I created a function in catalog/index.c that
each AM now calls.
Neil Conway [Wed, 11 May 2005 01:41:41 +0000 (01:41 +0000)]
This patch reduces the size of the message header used by statistics
collector messages, per recent discussion on pgsql-patches. This
actually required quite a few changes -- for example,
"databaseid != InvalidOid" was used to check whether a slot in the
backend entry table was initialized, but that no longer works since
the slot might be initialized prior to receiving the BESTART message
which contains the database id. We now use procpid > 0 to indicate
that a slot is non-empty.
Other changes:
- various comment improvements and cleanups
- there's no need to zero-out the entire activity buffer in
pgstat_add_backend(), we can just set activity[0] to '\0'.
- remove the counting of the # of connections to a database; this
was not used anywhere
One change in behavior I wasn't sure about: previously, the code
would create a hash table entry for a database as soon as any message
was received whose header referenced that database. Now, we only
create hash table entries as needed (so for example BESTART won't
create a database hash table entry, since it doesn't need to
access anything in the per-db hash table). It would be easy enough
to retain the old behavior, but AFAICS it is not required.
Neil Conway [Wed, 11 May 2005 01:26:02 +0000 (01:26 +0000)]
Code cleanup: in C89, there is no point casting the first argument to
memset() or MemSet() to a char *. For one, memset()'s first argument is
a void *, and further void * can be implicitly coerced to/from any other
pointer type.
Bruce Momjian [Tue, 10 May 2005 02:16:15 +0000 (02:16 +0000)]
Done:
< * Add session start time and last statement time to pg_stat_activity
> * -Add session start time and last statement time to pg_stat_activity 134c134
< * Add the client IP address and port to pg_stat_activity
> * -Add the client IP address and port to pg_stat_activity
Neil Conway [Mon, 9 May 2005 11:31:34 +0000 (11:31 +0000)]
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.
Tom Lane [Sat, 7 May 2005 21:32:24 +0000 (21:32 +0000)]
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.
Tom Lane [Sat, 7 May 2005 21:22:01 +0000 (21:22 +0000)]
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.
Bruce Momjian [Sat, 7 May 2005 15:45:23 +0000 (15:45 +0000)]
Add description:
< Currently locale can only be set during initdb.
> Currently locale can only be set during initdb. No global tables have
> locale-aware columns. However, the database template used during
> database creation might have locale-aware indexes. The indexes would
> need to be reindexed to match the new locale.
Neil Conway [Sat, 7 May 2005 05:48:50 +0000 (05:48 +0000)]
Revert the ld --as-needed patch. This breaks Fedora Core 3, due to a strange
interaction between ld, readline, termcap, and psql. The symptom is psql
failing with this error on startup:
symbol lookup error: /usr/lib64/libreadline.so.4: undefined symbol: BC
I'm still trying to find the best way to solve this, but in the mean time
I'm reverting the patch in order to unbreak FC3.
Bruce Momjian [Sat, 7 May 2005 04:24:34 +0000 (04:24 +0000)]
Add items:
> * Prevent to_char() on interval from returning meaningless values
>
> For example, to_char('1 month', 'mon') is meaningless. Basically,
> most date-related parameters to to_char() are meaningless for
> intervals because interval is not anchored to a date.
>
> * Allow to_char() on interval values to accumulate the highest unit
> requested
>
> o to_char(INTERVAL '1 hour 5 minutes', 'MI') => 65
> o to_char(INTERVAL '43 hours 20 minutes', 'MI' ) => 2600
> o to_char(INTERVAL '43 hours 20 minutes', 'WK:DD:HR:MI') => 0:1:19:20
> o to_char(INTERVAL '3 years 5 months','MM') => 41
>
> Some special format flag would be required to request such
> accumulation. Such functionality could also be added to EXTRACT.
> Prevent accumulation that crosses the month/day boundary because of
> the uneven number of days in a month.
>
Tom Lane [Fri, 6 May 2005 17:24:55 +0000 (17:24 +0000)]
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.
Tom Lane [Fri, 6 May 2005 00:19:14 +0000 (00:19 +0000)]
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.
Bruce Momjian [Thu, 5 May 2005 19:15:54 +0000 (19:15 +0000)]
On Win32, libintl replaces snprintf() with its own version that
understands arg control, so we don't need our own. In fact, it
also uses macros that conflict with ours, so we _can't_ use
our own.
Neil Conway [Thu, 5 May 2005 11:50:18 +0000 (11:50 +0000)]
The issue has been raised in the past that our build system links each
executable against the maximal set of libraries it might need. So for
example, if one executable requires `libreadline', all executables are
linked against it.
The easiest fix is to make use of GNU ld's --as-needed flag, which
ignores linker arguments that are not actually needed by the specified
object files. The attached patch modifies configure to check for this
flag (when using GNU ld), and if ld supports it, adds the flag to
LDFLAGS (we need to do the check since only relatively recent versions
of GNU ld support this capability). Currently only GNU ld is supported;
I'm not aware of any other linkers that support this functionality.
Tom Lane [Thu, 5 May 2005 03:37:23 +0000 (03:37 +0000)]
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.
Tom Lane [Thu, 5 May 2005 00:19:47 +0000 (00:19 +0000)]
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.
Tom Lane [Tue, 3 May 2005 19:42:41 +0000 (19:42 +0000)]
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.
Tom Lane [Tue, 3 May 2005 19:17:59 +0000 (19:17 +0000)]
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.
Tom Lane [Tue, 3 May 2005 16:51:00 +0000 (16:51 +0000)]
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 :-(
Neil Conway [Mon, 2 May 2005 00:37:07 +0000 (00:37 +0000)]
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.
Tom Lane [Sun, 1 May 2005 18:56:19 +0000 (18:56 +0000)]
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.