Tom Lane [Wed, 3 Oct 2001 17:22:05 +0000 (17:22 +0000)]
Some further kibitzing on cachability of datetime functions.
In particular, mark all I/O functions that can produce or consume
a date as noncachable, in light of existence of DateStyle variable.
Tom Lane [Wed, 3 Oct 2001 15:50:48 +0000 (15:50 +0000)]
AdjustTimestampForTypmod does not work (at least not portably) on
-infinity and +infinity. Put TIMESTAMP_NOT_FINITE guard into the routine,
instead of forgetting it at some call sites. Fixes regression test
failures here.
Implement precision support for timestamp and time, both with and without
time zones.
SQL99 spec requires a default of zero (round to seconds) which is set
in gram.y as typmod is set in the parse tree. We *could* change to a
default of either 6 (for internal compatibility with previous versions)
or 2 (for external compatibility with previous versions).
Evaluate entries in pg_proc wrt the iscachable attribute for timestamp and
other date/time types. Try to recognize cases where side effects like the
current time zone setting may have an effect on results to decide whether
something is cachable or not.
Tom Lane [Tue, 2 Oct 2001 21:39:36 +0000 (21:39 +0000)]
Add CREATE OR REPLACE FUNCTION syntax to allow replacing a function
definition without changing the function's OID, thereby not breaking
rules, views, triggers, etc that depend on it. From Gavin Sherry.
Tom Lane [Mon, 1 Oct 2001 21:31:52 +0000 (21:31 +0000)]
Change pg_dump to produce CREATE INDEX commands by using the backend's
pg_get_indexdef() function, rather than reaching into the system catalogs
for itself. This eliminates a fair amount of redundant code. Also,
since I just changed pg_get_indexdef() to suppress display of default
index opclasses, this will mean that 7.2 and later dumps will not mention
opclasses unless they are non-default opclasses. Should make life easier
for future index opclass reorganizations.
Tom Lane [Mon, 1 Oct 2001 20:15:26 +0000 (20:15 +0000)]
Extend pg_get_indexdef() to know about index predicates. Also, tweak
it to suppress index opclass output for opclasses that are the default
for their datatype; only non-default opclasses are shown explicitly.
This is expected to improve portability of the CREATE INDEX command
across future versions of Postgres --- we've changed index opclasses
too often in the past to think we won't do so again.
Tom Lane [Mon, 1 Oct 2001 16:48:37 +0000 (16:48 +0000)]
Clean up a little more carefully around fork of pgstat subprocess.
Partial support for BEOS (not sure whether second fork of grandchild
process needs these extra calls or not; someone who has BEOS will need
to test it).
Bruce Momjian [Mon, 1 Oct 2001 15:33:31 +0000 (15:33 +0000)]
> > > > > - PostgreSQL requires to be compiled with --enable-multibyte
> > > > > and --enable-unicode-convertion if it ought to work correctly
> > > > > with Tcl/Tk >= 8.1 (client or server side).
> > > > >
> > > > > - PL/Tcl needs to be changed to use pg_do_encoding_conversion
> > > > > if it runs on a Tcl version >= 8.1 .
> > >
> > > > I'll do pl/tcl part in the next version of patch. Using this approach we
> > > > can eliminate overhead for databases in UNICODE.
> > >
> > > Any progress on this? I'd prefer to get rid of this --enable-pltcl-utf
> > > option before release.
> >
> > Done
> >
> > Next version removes --enable-pltcl-utf switch and enables embedded
> > utf conversion of pgsql if tcl version >=8.1 and --enable-unicode-conversion
Tom Lane [Mon, 1 Oct 2001 05:36:17 +0000 (05:36 +0000)]
Another round of cleanups for dynahash.c (maybe it's finally clean of
portability issues). Caller-visible data structures are now allocated
on MAXALIGN boundaries, allowing safe use of datatypes wider than 'long'.
Rejigger hash_create API so that caller specifies size of key and
total size of entry, not size of key and size of rest of entry.
This simplifies life considerably since each number is just a sizeof(),
and padding issues etc. are taken care of automatically.
Tom Lane [Sun, 30 Sep 2001 22:30:37 +0000 (22:30 +0000)]
Make libpq++ safe again for older C++ compilers. Do 'using namespace std'
only if configure found it was safe to do so; do not assume const_cast
is available.
Tom Lane [Sun, 30 Sep 2001 20:16:21 +0000 (20:16 +0000)]
Allow the postmaster to accept changes in PGC_BACKEND GUC variables
from the config file, so that these changes will propagate to backends
started later. Already-started backends continue to ignore changes
in these variables.
Tom Lane [Sun, 30 Sep 2001 18:57:45 +0000 (18:57 +0000)]
Create a GUC parameter max_files_per_process that is a configurable
upper limit on what we will believe from sysconf(_SC_OPEN_MAX). The
default value is 1000, so that under ordinary conditions it won't
affect the behavior. But on platforms where the kernel promises far
more than it can deliver, this can be used to prevent running out of
file descriptors. See numerous past discussions, eg, pgsql-hackers
around 23-Dec-2000.
Peter Eisentraut [Sun, 30 Sep 2001 16:05:54 +0000 (16:05 +0000)]
Use <mediaobject> instead of <graphic> for forward compatibility. Be more
flexible about the extension of the graphic files, allow for other formats
in print output. (Generating these formats is not implemented yet.)
Tom Lane [Sat, 29 Sep 2001 23:49:51 +0000 (23:49 +0000)]
Tweak btree page split logic so that when splitting a page that is
rightmost on its tree level, we split 2/3 to the left and 1/3 to the
new right page, rather than the even split we use elsewhere. The idea
is that when faced with a steadily increasing series of inserted keys
(such as sequence or timestamp values), we'll end up with a btree that's
about 2/3ds full not 1/2 full, which is much closer to the desired
steady-state load for a btree. Per suggestion from Ann Harrison of
IBPhoenix.
Tom Lane [Sat, 29 Sep 2001 21:16:30 +0000 (21:16 +0000)]
Cope with the likelihood that setlocale and localeconv will return
pointers to data that will be changed by any later call to setlocale.
Must copy what they return to be sure we get the right answer.
Karel Zak, further tweaks by Tom Lane.
Tom Lane [Sat, 29 Sep 2001 20:12:07 +0000 (20:12 +0000)]
Fix the setlocale problem in a way that actually works. setlocale
returns a string corresponding to the new setting, not the old,
therefore the previous patch was quite wrong.
Tom Lane [Sat, 29 Sep 2001 15:29:48 +0000 (15:29 +0000)]
Whoops, I was a tad too enthusiastic about using shared lock mode for
SInvalLock. GetSnapshotData(true) has to use exclusive lock, since
it sets MyProc->xmin.
Tom Lane [Sat, 29 Sep 2001 04:02:27 +0000 (04:02 +0000)]
Implement new 'lightweight lock manager' that's intermediate between
existing lock manager and spinlocks: it understands exclusive vs shared
lock but has few other fancy features. Replace most uses of spinlocks
with lightweight locks. All remaining uses of spinlocks have very short
lock hold times (a few dozen instructions), so tweak spinlock backoff
code to work efficiently given this assumption. All per my proposal on
pghackers 26-Sep-01.
Bruce Momjian [Sat, 29 Sep 2001 03:11:58 +0000 (03:11 +0000)]
I noticed that the contrib Makefiles were reorganized.
Converted pgcrypto one too.
* Changed default randomness source to libc random()
That way pgcrypto does not have any external dependencies
and should work everywhere.
* Re-enabled pgcrypto build in contrib/makefile
* contrib/README update - there is more stuff than
only 'hash functions'
* Noted the libc random fact in README.pgcrypto
Bruce Momjian [Sat, 29 Sep 2001 03:08:01 +0000 (03:08 +0000)]
Per the recent discussion there's been some code changes in JDBC's
DatabaseMetaData.getColumn(). I proposed a patch that would change the
number of queries to find out all columns in a table from 2 * N + 1 to 1 (N
being the number of columns reported) by using some outer joins. I also
fixed the fact that getColumns() only returned columns that had a default
defined. OTOH, I did not use to change the code required for obtaining a
column's remarks (by using col_description() for 7.2 and requested by Tom
Lane).
Finally, I have found a way to get all the column details in a single query
*and* use col_description() for 7.2 servers. A patch is attached. It
overrules Ren? Pijlman's fix for this that was committed just today, but
still used N + 1 queries (sorry Ren? ;-) )
I also fixed the return values for TABLE_CAT and TABLE_SCHEM from "" to
null, to be more standard compliant (and requested in Ren?'s mail found at
http://fts.postgresql.org/db/mw/msg.html?mid=1034253).
As always, the JDBC1 version has not been tested as I have no JDK 1.1
Measure the current transaction time to milliseconds.
Define a new function, GetCurrentTransactionStartTimeUsec() to get the time
to this precision.
Allow now() and timestamp 'now' to use this higher precision result so
we now have fractional seconds in this "constant".
Add timestamp without time zone type.
Move previous timestamp type to timestamp with time zone.
Accept another ISO variant for date/time values: yyyy-mm-ddThh:mm:ss
(note the "T" separating the day from hours information).
Remove 'current' from date/time types; convert to 'now' in input.
Separate time and timetz regression tests.
Separate timestamp and timestamptz regression test.
Add separate regression tests for timetz and the new timestamptz type.
Modify the timestamp test to reflect the "no time zone" behavior of this
new code; timestamptz resembles the old timestamp code.