]> granicus.if.org Git - postgresql/log
postgresql
16 years agoRewrite the sinval messaging mechanism to reduce contention and avoid
Tom Lane [Thu, 19 Jun 2008 21:32:56 +0000 (21:32 +0000)]
Rewrite the sinval messaging mechanism to reduce contention and avoid
unnecessary cache resets.  The major changes are:

* When the queue overflows, we only issue a cache reset to the specific
backend or backends that still haven't read the oldest message, rather
than resetting everyone as in the original coding.

* When we observe backend(s) falling well behind, we signal SIGUSR1
to only one backend, the one that is furthest behind and doesn't already
have a signal outstanding for it.  When it finishes catching up, it will
in turn signal SIGUSR1 to the next-furthest-back guy, if there is one that
is far enough behind to justify a signal.  The PMSIGNAL_WAKEN_CHILDREN
mechanism is removed.

* We don't attempt to clean out dead messages after every message-receipt
operation; rather, we do it on the insertion side, and only when the queue
fullness passes certain thresholds.

* Split SInvalLock into SInvalReadLock and SInvalWriteLock so that readers
don't block writers nor vice versa (except during the infrequent queue
cleanout operations).

* Transfer multiple sinval messages for each acquisition of a read or
write lock.

16 years agoFix a few places that were non-multibyte-safe in tsearch configuration file
Tom Lane [Thu, 19 Jun 2008 16:52:24 +0000 (16:52 +0000)]
Fix a few places that were non-multibyte-safe in tsearch configuration file
parsing.  Per bug #4253 from Giorgio Valoti.

16 years agoAdd URL for:
Bruce Momjian [Thu, 19 Jun 2008 01:15:48 +0000 (01:15 +0000)]
Add URL for:

        o Allow pg_hba.conf to specify host names along with IP addresses
>    http://archives.postgresql.org/pgsql-hackers/2008-06/msg00569.php

16 years agoImprove our #include situation by moving pointer types away from the
Alvaro Herrera [Thu, 19 Jun 2008 00:46:06 +0000 (00:46 +0000)]
Improve our #include situation by moving pointer types away from the
corresponding struct definitions.  This allows other headers to avoid including
certain highly-loaded headers such as rel.h and relscan.h, instead using just
relcache.h, heapam.h or genam.h, which are more lightweight and thus cause less
unnecessary dependencies.

16 years agoFix compiler warning introduced by recent patch. Tsk tsk.
Tom Lane [Wed, 18 Jun 2008 23:08:47 +0000 (23:08 +0000)]
Fix compiler warning introduced by recent patch.  Tsk tsk.

16 years agoImprove error reporting for problems in text search configuration files
Tom Lane [Wed, 18 Jun 2008 20:55:42 +0000 (20:55 +0000)]
Improve error reporting for problems in text search configuration files
by installing an error context subroutine that will provide the file name
and line number for all errors detected while reading a config file.
Some of the reader routines were already doing that in an ad-hoc way for
errors detected directly in the reader, but it didn't help for problems
detected in subroutines, such as encoding violations.

Back-patch to 8.3 because 8.3 is where people will be trying to debug
configuration files.

16 years agoMove wchar2char() and char2wchar() from tsearch into /mb to be easier to
Bruce Momjian [Wed, 18 Jun 2008 18:42:54 +0000 (18:42 +0000)]
Move wchar2char() and char2wchar() from tsearch into /mb to be easier to
use for other modules;  also move pnstrdup().

Clean up code slightly.

16 years agoFix a few typos in the DTrace docs. Patch from Euler Taveira de Oliveira,
Neil Conway [Wed, 18 Jun 2008 17:44:12 +0000 (17:44 +0000)]
Fix a few typos in the DTrace docs. Patch from Euler Taveira de Oliveira,
along with an additional typo I noticed along the way.

16 years agoRemove freeBackends counter from the sinval shared memory area. We used to
Tom Lane [Tue, 17 Jun 2008 20:07:08 +0000 (20:07 +0000)]
Remove freeBackends counter from the sinval shared memory area.  We used to
use it to help enforce superuser_reserved_backends, but since 8.1 it's
just been dead weight.

16 years agoClean up some problems with redundant cross-type arithmetic operators. Add
Tom Lane [Tue, 17 Jun 2008 19:10:56 +0000 (19:10 +0000)]
Clean up some problems with redundant cross-type arithmetic operators.  Add
int2-and-int8 implementations of the basic arithmetic operators +, -, *, /.
This doesn't really add any new functionality, but it avoids "operator is not
unique" failures that formerly occurred in these cases because the parser
couldn't decide whether to promote the int2 to int4 or int8.  We could
alternatively have removed the existing cross-type operators, but
experimentation shows that the cost of an additional type coercion expression
node is noticeable compared to such cheap operators; so let's not give up any
performance here.  On the other hand, I removed the int2-and-int4 modulo (%)
operators since they didn't seem as important from a performance standpoint.
Per a complaint last January from ykhuang.

16 years agoAdd URL for introduction to multibyte programming in C.
Bruce Momjian [Tue, 17 Jun 2008 18:22:43 +0000 (18:22 +0000)]
Add URL for introduction to multibyte programming in C.

