Tom Lane [Tue, 13 Jul 2004 00:06:46 +0000 (00:06 +0000)]
Cause libpq and ecpg libraries to be built as proper shared libraries
(.dylib format) on Mac OS X, while not messing up loadable modules for
the backend (which are the same kind of animal as a shared library on
every other platform, but not here). Also get the naming convention
to match OS X practice, viz libFOO.version.so not libFOO.so.version.
In support of that last, refactor code in Makefile.shlib to make it
easier to have platform-specific shlib naming conventions.
This patch is loosely based on the Fink project's current postgresql.patch.
Tested by yours truly on OS X 10.3.4; does anyone have 10.2.* to check
it on?
Bruce Momjian [Mon, 12 Jul 2004 14:31:04 +0000 (14:31 +0000)]
The attached patch, which incorporates the previous one sent and
currently unapplied regarding spi_internal.c, makes some additional
fixes relating to return types, and also contains the fix for
preventing the use of insecure versions of Safe.pm.
There is one remaing return case that does not appear to work, namely
return of a composite directly in a select, i.e. if foo returns some
composite type, 'select * from foo()' works but 'select foo()' doesn't.
We will either fix that or document it as a limitation.
The function plperl_func_handler is a mess - I will try to get it
cleaned up (and split up) in a subsequent patch, time permitting.
Also, reiterating previous advice - this changes slightly the API for
spi_exec_query - the returned object has either 2 or 3 members: 'status'
(string) and 'proceesed' (int,- number of rows) and, if rows are
returned, 'rows' (array of tuple hashes).
Bruce Momjian [Mon, 12 Jul 2004 14:23:28 +0000 (14:23 +0000)]
> win32 doesn't support a static initializer for mutexes, thus the first
> user must initialize the lock. The problem are concurrent "first" users
> - the pthread_mutex_t initialization must be synchronized.
> The current implementation is broken, the attached patches fixes that:
> mutex_initlock is a spinlock. If the pthread_mutex_t mutex is not
> initialized, then the spinlock is acquired, if the pthread_mutex_t is
> initialized if it's not yet initialized and then the spinlock is dropped.
Bruce Momjian [Mon, 12 Jul 2004 14:11:17 +0000 (14:11 +0000)]
win32 doesn't support a static initializer for mutexes, thus the first
user must initialize the lock. The problem are concurrent "first" users
- the pthread_mutex_t initialization must be synchronized.
The current implementation is broken, the attached patches fixes that:
mutex_initlock is a spinlock. If the pthread_mutex_t mutex is not
initialized, then the spinlock is acquired, if the pthread_mutex_t is
initialized if it's not yet initialized and then the spinlock is
dropped.
Tom Lane [Mon, 12 Jul 2004 05:38:11 +0000 (05:38 +0000)]
Remove TABLESPACE option of CREATE SEQUENCE; sequences will now always
live in database or schema's default tablespace, as per today's discussion.
Also, remove some unused keywords from the grammar (PATH, PENDANT,
VERSION), and fix ALSO, which was added as a keyword but not added
to the keyword classification lists, thus making it worse-than-reserved.
Bruce Momjian [Sun, 11 Jul 2004 23:26:51 +0000 (23:26 +0000)]
This patch fixes a small error in the Porting PL/SQL to PL/pgSQL
section where a instr function parameter is mistyped as varchar. It
works properly when changed to integer.
Tom Lane [Sun, 11 Jul 2004 19:52:52 +0000 (19:52 +0000)]
Move TablespaceCreateDbspace() call into smgrcreate(), which is where it
probably should have been to begin with; this is to cover cases like
needing to recreate the per-db directory during WAL replay.
Also, fix heap_create to force pg_class.reltablespace to be zero instead
of the database's default tablespace; this makes the world safe for
CREATE DATABASE to handle all tables in the default tablespace alike,
as per previous discussion. And force pg_class.reltablespace to zero
when creating a relation without physical storage (eg, a view); this
avoids possibly having dangling references in this column after a
subsequent DROP TABLESPACE.
Tom Lane [Sun, 11 Jul 2004 18:01:45 +0000 (18:01 +0000)]
Rename XLOG_BTREE_NEWPAGE xlog record type into XLOG_HEAP_NEWPAGE, and
shift support code into heapam.c accordingly. This is in service of
soon-to-be-committed ALTER TABLE SET TABLESPACE code that will want to
use this same record type for both heaps and indexes.
Theoretically I should have forced initdb for this, but in practice there
is no change in xlog contents because CVS tip will never really emit this
record type anyhow...
Tom Lane [Sun, 11 Jul 2004 04:57:20 +0000 (04:57 +0000)]
Cause the format of BC timestamptz output to be 'datetime zone BC' rather
than 'datetime BC zone', because the former is accepted by the timestamptz
input converter while the latter may not be depending on spacing. This
is not a loss of compatibility w.r.t. 7.4 and before, because until very
recently there was never a case where we'd output both zone and 'BC'.
Tom Lane [Sat, 10 Jul 2004 23:06:50 +0000 (23:06 +0000)]
Check more test points (in fact, every week in 1970..2004) to get a more
accurate matching of our time zone to the system's zone. This method is
able to distinguish Antarctica/Casey from Australia/Perth, as in Chris
K-L's recent example; and it is not materially slower than before, because
the extra checks generally don't get done against very many time zones.
It seems possible that with this test we'd be able to correctly identify
Windows timezones without looking at the timezone name, but I do not
have the ability to try it.
Tom Lane [Sat, 10 Jul 2004 22:58:42 +0000 (22:58 +0000)]
Fix BSD-only coding in port.c (passing a local variable to putenv).
Also a quick but half-baked attempt to make trim_trailing_separator
do the right thing with path consisting only of '/' --- still needs
work for Windows I think.
Tom Lane [Sat, 10 Jul 2004 18:39:23 +0000 (18:39 +0000)]
Test HAVING condition before computing targetlist of an Aggregate node.
This is required by SQL spec to avoid failures in cases like
SELECT sum(win)/sum(lose) FROM ... GROUP BY ... HAVING sum(lose) > 0;
AFAICT we have gotten this wrong since day one. Kudos to Holger Jakobs
for being the first to notice.
Bruce Momjian [Wed, 7 Jul 2004 12:48:54 +0000 (12:48 +0000)]
Formatting improvements:
< The most recent version of this document can be viewed at
< the PostgreSQL web site, http://www.PostgreSQL.org.
> The most recent version of this document can be viewed at the PostgreSQL web site, http://www.PostgreSQL.org.
Bruce Momjian [Tue, 6 Jul 2004 20:29:31 +0000 (20:29 +0000)]
Move section:
< * Add replication of distributed databases
< o Automatic failover
< o Load balancing
< o Master/slave replication
< o Multi-master replication
< o Partition data across servers
< o Queries across databases or servers (two-phase commit)
< o Allow replication over unreliable or non-persistent links
55a48,55
> * Improve replication solutions
> o Automatic failover
> o Load balancing
> o Master/slave replication
> o Multi-master replication
> o Partition data across servers
> o Queries across databases or servers (two-phase commit)
> o Allow replication over unreliable or non-persistent links
Bruce Momjian [Tue, 6 Jul 2004 16:18:31 +0000 (16:18 +0000)]
Reorder dash mention to be more prominient.
> A dash (-) marks changes that will appear in the upcoming 7.5 release.
>
> Bracketed items "[]" have more detail.
9,12d12
<
< A dash (-) marks changes that will appear in the upcoming 7.5 release.
<
< Bracketed items "[]" have more detail.
Tom Lane [Sun, 4 Jul 2004 02:49:04 +0000 (02:49 +0000)]
Okay, I've had it with answering newbie questions about why plpgsql
FOR loops are giving weird syntax errors. Restructure parsing of FOR
loops so that the integer-loop-vs-query-loop decision is driven off
the presence of '..' between IN and LOOP, rather than the presence
of a matching record/row variable name. Hopefully this will make the
behavior a bit more transparent.
Tom Lane [Fri, 2 Jul 2004 22:50:23 +0000 (22:50 +0000)]
Add missing operators of the form interval-plus-datetime, as required for
better SQL compliance in this area, per recent discussion. Mark related
operators as commutators where possible. (The system doesn't actually care
about commutator marking for operators not returning boolean, at the moment,
but this seems forward-thinking and besides it made it easier to verify
that we hadn't missed any.)
Also, remove interval-minus-time and interval-minus-timetz operators.
I'm not sure how these got in, but they are nonstandard and had very
obviously broken behavior. (minus is not commutative in anyone's book.)
I doubt anyone had ever used 'em, because we'd surely have gotten a bug
report about it if so.
Joe Conway [Fri, 2 Jul 2004 18:59:25 +0000 (18:59 +0000)]
Andreas Pflug wrote:
From an idea of Bruce, the attached patch implements the function
pg_tablespace_databases(oid) RETURNS SETOF oid
which delivers as set of database oids having objects in the selected
tablespace, enabling an admin to examine only the databases affecting
the tablespace for objects instead of scanning all of them.
Joe Conway [Fri, 2 Jul 2004 00:58:09 +0000 (00:58 +0000)]
Attached is a 1 line bug fix for dbmirror that was submitted.
It fixes a bug where some transactions could be dropped when writing
mirrored SQL statements to files.
-- Steven Singer
Tom Lane [Thu, 1 Jul 2004 21:17:13 +0000 (21:17 +0000)]
More paranoia in AtEOSubXact_SPI: don't assume we can safely use SPI_finish
for cleaning up. It seems possible that the memory contexts SPI_finish
would try to touch are already gone; and there's no need for SPI itself
to delete them, since the containing contexts will surely be going away
anyway at transaction end.
Joe Conway [Thu, 1 Jul 2004 20:50:22 +0000 (20:50 +0000)]
plperl update from Andrew Dunstan, deriving (I believe) from Command Prompt's
plperlNG. Review and minor cleanup/improvements by Joe Conway.
Summary of new functionality:
- Shared data space and namespace. There is a new global variable %_SHARED
that functions can use to store and save data between invocations of a
function, or between different functions. Also, all trusted plperl function
now share a common Safe container (this is an optimization, also), which
they can use for storing non-lexical variables, functions, etc.
- Triggers are now supported
- Records can now be returned (as a hash reference)
- Sets of records can now be returned (as a reference to an array of hash
references).
- New function spi_exec_query() provided for performing db functions or
getting data from db.
- Optimization for counting hash keys (Abhijit Menon-Sen)
- Allow return of 'record' and 'setof record'
Tom Lane [Thu, 1 Jul 2004 20:11:03 +0000 (20:11 +0000)]
Further review of xact.c state machine for nested transactions. Fix
problems with starting subtransactions inside already-failed transactions.
Clean up some comments.
Joe Conway [Thu, 1 Jul 2004 03:25:48 +0000 (03:25 +0000)]
Add double metaphone code from Andrew Dunstan. Also change metaphone so that
an empty input string causes an empty output string to be returned, instead of
throwing an ERROR -- per complaint from Aaron Hillegass, and consistent with
double metaphone. Fix examples in README.soundex pointed out by James Robinson.
Tom Lane [Thu, 1 Jul 2004 00:52:04 +0000 (00:52 +0000)]
Nested transactions. There is still much left to do, especially on the
performance front, but with feature freeze upon us I think it's time to
drive a stake in the ground and say that this will be in 7.5.
Michael Meskes [Wed, 30 Jun 2004 15:01:58 +0000 (15:01 +0000)]
Added SET DESCRIPTOR command.
Note that this still has some bugs. The functionality is there though, it's just a matter of fixing the bugs now.
Cleaned up error handling in preprocessor.
Teodor Sigaev [Mon, 28 Jun 2004 16:19:09 +0000 (16:19 +0000)]
1 Eliminate duplicate field HLWORD->skip
2 Rework support for html tags in parser
3 add HighlightAll to headline function for generating highlighted
whole text with saved html tags
Tom Lane [Mon, 28 Jun 2004 00:18:47 +0000 (00:18 +0000)]
Fix some bogus code in ConstBit production --- it managed to work, but
only because 14627 still contained the same node that BitWithoutLength had
just produced. Make it more transparent. Also adjust ConstCharacter
to be coded the same way for consistency.
Michael Meskes [Sun, 27 Jun 2004 12:28:42 +0000 (12:28 +0000)]
- Only use typedefs inside their scope.
- Variables that are out of scope, were not removed all the time.
- Make a varchar NULL set everything to 0 when not using indicators.
- Synced parser.