Commit Graph

1806 Commits

Author SHA1 Message Date
Bruce Momjian 60cea7d71a Update mysql converter, new version released. 2001-03-04 15:43:33 +00:00
Peter Eisentraut 08372d4e03 Add missing semicolon required by QNX shell.
from "Tegge, Bernd" <tegge@repas-aeg.de>
2001-03-01 16:17:53 +00:00
Tatsuo Ishii fa2e3cffd3 Remove HAVE_OPTARG per discussion in hackers list. 2001-03-01 05:05:29 +00:00
Tom Lane 778a21ca94 Tweak portal (cursor) code so that it will not call the executor again
when user does another FETCH after reaching end of data, or another
FETCH backwards after reaching start.  This is needed because some plan
nodes are not very robust about being called again after they've already
returned NULL; for example, MergeJoin will crash in some states but not
others.  While the ideal approach would be for them all to handle this
correctly, it seems foolish to assume that no such bugs would creep in
again once cleaned up.  Therefore, the most robust answer is to prevent
the situation from arising at all.
2001-02-27 22:07:34 +00:00
Tom Lane f5ea88ac6e Mark new text<->date, text<->time, text<->timetz conversion functions as
noncachable, so that CURRENT_DATE and CURRENT_TIME work as functions
again, rather than being collapsed to constants immediately.  Marking the
reverse conversions noncachable might be overkill, but I'm not sure;
do these datatypes have the notion of a CURRENT value?  Better safe than
sorry, for now.
2001-02-27 20:34:10 +00:00
Tatsuo Ishii df247b821d Massive commits for SunOS4 port. 2001-02-27 08:13:31 +00:00
Tom Lane 9c9936587c Implement COMMIT_SIBLINGS parameter to allow pre-commit delay to occur
only if at least N other backends currently have open transactions.  This
is not a great deal of intelligence about whether a delay might be
profitable ... but it beats no intelligence at all.  Note that the default
COMMIT_DELAY is still zero --- this new code does nothing unless that
setting is changed.
Also, mark ENABLEFSYNC as a system-wide setting.  It's no longer safe to
allow that to be set per-backend, since we may be relying on some other
backend's fsync to have synced the WAL log.
2001-02-26 00:50:08 +00:00
Bruce Momjian a37666c2ec Update comments on locks. 2001-02-23 19:24:06 +00:00
Bruce Momjian 81b48493aa Bruce Momjian <pgman@candle.pha.pa.us> writes:
> Is there one LOCKMETHODCTL for every backend?  I thought there was only
> one of them.
>>
>> You're right, that line is erroneous; it should read
>>
>> size += MAX_LOCK_METHODS * MAXALIGN(sizeof(LOCKMETHODCTL));
>>
>> Not a significant error but it should be changed for clarity ...
2001-02-23 18:28:46 +00:00
Bruce Momjian 82fc51e0b3 More comment improvements. 2001-02-22 23:02:33 +00:00
Bruce Momjian 4f6c49fef0 Clean up index/btree comments/macros, as approved. 2001-02-22 21:48:49 +00:00
Bruce Momjian 660ca3e01c Change /*---- commants to /* where appropriate. pgindent will tighten
up the comments later.
2001-02-22 18:39:20 +00:00
Tatsuo Ishii a0fa71837a Add _REGEX_UTILS_H to avoid duplication. 2001-02-22 04:35:00 +00:00
Bruce Momjian 15903a1ed4 Comment improvements. 2001-02-21 19:07:04 +00:00
Tom Lane 5ba0f855d1 Clean out any old versions of no-longer-installed header files that may
be lurking in the install target directory.  But don't zap up-to-date
headers (so install-all-headers before regular install will work).
Per suggestion from Larry Rosenman.
2001-02-20 20:37:13 +00:00
Tom Lane a24b04de88 Remove inclusion of <varargs.h> on SunOS; this does not work since we
use the ANSI varargs style (<stdarg.h>) not the old style.  Tatsuo had
reported this change was necessary back in the 7.0 beta cycle (4/13/00)
but for some reason, making the edit never got done.
2001-02-20 00:28:07 +00:00
Tom Lane 414f94f262 Change plpgsql's GET DIAGNOSTICS statement to use SQL99-compatible
syntax.  Fix the RESULT_OID case, which never worked.  Add documentation.
2001-02-19 19:49:53 +00:00
Tom Lane 33cc5d8a4d Change s_lock to not use any zero-delay select() calls; these are just a
waste of cycles on single-CPU machines, and of dubious utility on multi-CPU
machines too.
Tweak s_lock_stuck so that caller can specify timeout interval, and
increase interval before declaring stuck spinlock for buffer locks and XLOG
locks.
On systems that have fdatasync(), use that rather than fsync() to sync WAL
log writes.  Ensure that WAL file is entirely allocated during XLogFileInit.
2001-02-18 04:39:42 +00:00
Tom Lane 6249971b41 Just noticed that use of 'volatile' in HPPA S_UNLOCK() was causing gcc
to generate unnecessarily stupid code.  Tweak macro to describe a series
of store-constant ops, not store/load/store/load/store/load/store.
2001-02-16 23:50:40 +00:00
Tom Lane 13cc7eb3e2 Clean up two rather nasty bugs in operator selection code.
1. If there is exactly one pg_operator entry of the right name and oprkind,
oper() and related routines would return that entry whether its input type
had anything to do with the request or not.  This is just premature
optimization: we shouldn't return the single candidate until after we verify
that it really is a valid candidate, ie, is at least coercion-compatible
with the given types.

2. oper() and related routines only promise a coercion-compatible result.
Unfortunately, there were quite a few callers that assumed the returned
operator is binary-compatible with the given datatype; they would proceed
to call it without making any datatype coercions.  These callers include
sorting, grouping, aggregation, and VACUUM ANALYZE.  In general I think
it is appropriate for these callers to require an exact or binary-compatible
match, so I've added a new routine compatible_oper() that only succeeds if
it can find an operator that doesn't require any run-time conversions.
Callers now call oper() or compatible_oper() depending on whether they are
prepared to deal with type conversion or not.

The upshot of these bugs is revealed by the following silliness in PL/Tcl's
selftest: it creates an operator @< on int4, and then tries to use it to
sort a char(N) column.  The system would let it do that :-( (and evidently
has done so since 6.3 :-( :-().  The result in this case was just a silly
sort order, but the reverse combination would've provoked coredump from
trying to dereference integers.  With this fix you get more reasonable
behavior:
pltcl_test=# select * from T_pkey1 order by key1, key2 using @<;
ERROR:  Unable to identify an operator '@<' for types 'bpchar' and 'bpchar'
        You will have to retype this query using an explicit cast
2001-02-16 03:16:58 +00:00
Tom Lane b29f68f611 Take OUTER JOIN semantics into account when estimating the size of join
relations.  It's not very bright, but at least it now knows that
A LEFT JOIN B must produce at least as many rows as are in A ...
2001-02-16 00:03:08 +00:00
Tom Lane 059e361481 Although we can't support out-of-line TOAST storage in indexes (yet),
compressed storage works perfectly well.  Might as well have a coherent
strategy for applying it, rather than the haphazard store-what-you-get
approach that was in the code before.  The strategy I've set up here is
to attempt compression of any compressible index value exceeding
BLCKSZ/16, or about 500 bytes by default.
2001-02-15 20:57:01 +00:00
Tom Lane 4a66f9dd54 Change scoping of table and join refnames to conform to SQL92: a JOIN
clause with an alias is a <subquery> and therefore hides table references
appearing within it, according to the spec.  This is the same as the
preliminary patch I posted to pgsql-patches yesterday, plus some really
grotty code in ruleutils.c to reverse-list a query tree with the correct
alias name depending on context.  I'd rather not have done that, but unless
we want to force another initdb for 7.1, there's no other way for now.
2001-02-14 21:35:07 +00:00
Bruce Momjian 7582bd91cb Please apply the following patch to fix AIX and IRIX timestamp behavior
as previously discussed.

It makes AIX and IRIX not use DST for dates before 1970.

The following expected files need to be removed from the regression tests,
they contain wrong results and are not needed any more.

src/test/regress/expected/horology-1947-PDT.out
src/test/regress/expected/tinterval-1947-PDT.out
src/test/regress/expected/abstime-1947-PDT.out

Zeugswetter Andreas
2001-02-13 14:32:52 +00:00
Tom Lane f7a839bc2b Clean up portability problems in regexp package: change all routine
definitions from K&R to ANSI C style, and fix broken assumption that
int and long are the same datatype.  This repairs problems observed
on Alpha with regexps having between 32 and 63 states.
2001-02-13 00:02:36 +00:00
Tom Lane cf16733983 Hmm, this isn't used either. 2001-02-12 22:17:29 +00:00
Tom Lane d40f4aeac8 Remove unused and largely-broken-anyway compatibility defs. 2001-02-12 22:13:06 +00:00
Tom Lane aa88e59ade Rearrange order of operations in heap_create_with_catalog so that if
two transactions create the same table name concurrently, the one that
fails will complain about unique index pg_class_relname_index, rather than
about pg_type_typname_index which'll confuse most people.  Free side
benefit: pg_class.reltype is correctly linked to the pg_type entry now.
It's been zero in all but the preloaded pg_class entries since who knows
when.
2001-02-12 20:07:21 +00:00
Tom Lane af0a15287d Fix byte-vs-word-width oversight in m68k TAS() code.
Man, this brings back some old memories ...
2001-02-10 04:07:25 +00:00
Tom Lane d08741eab5 Restructure the key include files per recent pghackers discussion: there
are now separate files "postgres.h" and "postgres_fe.h", which are meant
to be the primary include files for backend .c files and frontend .c files
respectively.  By default, only include files meant for frontend use are
installed into the installation include directory.  There is a new make
target 'make install-all-headers' that adds the whole content of the
src/include tree to the installed fileset, for use by people who want to
develop server-side code without keeping the complete source tree on hand.
Cleaned up a whole lot of crufty and inconsistent header inclusions.
2001-02-10 02:31:31 +00:00
Bruce Momjian cf516c3bb1 I have deleted the include of termios.h in include/port/qnx4.h.
Then I recompiled pgsql and I have compiled a program with ecpg.

I have removed the termios.h, and the ECHO hack.

Thanks
Maurizio
2001-02-09 15:13:49 +00:00
Tom Lane dfbd5d6532 plpgsql's private copy of xlateSqlType was out of sync. Again. This
is clearly not maintainable, so dike it out in favor of calling the real
version in the backend's gram.y.
2001-02-09 03:26:28 +00:00
Vadim B. Mikheev 66decbfb08 Macro for btree runtime fix. 2001-02-07 23:34:18 +00:00
Tom Lane 5add3e8e51 Actually, it looks like DEF_PGPORT belongs over in config.h.win32 for
the Windows build...
2001-02-07 20:00:08 +00:00
Tom Lane 85c17dbff8 Out-of-bounds memory allocation request sizes should be treated as just
elog(ERROR) not an Assert trap, since we've downgraded out-of-memory to
elog(ERROR) not a fatal error.  Also, change the hard boundary from 256Mb
to 1Gb, just so that anyone who's actually got that much memory to spare
can play with TOAST objects approaching a gigabyte.
2001-02-06 01:53:53 +00:00
Bruce Momjian b60c57da2d Apply patches for QNX from Maurizio 2001-02-02 18:21:59 +00:00
Tom Lane 0d54d6ac44 Clean up handling of tuple descriptors so that result-tuple descriptors
allocated by plan nodes are not leaked at end of query.  This doesn't
really matter for normal queries, but it sure does for queries invoked
repetitively inside SQL functions.  Clean up some other grotty code
associated with tupdescs, and fix a few other memory leaks exposed by
tests with simple SQL functions.
2001-01-29 00:39:20 +00:00
Bruce Momjian d7f0b7ef6e Here is an update on the Win32 patch. Modified files are 'config.h.win32'
and two 'win32.mak'. Addresses the following:

1) Oops. Spelled fcntl.h wrong in the last one. D'uh.
2) PG_VERSION changed to be defined with " around it. psql/command.c failed
to compile without that.
3) Changed makefiles to use "/MD" and link both psql and libpq.dll against
MSVCRT.DLL instead of a static library. This takes care of the
crash-upon-free in psql.

I *think* this is what is on the "Open 7.1 Items" list as "Magnus Hagander
ODBC Issues?". It has nothing to do with ODBC, but it's the only issue I've
been involved with...

Magnus Hagander
2001-01-27 21:49:59 +00:00
Tom Lane 1dc3051088 Re-read Unix-socket lock file every so often (every CheckPoint interval,
actually) to ensure that its file access time doesn't get old enough to
tempt a /tmp directory cleaner to remove it.  Still another reason we
should never have put the sockets in /tmp in the first place ...
2001-01-27 00:05:31 +00:00
Tom Lane a05eae029a Re-implement deadlock detection and resolution, per design notes posted
to pghackers on 18-Jan-01.
2001-01-25 03:31:16 +00:00
Bruce Momjian 623bf843d2 Change Copyright from PostgreSQL, Inc to PostgreSQL Global Development Group. 2001-01-24 19:43:33 +00:00
Bruce Momjian 7df3bb50f0 Add all possible config file options. 2001-01-24 18:37:31 +00:00
Bruce Momjian bd0a767eab Here is a patch to make the current snapshot compile on Win32 (native, libpq
and psql) again. Changes are:
1) psql requires the includes of "io.h" and "fcntl.h" in command.c in order
to make a call to open() work (io.h for _open(), fcntl.h for the O_xxx)
2) PG_VERSION is no longer defined in version.h[.in], but in configure.in.
Since we don't do configure on native win32, we need to put it in
config.h.win32 :-(
3) Added define of SYSCONFDIR to config.h.win32 - libpq won't compile
without it. This functionality is *NOT* tested - it's just defined as "" for
now. May work, may not.
4) DEF_PGPORT renamed to DEF_PGPORT_STR

I have done the "basic tests" on it - it connects to a database, and I can
run queries. Haven't tested any of the fancier functions (yet).

However, I stepped on a much bigger problem when fixing psql to work. It no
longer works when linked against the .DLL version of libpq (which the
Makefile does for it). I have left it linked against this version anyway,
pending the comments I get on this mail :-)
The problem is that there are strings being allocated from libpq.dll using
PQExpBuffers (for example, initPQExpBuffer() on line 92 of input.c). These
are being allocated using the malloc function used by libpq.dll. This
function *may* be different from the malloc function used by psql.exe - only
the resulting pointer must be valid. And with the default linking methods,
it *WILL* be different. Later, psql.exe tries to free() this string, at
which point it crashes because the free() function can't find the allocated
block (it's on the allocated blocks list used by the runtime lib of
libpq.dll).

Shouldn't the right thing to do be to have psql call termPQExpBuffer() on
the data instead? As it is now, gets_fromFile() will just return the pointer
received from the PQExpBuffer.data (this may well be present at several
places - this is the one I was bitten by so far). Isn't that kind of
"accessing the internals of the PQExpBuffer structure" wrong? Instead,
perhaps it shuold make a copy of the string, adn then termPQExpBuffer() it?
In that case, the string will have been allocated from within the same
library as the free() is called.

I can get it to work just fine by doing this - changing from (around line
100 of input.c):
and the same a bit further down in the same function.

But, as I said above, this may be at more places in the code? Perhaps
someone more familiar to it could comment on that?


What do you think shuld be done about this? Personally, I go by the "If you
allocate a piece of memory using an interface, use the same interface to
free it", but the question is how to make it work :-)


Also, AFAIK this only affects psql.exe, so the changes made to the libpq
this patch are required no matter how the other issue is handled.

Regards,
 Magnus
2001-01-24 03:42:38 +00:00
Tom Lane 786f1a59cd Fix all the places that called heap_update() and heap_delete() without
bothering to check the return value --- which meant that in case the
update or delete failed because of a concurrent update, you'd not find
out about it, except by observing later that the transaction produced
the wrong outcome.  There are now subroutines simple_heap_update and
simple_heap_delete that should be used anyplace that you're not prepared
to do the full nine yards of coping with concurrent updates.  In
practice, that seems to mean absolutely everywhere but the executor,
because *noplace* else was checking.
2001-01-23 04:32:23 +00:00
Bruce Momjian 56970c1bc0 Fix some int4->int32. 2001-01-23 03:10:25 +00:00
Bruce Momjian 7e533da492 Rename int4 to int32 in a few places. 2001-01-23 01:48:17 +00:00
Tom Lane e9c936ff38 Remove rangechecks on errno; just call strerror unconditionally. This
eliminates a raft of portability issues, including whether sys_nerr
exists, whether the platform has any valid negative errnos, etc.  The
downside is minimal: errno shouldn't ever contain an invalid value anyway,
and if it does, reasonably modern versions of strerror will not choke.
This rangecheck idea seemed good at the time, but it's clearly a net loss,
and I apologize to all concerned for having ever put it in.
2001-01-22 23:28:52 +00:00
Tom Lane e84c429062 Clean up lockmanager data structures some more, in preparation for planned
rewrite of deadlock checking.  Lock holder objects are now reachable from
the associated LOCK as well as from the owning PROC.  This makes it
practical to find all the processes holding a lock, as well as all those
waiting on the lock.  Also, clean up some of the grottier aspects of the
SHMQueue API, and cause the waitProcs list to be stored in the intuitive
direction instead of the nonintuitive one.  (Bet you didn't know that
the code followed the 'prev' link to get to the next waiting process,
instead of the 'next' link.  It doesn't do that anymore.)
2001-01-22 22:30:06 +00:00
Tom Lane c9fe128316 Clean up per-tuple memory leaks in trigger firing and plpgsql
expression evaluation.
2001-01-22 00:50:07 +00:00
Tom Lane 59a3a40149 All the global memory contexts should be DLLIMPORT, if any are. 2001-01-22 00:18:13 +00:00