16 years agoMove USE_WIDE_UPPER_LOWER define to c.h, and remove TS_USE_WIDE and use
Bruce Momjian [Tue, 17 Jun 2008 16:09:06 +0000 (16:09 +0000)]
Move USE_WIDE_UPPER_LOWER define to c.h, and remove TS_USE_WIDE and use
USE_WIDE_UPPER_LOWER instead.

16 years agoFix the code that adds regclass constants to a plan's list of relation OIDs
Tom Lane [Tue, 17 Jun 2008 14:51:32 +0000 (14:51 +0000)]
Fix the code that adds regclass constants to a plan's list of relation OIDs
that it depends on for replan-forcing purposes.  We need to consider plain OID
constants too, because eval_const_expressions folds a RelabelType atop a Const
to just a Const.  This change could result in OID values that aren't really
for tables getting added to the dependency list, but the worst-case
consequence would be occasional useless replans.  Per report from Gabriele
Messineo.

16 years agoClean up a number of bogosities around pltcl's handling of the Tcl "result":
Tom Lane [Tue, 17 Jun 2008 00:52:43 +0000 (00:52 +0000)]
Clean up a number of bogosities around pltcl's handling of the Tcl "result":

1. Directly reading interp->result is deprecated in Tcl 8.0 and later;
you're supposed to use Tcl_GetStringResult.  This code finally broke with
Tcl 8.5, because Tcl_GetVar can now have side-effects on interp->result even
though it preserves the logical state of the result.  (There's arguably a
Tcl issue here, because Tcl_GetVar could invalidate the pointer result of a
just-preceding Tcl_GetStringResult, but I doubt the Tcl guys will see it as
a bug.)

2. We were being sloppy about the encoding of the result: some places would
push database-encoding data into the Tcl result, which should not happen,
and we were assuming that any error result coming back from Tcl was in the
database encoding, which is not a good assumption.

3. There were a lot of calls of Tcl_SetResult that uselessly specified
TCL_VOLATILE for constant strings.  This is only a minor performance issue,
but I fixed it in passing since I had to look at all the calls anyway.

#2 is a live bug regardless of which Tcl version you are interested in,
so back-patch even to branches that are unlikely to be used with Tcl 8.5.
I went back as far as 8.0, which is as far as the patch applied easily;
7.4 was using a different error processing scheme that has got its own
problems :-(

16 years agoRewrite docs section about routine vacuuming --- it's gotten rather mangled of
Tom Lane [Mon, 16 Jun 2008 03:13:14 +0000 (03:13 +0000)]
Rewrite docs section about routine vacuuming --- it's gotten rather mangled of
late, with lots of redundancy, bad grammar, and just plain poor exposition.
Make it clear that autovacuum is now considered the normal solution.

16 years agoPrevent CVS from mangling script
Andrew Dunstan [Sun, 15 Jun 2008 21:58:55 +0000 (21:58 +0000)]
Prevent CVS from mangling script

16 years agoAdd script to find .c and .h files that are missing CVS PostgreSQL markers
Andrew Dunstan [Sun, 15 Jun 2008 21:46:02 +0000 (21:46 +0000)]
Add script to find .c and .h files that are missing CVS PostgreSQL markers
and add them. Avoids third party files or those that would cause regression
failures.

16 years agoMake DROP INDEX lock the parent table before locking the index. This behavior
Tom Lane [Sun, 15 Jun 2008 16:29:05 +0000 (16:29 +0000)]
Make DROP INDEX lock the parent table before locking the index.  This behavior
is necessary to avoid deadlock against ordinary queries, but we'd broken it
with recent changes that made the DROP machinery lock the index before
arriving at index_drop.  Per intermittent buildfarm failures.

16 years agoFix 64-bit problem in recent patch.
Tom Lane [Sun, 15 Jun 2008 01:41:37 +0000 (01:41 +0000)]
Fix 64-bit problem in recent patch.

16 years agoRearrange ALTER TABLE syntax processing as per my recent proposal: the
Tom Lane [Sun, 15 Jun 2008 01:25:54 +0000 (01:25 +0000)]
Rearrange ALTER TABLE syntax processing as per my recent proposal: the
grammar allows ALTER TABLE/INDEX/SEQUENCE/VIEW interchangeably for all
subforms of those commands, and then we sort out what's really legal
at execution time.  This allows the ALTER SEQUENCE/VIEW reference pages
to fully document all the ALTER forms available for sequences and views
respectively, and eliminates a longstanding cause of confusion for users.

The net effect is that the following forms are allowed that weren't before:
ALTER SEQUENCE OWNER TO
ALTER VIEW ALTER COLUMN SET/DROP DEFAULT
ALTER VIEW OWNER TO
ALTER VIEW SET SCHEMA
(There's no actual functionality gain here, but formerly you had to say
ALTER TABLE instead.)

Interestingly, the grammar tables actually get smaller, probably because
there are fewer special cases to keep track of.

I did not disallow using ALTER TABLE for these operations.  Perhaps we
should, but there's a backwards-compatibility issue if we do; in fact
it would break existing pg_dump scripts.  I did however tighten up
ALTER SEQUENCE and ALTER VIEW to reject non-sequences and non-views
in the new cases as well as a couple of cases where they didn't before.

The patch doesn't change pg_dump to use the new syntaxes, either.

16 years agoIn log_filename documentation, mention that strftime is not used directly to
Alvaro Herrera [Sat, 14 Jun 2008 21:59:59 +0000 (21:59 +0000)]
In log_filename documentation, mention that strftime is not used directly to
expand the pattern specifier.

Per gripe from Josh Drake.

16 years agoRefactor the handling of the various DropStmt variants so that when multiple
Tom Lane [Sat, 14 Jun 2008 18:04:34 +0000 (18:04 +0000)]
Refactor the handling of the various DropStmt variants so that when multiple
objects are specified, we drop them all in a single performMultipleDeletions
call.  This makes the RESTRICT/CASCADE checks more relaxed: it's not counted
as a cascade if one of the later objects has a dependency on an earlier one.
NOTICE messages about such cases go away, too.

In passing, fix the permissions check for DROP CONVERSION, which for some
reason was never made role-aware, and omitted the namespace-owner exemption
too.

Alex Hunsaker, with further fiddling by me.

16 years agoModify TODO entry to be a function:
Bruce Momjian [Fri, 13 Jun 2008 16:24:38 +0000 (16:24 +0000)]
Modify TODO entry to be a function:

>  o Add functions to syntax check configuration files
>
< * Add pg_ctl option to do a syntax check of postgresql.conf

16 years agoImprove the various elog messages in tuptoaster.c to report which TOAST table
Tom Lane [Fri, 13 Jun 2008 02:59:47 +0000 (02:59 +0000)]
Improve the various elog messages in tuptoaster.c to report which TOAST table
the problem happened in.  These are all supposedly can't-happen cases, but
when they do happen it's useful to know where.

Back-patch to 8.3, but not further because the patch doesn't apply cleanly
further back.  Given the lack of response to my proposal of this, there
doesn't seem to be enough interest to justify much back-porting effort.

16 years agoUse macro to document size of ecpg sqlerrmc string.
Bruce Momjian [Thu, 12 Jun 2008 19:15:40 +0000 (19:15 +0000)]
Use macro to document size of ecpg sqlerrmc string.

16 years agoUpdate item to mention target list problem:
Bruce Momjian [Thu, 12 Jun 2008 18:09:04 +0000 (18:09 +0000)]
Update item to mention target list problem:

< * Allow INSERT/UPDATE ... RETURNING inside a SELECT 'FROM' clause
> * Allow INSERT/UPDATE ... RETURNING inside a SELECT 'FROM' clause or
>   target list
>   http://archives.postgresql.org/pgsql-hackers/2008-06/msg00124.php

16 years agoRefactor XLogOpenRelation() and XLogReadBuffer() in preparation for relation
Heikki Linnakangas [Thu, 12 Jun 2008 09:12:31 +0000 (09:12 +0000)]
Refactor XLogOpenRelation() and XLogReadBuffer() in preparation for relation
forks. XLogOpenRelation() and the associated light-weight relation cache in
xlogutils.c is gone, and XLogReadBuffer() now takes a RelFileNode as argument,
instead of Relation.

For functions that still need a Relation struct during WAL replay, there's a
new function called CreateFakeRelcacheEntry() that returns a fake entry like
XLogOpenRelation() used to.

16 years agoImprove reporting of dependencies in DROP to work like the scheme that we
Tom Lane [Wed, 11 Jun 2008 21:53:49 +0000 (21:53 +0000)]
Improve reporting of dependencies in DROP to work like the scheme that we
devised for pg_shdepend, namely the individual dependencies are reported as
DETAIL lines rather than coming out as separate NOTICEs.  The client-side
report is capped at 100 lines, but the server log always gets a full report.

16 years agoAdd:
Bruce Momjian [Wed, 11 Jun 2008 20:54:31 +0000 (20:54 +0000)]
Add:

> * Add pg_ctl option to do a syntax check of postgresql.conf

16 years agoFix spelling mistake in postgresql.conf.
Bruce Momjian [Wed, 11 Jun 2008 15:44:52 +0000 (15:44 +0000)]
Fix spelling mistake in postgresql.conf.

Greg Sabino Mullane

16 years agoUpdate "help" output to reflect that \timing now takes an optional on/off
Heikki Linnakangas [Wed, 11 Jun 2008 10:55:43 +0000 (10:55 +0000)]
Update "help" output to reflect that \timing now takes an optional on/off
argument.

16 years agoAdd optional on/off argument to \timing.
Heikki Linnakangas [Wed, 11 Jun 2008 10:48:17 +0000 (10:48 +0000)]
Add optional on/off argument to \timing.

David Fetter.

16 years agoFix bug in the WAL recovery code to finish an incomplete split.
Heikki Linnakangas [Wed, 11 Jun 2008 08:38:56 +0000 (08:38 +0000)]
Fix bug in the WAL recovery code to finish an incomplete split.
CacheInvalidateRelcache() crashes if called in WAL recovery, because the
invalidation infrastructure hasn't been initialized yet.

Back-patch to 8.2, where the bug was introduced.

16 years agoEditorialization for the text emitted by the "help" psql command.
Neil Conway [Tue, 10 Jun 2008 20:58:19 +0000 (20:58 +0000)]
Editorialization for the text emitted by the "help" psql command.
Basically just reuse the same text that psql emitted as part of
its startup banner in prior versions, and make some whitespace
more consistent with the conventions in other psql command output.

16 years agoCreate a script to handle stamping release version numbers into files,
Tom Lane [Tue, 10 Jun 2008 18:08:48 +0000 (18:08 +0000)]
Create a script to handle stamping release version numbers into files,
replacing the tedious and error-prone manual process we've been using.

16 years agoComment fix, should say TSQuery instead of TSVector.
Heikki Linnakangas [Tue, 10 Jun 2008 08:55:50 +0000 (08:55 +0000)]
Comment fix, should say TSQuery instead of TSVector.

Per Jan Urbanski.

16 years agoMake XML building work silently on VPATH builds (untested on regular builds).
Alvaro Herrera [Tue, 10 Jun 2008 00:19:32 +0000 (00:19 +0000)]
Make XML building work silently on VPATH builds (untested on regular builds).

16 years agoFix unportable (and incorrect anyway) usage of LL constant suffix that
Tom Lane [Mon, 9 Jun 2008 19:58:39 +0000 (19:58 +0000)]
Fix unportable (and incorrect anyway) usage of LL constant suffix that
recently snuck into cash.c.  Per report from Edmundo Robles Lopez.

16 years agoUpdate Japanese FAQ.
Bruce Momjian [Mon, 9 Jun 2008 19:37:16 +0000 (19:37 +0000)]
Update Japanese FAQ.

Jun Kuwamura

16 years agoFix datetime input functions to correctly detect integer overflow when
Tom Lane [Mon, 9 Jun 2008 19:34:02 +0000 (19:34 +0000)]
Fix datetime input functions to correctly detect integer overflow when
running on a 64-bit platform ... strtol() will happily return 64-bit
output in that case.  Per bug #4231 from Geoff Tolley.

16 years agoFix an ALTER TABLE test case so that it actually tests what the comment says it
Tom Lane [Mon, 9 Jun 2008 18:28:00 +0000 (18:28 +0000)]
Fix an ALTER TABLE test case so that it actually tests what the comment says it
is testing.  Ah, the perils of making keywords optional ...

16 years agoFurther tweak for comment in CheckDeadLock(), per Tom.
Neil Conway [Mon, 9 Jun 2008 18:23:05 +0000 (18:23 +0000)]
Further tweak for comment in CheckDeadLock(), per Tom.

16 years agoFix typo in comment.
Neil Conway [Mon, 9 Jun 2008 06:55:34 +0000 (06:55 +0000)]
Fix typo in comment.

16 years agoFix breakage caused by conflicting patches, as evidenced by the buildfarm.
Alvaro Herrera [Sun, 8 Jun 2008 23:16:43 +0000 (23:16 +0000)]
Fix breakage caused by conflicting patches, as evidenced by the buildfarm.

16 years agoRewrite DROP's dependency traversal algorithm into an honest two-pass
Tom Lane [Sun, 8 Jun 2008 22:41:04 +0000 (22:41 +0000)]
Rewrite DROP's dependency traversal algorithm into an honest two-pass
algorithm, replacing the original intention of a one-pass search, which
had been hacked up over time to be partially two-pass in hopes of handling
various corner cases better.  It still wasn't quite there, especially as
regards emitting unwanted NOTICE messages.  More importantly, this approach
lets us fix a number of open bugs concerning concurrent DROP scenarios,
because we can take locks during the first pass and avoid traversing to
dependent objects that were just deleted by someone else.

There is more that can be done here, but I'll go ahead and commit the
base patch before working on the options.

16 years agoMove BufferGetPageSize and BufferGetPage from bufpage.h to bufmgr.h. It is
Alvaro Herrera [Sun, 8 Jun 2008 22:00:48 +0000 (22:00 +0000)]
Move BufferGetPageSize and BufferGetPage from bufpage.h to bufmgr.h.  It is
more logical that way, and also it reduces the amount of unnecessary includes
in bufpage.h, which is widely used.

Zdenek Kotala.

My previous patch to bufpage.h should also have credited him as author, but I
forgot (sorry about that).

16 years agoUpdate release notes for ALTER AGGREGATE fix.
Tom Lane [Sun, 8 Jun 2008 21:46:07 +0000 (21:46 +0000)]
Update release notes for ALTER AGGREGATE fix.

16 years agoALTER AGGREGATE OWNER seems to have been missed by the last couple of
Tom Lane [Sun, 8 Jun 2008 21:09:48 +0000 (21:09 +0000)]
ALTER AGGREGATE OWNER seems to have been missed by the last couple of
patches that dealt with object ownership.  It wasn't updating pg_shdepend
nor adjusting the aggregate's ACL.  In 8.2 and up, fix this permanently
by making it use AlterFunctionOwner_oid.  In 8.1, the function code wasn't
factored that way, so just copy and paste.

16 years agoUpdate release notes for 8.3.3 et al.
Tom Lane [Sat, 7 Jun 2008 22:10:38 +0000 (22:10 +0000)]
Update release notes for 8.3.3 et al.

16 years agoChange xlog.h to xlogdefs.h in bufpage.h, and fix fallout.
Alvaro Herrera [Fri, 6 Jun 2008 22:35:22 +0000 (22:35 +0000)]
Change xlog.h to xlogdefs.h in bufpage.h, and fix fallout.

16 years agoFix pg_get_ruledef() so that negative numeric constants are parenthesized.
Tom Lane [Fri, 6 Jun 2008 17:59:29 +0000 (17:59 +0000)]
Fix pg_get_ruledef() so that negative numeric constants are parenthesized.
This is needed because :: casting binds more tightly than minus, so for
example -1::integer is not the same as (-1)::integer, and there are cases
where the difference is important.  In particular this caused a failure
in SELECT DISTINCT ... ORDER BY ... where expressions that should have
matched were seen as different by the parser; but I suspect that there
could be other cases where failure to parenthesize leads to subtler
semantic differences in reloaded rules.  Per report from Alexandr Popov.

16 years agoFix missing "not", per Frank Millman (bug #4212).
Alvaro Herrera [Thu, 5 Jun 2008 19:56:09 +0000 (19:56 +0000)]
Fix missing "not", per Frank Millman (bug #4212).

16 years agoModify vacuum() to accept a single relation OID instead of a list (which we
Alvaro Herrera [Thu, 5 Jun 2008 15:47:32 +0000 (15:47 +0000)]
Modify vacuum() to accept a single relation OID instead of a list (which we
always pass as a single element anyway.)  In passing, fix an outdated comment.

16 years agoFix some string building in getObjectDescription.
Alvaro Herrera [Thu, 5 Jun 2008 15:04:39 +0000 (15:04 +0000)]
Fix some string building in getObjectDescription.

16 years agoAdded lost sysmbol SQL_SQL to list of allowed variable names.
Michael Meskes [Wed, 4 Jun 2008 12:23:34 +0000 (12:23 +0000)]
Added lost sysmbol SQL_SQL to list of allowed variable names.

16 years agoDraft release notes for upcoming back-branch updates.
Tom Lane [Wed, 4 Jun 2008 03:16:02 +0000 (03:16 +0000)]
Draft release notes for upcoming back-branch updates.

16 years agoFix initdb to reject a relative path for -X (--xlogdir) argument. This
Tom Lane [Mon, 2 Jun 2008 03:48:00 +0000 (03:48 +0000)]
Fix initdb to reject a relative path for -X (--xlogdir) argument.  This
doesn't work, and the real reason why not is it's unclear where the path
is relative to (initdb's CWD, or the data directory?).  We could make an
arbitrary decision, but it seems best to make the user be unambiguous.
Per gripe from Devrim.

16 years agoUpdate time zone data files to tzdata release 2008c (DST law changes in
Tom Lane [Sun, 1 Jun 2008 18:23:00 +0000 (18:23 +0000)]
Update time zone data files to tzdata release 2008c (DST law changes in
Morocco, Iraq, Choibalsan, Pakistan, Syria, Cuba, Argentina/San_Luis).

16 years agoRefactor SPI_cursor_open/SPI_cursor_open_with_args so that the latter sets
Tom Lane [Sun, 1 Jun 2008 17:32:48 +0000 (17:32 +0000)]
Refactor SPI_cursor_open/SPI_cursor_open_with_args so that the latter sets
the PARAM_FLAG_CONST flag on the parameters that are passed into the portal,
while the former's behavior is unchanged.  This should only affect the case
where the portal is executing an EXPLAIN; it will cause the generated plan to
look more like what would be generated if the portal were actually executing
the command being explained.  Per gripe from Pavel.

16 years agoMarginal improvements to the documentation for PGOPTIONS.
Tom Lane [Sun, 1 Jun 2008 16:23:08 +0000 (16:23 +0000)]
Marginal improvements to the documentation for PGOPTIONS.

16 years agoDone: -Remove psql newline patch when we find out why mingw outputs an extra newline
Andrew Dunstan [Sat, 31 May 2008 15:05:46 +0000 (15:05 +0000)]
Done:  -Remove psql newline patch when we find out why mingw outputs an extra newline

16 years agoCopy refint.so and autoinc.so into the src/test/regress directory during
Tom Lane [Fri, 30 May 2008 00:04:32 +0000 (00:04 +0000)]
Copy refint.so and autoinc.so into the src/test/regress directory during
"make all", and then reference them there during the actual tests.  This
makes the handling of these files more parallel to that of regress.so,
and in particular simplifies use of the regression tests outside the
original build tree.  The PGDG and Red Hat RPMs have been doing this via
patches for a very long time.  Inclusion of the change in core was requested
by Jørgen Austvik of Sun, and I can't see any reason not to.

I attempted to fix the MSVC scripts for this too, but they may need
further tweaking ...

16 years agoImprove the documentation comment for replace(). Robert Treat
Tom Lane [Thu, 29 May 2008 22:48:07 +0000 (22:48 +0000)]
Improve the documentation comment for replace().  Robert Treat

16 years agoTweak libpq to avoid crashing due to incorrect buffer size calculation when
Tom Lane [Thu, 29 May 2008 22:02:44 +0000 (22:02 +0000)]
Tweak libpq to avoid crashing due to incorrect buffer size calculation when
we are on a 64-bit machine (ie, size_t is wider than int) and someone passes
in a query string that approaches or exceeds INT_MAX bytes.  Also, just for
paranoia's sake, guard against similar overflows in sizing the input buffer.

The backend will not in the foreseeable future be prepared to send or receive
strings exceeding 1GB, so I didn't take the more invasive step of switching
all the buffer index variables from int to size_t; though someday we might
want to do that.

I have a suspicion that this is not the only such bug in libpq, but this
fix is enough to take care of the crash reported by Francisco Reyes.

16 years agoFix some bugs introduced by the 8.2-era conversion of cube functions to V1
Tom Lane [Thu, 29 May 2008 18:46:40 +0000 (18:46 +0000)]
Fix some bugs introduced by the 8.2-era conversion of cube functions to V1
calling convention.  cube_inter and cube_distance could attempt to pfree
their input arguments, and cube_dim returned a value from a struct it
might have just pfree'd (which would only really cause a problem in a
debug build, but it's still wrong).  Per bug #4208 and additional code
reading.

In HEAD and 8.3, I also made a batch of cosmetic changes to bring these
functions into line with the preferred coding style for V1 functions,
ie declare and fetch all the arguments at the top so readers can easily
see what they are.

16 years agoAdd description to:
Bruce Momjian [Thu, 29 May 2008 02:04:15 +0000 (02:04 +0000)]
Add description to:

* Add deferred trigger queue file

<   This item involves dumping large queues into files.
>   This item involves dumping large queues into files, or doing some
>   kind of join to process all the triggers, or some bulk operation.

16 years agoAdd URL for:
Bruce Momjian [Thu, 29 May 2008 01:58:29 +0000 (01:58 +0000)]
Add URL for:

* Add deferred trigger queue file

>   http://archives.postgresql.org/pgsql-hackers/2008-05/msg00876.php

16 years agoSet hidden field for guc enum missed in previous commit.
Magnus Hagander [Wed, 28 May 2008 15:22:05 +0000 (15:22 +0000)]
Set hidden field for guc enum missed in previous commit.

16 years agoAdd a field to guc enums to allow hiding of values from display while
Magnus Hagander [Wed, 28 May 2008 09:04:06 +0000 (09:04 +0000)]
Add a field to guc enums to allow hiding of values from display while
still accepting them as input, used to allow alternate syntax for the
same setting.

Alex Hunsaker

16 years agoImprove GRANT documentation to point out that UPDATE and DELETE typically
Tom Lane [Wed, 28 May 2008 00:45:40 +0000 (00:45 +0000)]
Improve GRANT documentation to point out that UPDATE and DELETE typically
require SELECT privilege as well, since you normally need to read existing
column values within such commands.  This behavior is according to spec,
but we'd never documented it before.  Per gripe from Volkan Yazici.

16 years agoRequire bind_textdomain_codeset() not just gettext() to enable NLS support.
Tom Lane [Tue, 27 May 2008 22:18:04 +0000 (22:18 +0000)]
Require bind_textdomain_codeset() not just gettext() to enable NLS support.
GNU gettext before 0.10.36 does not have that function, and is generally too
incomplete to be usable.

16 years agoClarify description of typmod input function, per Jeff Davis.
Tom Lane [Tue, 27 May 2008 18:05:13 +0000 (18:05 +0000)]
Clarify description of typmod input function, per Jeff Davis.

16 years agoExplicitly bind gettext() to the UTF8 locale when in use.
Magnus Hagander [Tue, 27 May 2008 12:24:42 +0000 (12:24 +0000)]
Explicitly bind gettext() to the  UTF8 locale when in use.
This is required on Windows due to the special locale
handling for UTF8 that doesn't change the full environment.

Fixes crash with translated error messages per bugs 4180
and 4196.

Tom Lane

16 years agoAlter the xxx_pattern_ops opclasses to use the regular equality operator of
Tom Lane [Tue, 27 May 2008 00:13:09 +0000 (00:13 +0000)]
Alter the xxx_pattern_ops opclasses to use the regular equality operator of
the associated datatype as their equality member.  This means that these
opclasses can now support plain equality comparisons along with LIKE tests,
thus avoiding the need for an extra index in some applications.  This
optimization was not possible when the pattern opclasses were first introduced,
because we didn't insist that text equality meant bitwise equality; but we
do now, so there is no semantic difference between regular and pattern
equality operators.

I removed the name_pattern_ops opclass altogether, since it's really useless:
name's regular comparisons are just strcmp() and are unlikely to become
something different.  Instead teach indxpath.c that btree name_ops can be
used for LIKE whether or not the locale is C.  This might lead to a useful
speedup in LIKE queries on the system catalogs in non-C locales.

The ~=~ and ~<>~ operators are gone altogether.  (It would have been nice to
keep them for backward compatibility's sake, but since the pg_amop structure
doesn't allow multiple equality operators per opclass, there's no way.)

A not-immediately-obvious incompatibility is that the sort order within
bpchar_pattern_ops indexes changes --- it had been identical to plain
strcmp, but is now trailing-blank-insensitive.  This will impact
in-place upgrades, if those ever happen.

Per discussions a couple months ago.

16 years agoFix an old corner-case bug in set_config_option: push_old_value has to be
Tom Lane [Mon, 26 May 2008 18:54:29 +0000 (18:54 +0000)]
Fix an old corner-case bug in set_config_option: push_old_value has to be
called before, not after, calling the assign_hook if any.  This is because
push_old_value might fail (due to palloc out-of-memory), and in that case
there would be no stack entry to tell transaction abort to undo the GUC
assignment.  Of course the actual assignment to the GUC variable hasn't
happened yet --- but the assign_hook might have altered subsidiary state.
Without a stack entry we won't call it again to make it undo such actions.
So this is necessary to make the world safe for assign_hooks with side
effects.  Per a discussion a couple weeks ago with Magnus.

Back-patch to 8.0.  7.x did not have the problem because it did not have
allocatable stacks of GUC values.

16 years agoAdjust timestamp regression tests to prevent two low-probability failure
Tom Lane [Sun, 25 May 2008 21:51:00 +0000 (21:51 +0000)]
Adjust timestamp regression tests to prevent two low-probability failure
cases.  Recent buildfarm experience shows that it is sometimes possible
to execute several SQL commands in less time than the granularity of
Windows' not-very-high-resolution gettimeofday(), leading to a failure
because the tests expect the value of now() to change and it doesn't.
Also, it was recognized some time ago that the same area of the tests
could fail if local midnight passes between the insertion and the checking
of the values for 'yesterday', 'tomorrow', etc.  Clean all this up per
ideas from myself and Greg Stark.

There remains a window for failure if the transaction block is entered
exactly at local midnight (so that 'now' and 'today' have the same value),
but that seems low-probability enough to live with.

Since the point of this change is mostly to eliminate buildfarm noise,
back-patch to all versions we are still actively testing.

16 years agoLink in keywords file instead of copying it.
Michael Meskes [Wed, 21 May 2008 19:51:01 +0000 (19:51 +0000)]
Link in keywords file instead of copying it.
Use #define/#ifdef instead of sed to fix include files, this should work on Windows too.

16 years agoAdd include directory required after the latest changes to the ecpg build.
Magnus Hagander [Wed, 21 May 2008 18:15:29 +0000 (18:15 +0000)]
Add include directory required after the latest changes to the ecpg build.
Per red Windows buildfarm members.

16 years agoFix function headers not matching prototype in header file, per
Magnus Hagander [Wed, 21 May 2008 16:00:10 +0000 (16:00 +0000)]
Fix function headers not matching prototype in header file, per
compiler warnings on msvc.

16 years agoUse CRITICAL_SECTION instead of Mutexes for thread-locking in libpq on
Magnus Hagander [Wed, 21 May 2008 14:20:48 +0000 (14:20 +0000)]
Use CRITICAL_SECTION instead of Mutexes for thread-locking in libpq on
Windows, for better performance.

Per suggestion from Andrew Chernow, but not his patch since the underlying
code was changed to deal with return values.

16 years agoecpg_keywords.o also depends on preproc.h
Michael Meskes [Wed, 21 May 2008 00:26:26 +0000 (00:26 +0000)]
ecpg_keywords.o also depends on preproc.h

16 years agoSynced parser.
Michael Meskes [Tue, 20 May 2008 23:17:32 +0000 (23:17 +0000)]
Synced parser.
Made ecpg parser use backend provided keyword list.
Changed whenever test so exit value is 0.

16 years agoAdjust -Wl,--asneeded test to avoid using the switch if it breaks
Tom Lane [Tue, 20 May 2008 03:30:22 +0000 (03:30 +0000)]
Adjust -Wl,--asneeded test to avoid using the switch if it breaks
libreadline.  What we will do for compatibility :-(

16 years agoSimplify code in formatting.c now that to upper/lower/initcase do not
Bruce Momjian [Tue, 20 May 2008 01:41:02 +0000 (01:41 +0000)]
Simplify code in formatting.c now that to upper/lower/initcase do not
modify the passed string.

16 years agoDone:
Bruce Momjian [Tue, 20 May 2008 00:35:45 +0000 (00:35 +0000)]
Done:

<  o Use LC_TIME for localized weekday/month names, rather than
>  o -Use LC_TIME for localized weekday/month names, rather than

16 years agoRemove arbitrary 10MB limit on two-phase state file size. It's not that hard
Heikki Linnakangas [Mon, 19 May 2008 18:16:26 +0000 (18:16 +0000)]
Remove arbitrary 10MB limit on two-phase state file size. It's not that hard
to go beoynd 10MB, as demonstrated by Gavin Sharry's example of dropping a
schema with ~25000 objects. The really bogus thing about the limit was that
it was enforced when a state file file was read in, not when it was written,
so you would end up with a prepared transaction that you can't commit or
abort, and the only recourse was to shut down the server and remove the file
by hand.

Raise the limit to MaxAllocSize, and enforce it also when a state file is
written. We could've removed the limit altogether, but reading in a file
larger than MaxAllocSize would fail anyway because we read it into a
palloc'd buffer.

Backpatch down to 8.1, where 2PC and this issue was introduced.

16 years agoMake to_char()'s localized month/day names depend on LC_TIME, not LC_MESSAGES.
Tom Lane [Mon, 19 May 2008 18:08:16 +0000 (18:08 +0000)]
Make to_char()'s localized month/day names depend on LC_TIME, not LC_MESSAGES.

Euler Taveira de Oliveira

16 years agoCoercion sanity check in ri_HashCompareOp failed to allow for enums, as per
Tom Lane [Mon, 19 May 2008 04:14:24 +0000 (04:14 +0000)]
Coercion sanity check in ri_HashCompareOp failed to allow for enums, as per
example from Rod Taylor.  On reflection the correct test here is for any
polymorphic type, not specifically ANYARRAY as in the original coding.

16 years agoMake another try at using -Wl,--as-needed to suppress linking of unnecessary
Tom Lane [Sun, 18 May 2008 20:13:12 +0000 (20:13 +0000)]
Make another try at using -Wl,--as-needed to suppress linking of unnecessary
shared libraries.  We've tried this before and had problems with libreadline
not linking properly on some platforms, but that seems to be a libreadline
bug that may have been fixed by now.  In any case, it's early enough in the
8.4 devel cycle that we can afford to have some transient breakage while
we work out any portability problems.

On Darwin, we try -Wl,-dead_strip_dylibs, which seems to be the equivalent
incantation there.

16 years agoRemove old kluge put in to allow Windows regression tests to succeed, and now
Andrew Dunstan [Sun, 18 May 2008 06:50:08 +0000 (06:50 +0000)]
Remove old kluge put in to allow Windows regression tests to succeed, and now
found to have been made necessary by our skipping tty detection on Windows. Now
that we are doing tty detection on Windows the kluge is unnecessary and wrong.

16 years agookay, looks like ecpg/compatlib needs -lintl too.
Tom Lane [Sun, 18 May 2008 03:24:17 +0000 (03:24 +0000)]
okay, looks like ecpg/compatlib needs -lintl too.
Per buildfarm results.

16 years agoRewrite the warning about non-transaction-safety of TRUNCATE ... RESTART
Tom Lane [Sat, 17 May 2008 23:36:27 +0000 (23:36 +0000)]
Rewrite the warning about non-transaction-safety of TRUNCATE ... RESTART
IDENTITY to be more explicit about the possible hazards.  Per gripe from Neil
and subsequent discussion.  Eventually we may be able to get rid of this
warning, but for now it had better be there.

16 years agoUse isatty() test for pager on Win32; not sure why it was disabled for
Bruce Momjian [Sat, 17 May 2008 23:34:44 +0000 (23:34 +0000)]
Use isatty() test for pager on Win32;  not sure why it was disabled for
that platform.

16 years agoIn psql, test for output to stdout when forcing pager for wide output.
Bruce Momjian [Sat, 17 May 2008 21:40:44 +0000 (21:40 +0000)]
In psql, test for output to stdout when forcing pager for wide output.

16 years agoAnother fix for compiles on an empty 'po' directory.
Bruce Momjian [Sat, 17 May 2008 21:27:12 +0000 (21:27 +0000)]
Another fix for compiles on an empty 'po' directory.

16 years agoDon't call rm with empty file list.
Peter Eisentraut [Sat, 17 May 2008 20:24:05 +0000 (20:24 +0000)]
Don't call rm with empty file list.

16 years agoecpglib needs to link with libintl if it's in use.
Tom Lane [Sat, 17 May 2008 20:23:40 +0000 (20:23 +0000)]
ecpglib needs to link with libintl if it's in use.
Per buildfarm results.

16 years agoImprove pg_regress so that it reports the fact if any test process
Tom Lane [Sat, 17 May 2008 20:02:01 +0000 (20:02 +0000)]
Improve pg_regress so that it reports the fact if any test process
exits with nonzero status.  The Windows part of this is untested ...

16 years agoFix utterly-bogus code for computing row heights. Per crashes on
Tom Lane [Sat, 17 May 2008 17:52:14 +0000 (17:52 +0000)]
Fix utterly-bogus code for computing row heights.  Per crashes on
spoonbill, though one wonders why it didn't misbehave everywhere.
In passing remove some unnecessary modulo calculations.

16 years agoFix a subtle bug exposed by recent wal_sync_method rearrangements.
Tom Lane [Sat, 17 May 2008 17:24:57 +0000 (17:24 +0000)]
Fix a subtle bug exposed by recent wal_sync_method rearrangements.
Formerly, the default value of wal_sync_method was determined inside xlog.c,
but now it is determined inside guc.c.  guc.c was reading xlogdefs.h
without having read <fcntl.h>, leading to wrong determination of
DEFAULT_SYNC_METHOD.  Obviously xlogdefs.h needs to include <fcntl.h>
for itself to ensure stable results.