Commit Graph

12975 Commits

Author SHA1 Message Date
Neil Conway d0b4399d81 Reimplement the linked list data structure used throughout the backend.
In the past, we used a 'Lispy' linked list implementation: a "list" was
merely a pointer to the head node of the list. The problem with that
design is that it makes lappend() and length() linear time. This patch
fixes that problem (and others) by maintaining a count of the list
length and a pointer to the tail node along with each head node pointer.
A "list" is now a pointer to a structure containing some meta-data
about the list; the head and tail pointers in that structure refer
to ListCell structures that maintain the actual linked list of nodes.

The function names of the list API have also been changed to, I hope,
be more logically consistent. By default, the old function names are
still available; they will be disabled-by-default once the rest of
the tree has been updated to use the new API names.
2004-05-26 04:41:50 +00:00
Bruce Momjian f240d37229 Add FRONTEND to ecpglib. 2004-05-25 21:20:44 +00:00
Bruce Momjian 2a70ec1bdf Allow relative paths as long as the hardcoded path matches the bin path
up to the last bin directory name.
2004-05-25 20:47:41 +00:00
Tom Lane bfb77c15ca Tweaks per discussion with Magnus: suppress chatter on unpatched MinGW
systems, add verbose logging (at DEBUG4) to help identify why a given
time zone is not matched.
2004-05-25 19:46:21 +00:00
Tom Lane 957b90ed6a Fix erroneous error message printout when a configuration file contains
an overlength token.  Printout was always garbage and could dump core
entirely :-(.  Per report from Martin Pitt.
2004-05-25 19:11:14 +00:00
Bruce Momjian c826991dd7 Fix set_pglocale to properly pass my_exec_path to get_locale_path instead of argv0. 2004-05-25 18:18:29 +00:00
Tom Lane 76c50c080b Add code to identify_system_timezone() to try all zones in the zic
database, not just ones that we cons up POSIX names for.  This looks
grim but it seems to take less than a second even on a relatively slow
machine, and since it only happens once during postmaster startup, that
seems acceptable.
2004-05-25 18:08:59 +00:00
Bruce Momjian 17ff18141c Add exec.c to ecpg library because path.c now uses it. 2004-05-25 17:35:51 +00:00
Bruce Momjian 88ca65d76b Skip settting LC_ALL in the backend. 2004-05-25 01:42:08 +00:00
Bruce Momjian 228897774c Make the locale location relocatable.
Adjust get_*_path functions to be limited to MAXPGPATH.
2004-05-25 01:00:30 +00:00
Bruce Momjian 244ee0c0f2 Remove pstrdup() call from exec.c because DLLIMPORT flag on
CurrentMemoryContext caused compile problems.

Recode to not make a copy of the PATH but copy parts out into MAXPGPATH
variables.
2004-05-24 22:35:37 +00:00
Bruce Momjian fcbc95b9a2 Make validate_exec take a const char *, for gcc 3.4, which is more
strict.
2004-05-24 20:23:50 +00:00
Bruce Momjian 3661d1d6e0 This patch fixes the find_my_exec code for pgstat backends. Required for
TZ stuff (and possibly others) to work in the pgstat backends.

Magnus Hagander
2004-05-24 02:47:47 +00:00
Tom Lane dc39937762 Rewrite identify_system_timezone() to give it better-than-chance odds
of correctly identifying the system's daylight-savings transition rules.
This still begs the question of how to look through the zic database to
find a matching zone definition, but at least now we'll have some chance
of recognizing the match when we find it.
2004-05-24 02:30:29 +00:00
Bruce Momjian 82695df3b7 Remove a few $filter() calls that were not needed. 2004-05-24 01:01:38 +00:00
Tom Lane 17edb84056 Seems we had the wrong sign convention for the default Etc/GMTx zone
names.  Per report from Alvaro.
2004-05-23 23:26:53 +00:00
Tom Lane 9e0fcc2ad5 Avoid calling select_default_timezone() when backing out an unwanted TZ
setting.  This is a temporary kluge to keep Alvaro happy; eventually we
should fix the TZ library API to make the problem really go away.
2004-05-23 23:12:11 +00:00
Tom Lane f9df1b28e8 Use case-insensitive comparison so that explicitly setting timezone=unknown
in postgresql.conf does the right thing.  variable.c got this right, but
not pgtz.c ...
2004-05-23 22:24:08 +00:00
Neil Conway 256d4639c9 A few cosmetic fixes and code cleanup. 2004-05-23 22:20:10 +00:00
Tom Lane 9d6570b8a4 New two-stage sampling method for ANALYZE, as per discussions a few weeks
ago.  This should give significantly better results when the density of
live tuples is not uniform throughout a table.  Manfred Koizar, with
minor kibitzing from Tom Lane.
2004-05-23 21:24:02 +00:00
Tom Lane 27edff700e Still another place to make the world safe for zero-column tables:
remove the ancient (and always pretty dodgy) assumption in parse_clause.c
that a query can't have an empty targetlist.
2004-05-23 17:10:54 +00:00
Tom Lane a712570880 Make --without-docdir configure option actually work, per Manfred. 2004-05-23 15:24:32 +00:00
Tom Lane ebfc56d3fb Handle impending sinval queue overflow by means of a separate signal
(SIGUSR1, which we have not been using recently) instead of piggybacking
on SIGUSR2-driven NOTIFY processing.  This has several good results:
the processing needed to drain the sinval queue is a lot less than the
processing needed to answer a NOTIFY; there's less contention since we
don't have a bunch of backends all trying to acquire exclusive lock on
pg_listener; backends that are sitting inside a transaction block can
still drain the queue, whereas NOTIFY processing can't run if there's
an open transaction block.  (This last is a fairly serious issue that
I don't think we ever recognized before --- with clients like JDBC that
tend to sit with open transaction blocks, the sinval queue draining
mechanism never really worked as intended, probably resulting in a lot
of useless cache-reset overhead.)  This is the last of several proposed
changes in response to Philip Warner's recent report of sinval-induced
performance problems.
2004-05-23 03:50:45 +00:00
Tom Lane 4d86ae4260 For multi-table ANALYZE, use per-table transactions when possible
(ie, when not inside a transaction block), so that we can avoid holding
locks longer than necessary.  Per trouble report from Philip Warner.
2004-05-22 23:14:38 +00:00
Tom Lane e26c403fd0 Reduce pg_listener lock taken by NOTIFY et al from AccessExclusiveLock
to ExclusiveLock.  This still serializes the operations of this module,
but doesn't conflict with concurrent ANALYZE operations.  Per trouble
report from Philip Warner a few weeks ago.
2004-05-22 21:58:24 +00:00
Tom Lane 323a45099a Fix to install correctly in vpath build case. 2004-05-22 21:02:32 +00:00
Tom Lane b1ea9811b3 Fix for vpath builds. 2004-05-22 02:15:08 +00:00
Tom Lane 4fb9aa43f6 Clean up failure to remove exec.o on 'make clean'. 2004-05-22 02:14:28 +00:00
Tom Lane 3983869439 Use wide-character library routines, if available, for upper/lower/initcap
functions.  This allows these functions to work correctly with Unicode and
other multibyte encodings.  Per prior discussion.

Also, revert my earlier change to move installation path mashing from
Makefile.global to configure.  Turns out not to work well because configure
script is working with unexpanded variables, and so fails to match in
cases where it should match.
2004-05-22 00:34:51 +00:00
Tom Lane add8b70dda Handle inclusion of port modules 'correctly', viz the same way libpq
does it.  Fixes OS X, which needs path.c.  It may be that Win32 needs
some more port modules, but they are easily added.
2004-05-21 21:56:02 +00:00
Tom Lane d584db6086 pgindent did a pretty awful job on the timezone code, particularly with
respect to doubly-starred comment blocks.  Do some manual cleanup.
2004-05-21 20:59:10 +00:00
Tom Lane 13f96c4b6b Put path configuration information into a .h file instead of cluttering
several different module Makefiles with it.  Also, do any adjustment
of installation paths during configure, rather than every time Makefile.global
is read.
2004-05-21 20:56:50 +00:00
Tom Lane 748a15a8ea Probably need sys/time.h here too to be safe. 2004-05-21 16:22:38 +00:00
Tom Lane e6319d1d28 Put back #include <sys/time.h> in files that seem to need it on Linux. 2004-05-21 16:08:47 +00:00
Tom Lane ff0b706b13 Fix random breakage in exec.c for platforms where strdup is a macro. 2004-05-21 16:06:23 +00:00
Michael Meskes 79c3bf4984 - Fixed DEALLOCATE PREPARE to use correct function call
- Made sure connect statement does not accept single char variable,
  but only strings.
2004-05-21 13:50:12 +00:00
Bruce Momjian 0a19fb42c2 Pgindent timezone file, per request from Tom. 2004-05-21 12:30:25 +00:00
Tom Lane 63bd0db121 Integrate src/timezone library for all platforms. There is more we can
and should do now that we control our own destiny for timezone handling,
but this commit gets the bulk of the picayune diffs in place.
Magnus Hagander and Tom Lane.
2004-05-21 05:08:06 +00:00
Bruce Momjian 260b513fc3 Add mention of why -lpgport is needed in ecpglib (dllwrap). 2004-05-21 03:12:03 +00:00
Bruce Momjian 928e73ea62 Add -lpgport to ecpglib link only on win32. Other platforms have
problems with it.
2004-05-21 03:10:47 +00:00
Tom Lane 9bfee3adee Revert addition of -lpgport, which breaks the build on platforms that
are sticky about non-PIC code in shared libraries.  Windows will have
to find another solution (probably similar to the way libpq does it).
2004-05-21 00:14:38 +00:00
Tom Lane 7d717f2471 Rename static variables to avoid possible name conflicts on systems with
dirty standard headers (eg AIX).
2004-05-20 17:13:52 +00:00
Bruce Momjian 3255851e6a Small variable rename in exec.c. 2004-05-20 15:38:11 +00:00
Bruce Momjian ceceeffe1e Clean up find_my_exec to work cleaner.
Add Win32 code to look in the current directory before the path.

Add code so memory is allocated using palloc in backend object files.
2004-05-20 15:35:41 +00:00
Tom Lane 868404b859 Fix speling. 2004-05-20 15:07:30 +00:00
Bruce Momjian 254df82b40 Add ctype.h include for new macro in port.h. 2004-05-20 01:47:01 +00:00
Bruce Momjian 163e72aa60 Add $libdir to mingw and cygwin for installcheck too. 2004-05-20 00:21:36 +00:00
Tom Lane 29fcd22080 Improve error reporting behavior in parse_hba(): give more complete
error report for getaddrinfo failures, point at correct token for syntax
errors in all cases, don't log redundant messages.
2004-05-19 22:06:16 +00:00
Bruce Momjian 178c08d0c7 Rename another irix file. 2004-05-19 21:39:16 +00:00
Bruce Momjian 14531e0c44 Rename irix5 port to irix. 2004-05-19 21:37:43 +00:00
Bruce Momjian bef228d1ee Add end-of-dump markers for pg_dump and pg_dumpall. 2004-05-19 21:21:26 +00:00
Bruce Momjian 8a91100379 Only do pkglib_path if needed. 2004-05-19 21:17:33 +00:00
Bruce Momjian 4056279958 Only do find_my_exec if it doesn't come from the postmaster. 2004-05-19 19:39:27 +00:00
Bruce Momjian 9ee3310768 Add get_pkglib_path to postmaster.c 2004-05-19 19:11:25 +00:00
Bruce Momjian 5a7e1a187c Move find_my_exec lower so elog() works, per Tom. 2004-05-19 18:58:44 +00:00
Bruce Momjian ecc198bd39 Re-add elog() to exec.c, per Tom. 2004-05-19 17:15:21 +00:00
Bruce Momjian ba71d824d5 Add MinGW to cases where libdir should be used for regression tests:
case $host_platform in
        *-*-cygwin*|*-*-mingw)
            PATH=$libdir:$PATH
            export PATH
            ;;
    esac
2004-05-19 05:20:27 +00:00
Bruce Momjian eb8c79a129 Win32 needs -lpgport for dll creation of ecpglib. 2004-05-19 05:14:58 +00:00
Bruce Momjian dbb9aa224e Supress verbose stderr messages while trying to find my exec path.
Per report from Christopher.
2004-05-19 04:36:33 +00:00
Neil Conway 132d09054e Minor correction for previous SQLSTATE patch: I changed dsqrt() to emit the
right error code previously, and this patch applies an analogous change
to numeric_sqrt().
2004-05-19 04:32:26 +00:00
Bruce Momjian f16874c23d Win32 can't have the same function coming from two library object files,
so we make is_absolute_path a macro so libpq doesn't use path.o.
2004-05-19 04:21:49 +00:00
Bruce Momjian 48eb73b556 Allow zic to compile by defining a "" value for my_exec_path. It isn't
used by zic anyway.
2004-05-19 01:17:42 +00:00
Tom Lane 07f2b767dc setRuleCheckAsUser has to be applied to any subqueries appearing in a
rule's event_qual, not only to the rule's action.  Per example from
Arturs Zoldners.
2004-05-18 22:49:51 +00:00
Bruce Momjian eb79aea9ed Move get_pkglib_path up into main.c too. 2004-05-18 20:27:25 +00:00
Bruce Momjian a9fad44372 Move find_my_exec() way up into main.c so it is available to the
timezone code and other places.

Remove elog() calls from find_my_exec;  do fprintf(stderr) instead.  We
can then remove the exec.c handling in the makefile because it doesn't
have to be built to suppress elog calls.
2004-05-18 20:18:59 +00:00
Bruce Momjian f3f8d36a57 Update Makefile dependencies for Win32 timezones, per Claudio. 2004-05-18 04:10:33 +00:00
Bruce Momjian 3b382d1ae3 Clean up some relative path install issues with Claudio's help. 2004-05-18 03:36:45 +00:00
Bruce Momjian 3febb477e6 Reorganize code to allow path-relative installs.
Create new get_* functions to access compiled-in paths and adjust if
relative installs are to be used.

Clean up substitute_libpath_macro() code.
2004-05-17 14:35:34 +00:00
Bruce Momjian 85383214ea Rename backendbin to backend_exec in initdb.c. 2004-05-17 13:17:29 +00:00
Neil Conway 2871f60f23 Change ln(), log(), power(), and sqrt() to emit the correct SQLSTATE
error codes for certain error conditions, as specified by SQL2003.
2004-05-16 23:18:55 +00:00
Neil Conway 52c82d590a Remove an unused (and empty) header file. 2004-05-14 22:21:43 +00:00
Neil Conway 0079547bcb Implement the width_bucket() function, per SQL2003. This commit only adds
a variant of the function for the 'numeric' datatype; it would be possible
to add additional variants for other datatypes, but I haven't done so yet.

This commit includes regression tests and minimal documentation; if we
want developers to actually use this function in applications, we'll
probably need to document what it does more fully.
2004-05-14 21:42:30 +00:00
Neil Conway 0cb27df5c6 Improve documentation for SQLSTATE error codes, per recent thread on
-patches.
2004-05-14 18:04:02 +00:00
Bruce Momjian 9f944f0443 Adjust find_my_exec/find_other_exec() so that the return parameter is
last, not first.  This fits our style better.
2004-05-14 17:04:48 +00:00
Bruce Momjian 550735cd73 Remove extra 'then'. 2004-05-14 16:29:12 +00:00
Tom Lane c53d6e927f Tighten parsing of boolean options to CREATE TYPE and related functions,
so as to deliver more useful error messages for mistakes like
'PASSEDBYVALUE = f'.  Per gripe from Gaetano Mendola.
2004-05-14 16:11:25 +00:00
Tom Lane 02409a4813 Propagate enlargeStringInfo() fixes into the equivalent code in
pqexpbuffer.c.  While a client-side failure doesn't seem like a
security issue, it's still a bug.
2004-05-14 00:20:38 +00:00
Bruce Momjian 0ec80be435 Properly quote variable for makefile use. 2004-05-14 00:10:52 +00:00
Bruce Momjian 3f41675f6a Move unixware thread stuff into Makefile.unixware. 2004-05-14 00:03:07 +00:00
Bruce Momjian 5e938d831a Force thread flags for all Unixware builds if threading is requested.
This is required because once you link with a library that uses threads,
all references to that library have to use thread flags.
2004-05-13 23:05:54 +00:00
Bruce Momjian f69ecb4f8c Reorganize backend code to more cleanly manage executable names and
backend startup.
2004-05-13 22:45:04 +00:00
Bruce Momjian 261eda55d3 No need for gcc thread stuff anymore, only cc. 2004-05-13 15:44:05 +00:00
Bruce Momjian 9f7283eb1b Remove warning about Unixware. 2004-05-13 14:07:19 +00:00
Bruce Momjian c2e8386440 Fix Win32 bug with missing errno for strerror(). 2004-05-13 01:47:12 +00:00
Tom Lane 4d924bdb46 Tighten up overflow check in path_recv, pursuant to code review inspired
by Ken Ashcraft's report.  I think there is no actual bug here since if
the int32 value does wrap a little bit, palloc will still reject it.
Still it's better that the code be obviously correct.
2004-05-12 22:38:44 +00:00
Bruce Momjian 0a54441cbf Here's a patch that will allow external modules like pl<lang> to set
additional flags for the dlltool and dllwrap commands. More info here:

	http://archives.postgresql.org/pgsql-hackers/2004-05/msg00350.php

Thomas Hallgren
2004-05-12 21:56:27 +00:00
Bruce Momjian b1ffacddfc Rename find_my_binary/find_other_binary to
find_my_exec/find_other_exec().  Remove passing of progname to these
functions as they can find that out from argv[0], which they already
have.

Make get_progname return const char *, and update all progname variables
to be const char *.
2004-05-12 13:38:49 +00:00
Bruce Momjian b9ba13a80e Fix bug by passing arg[0] to find_my_binary(). 2004-05-12 03:48:42 +00:00
Tom Lane 3a0d95d181 Yawn ... still another place not quite ready for zero-column tables. 2004-05-11 22:43:55 +00:00
Bruce Momjian fda15b351a As part of the work for making relocatable installs, I have re-factored
all the code that looks for other binaries.  I move FindExec into
port/exec.c (and renamed it to find_my_binary()).  I also added
find_other_binary that looks for another binary in the same directory as
the calling program, and checks the version string.

The only behavior change was that initdb and pg_dump would look in the
hard-coded bindir directory if it can't find the requested binary in the
same directory as the caller.  The new code throws an error.  The old
behavior seemed too error prone for version mismatches.
2004-05-11 21:57:15 +00:00
Tom Lane a2160c5eeb Add tests to enlargeStringInfo() to avoid possible buffer-overrun or
infinite-loop problems if a bogus data length is passed.
2004-05-11 20:07:26 +00:00
Tom Lane 5ddbe904c0 Refactor low-level aclcheck code to provide useful interfaces for multi-bit
permissions tests in about the same amount of code as before.  Exactly what
the GRANT/REVOKE code ought to be doing is still up for debate, but this
should be helpful in any case, and it already solves an efficiency problem
in executor startup.
2004-05-11 17:36:13 +00:00
Tom Lane bef764029b Fix oversights in processing of LIMIT expressions during planning. 2004-05-11 13:15:15 +00:00
Tom Lane 1697568d57 Repair recalculation failure for nested sub-SELECTs, per bug report from
Didier Moens.  Bug is new in 7.4, and was caused by not updating everyplace
I should've when replacing locParam markers by allParam.
Add a regression test to catch related errors in future.
2004-05-11 02:21:39 +00:00
Bruce Momjian 608b85a23c Clean up indenting of Makefile filenames. 2004-05-10 23:09:04 +00:00
Tom Lane 2f63232d30 Promote row expressions to full-fledged citizens of the expression syntax,
rather than allowing them only in a few special cases as before.  In
particular you can now pass a ROW() construct to a function that accepts
a rowtype parameter.  Internal generation of RowExprs fixes a number of
corner cases that used to not work very well, such as referencing the
whole-row result of a JOIN or subquery.  This represents a further step in
the work I started a month or so back to make rowtype values into
first-class citizens.
2004-05-10 22:44:49 +00:00
Bruce Momjian c50faf944d Add variables names to static prototypes in initdb.c. 2004-05-10 20:51:58 +00:00
Michael Meskes 491dc124bf - Argh, just another bug in adjust_informix.
- Added "extern C" flags for C++ compiler. Hopefully I got that one right.
2004-05-10 13:46:06 +00:00
Tom Lane 7a3977c08d Fix a couple of oversights in new ALTER TABLE code that broke
ALTER SET STATISTICS for functional indexes.
2004-05-08 22:46:29 +00:00
Tom Lane c00b309932 Alter string format used for integer and OID lists in stored rules.
This simplifies and speeds up the reader by letting it get the representation
right the first time, rather than correcting it after-the-fact.  Also,
after int and OID lists become separate node types per Neil's pending
patch, this will let us treat these lists as just plain Nodes instead
of requiring separate read/write macros the way we have now.
2004-05-08 21:21:18 +00:00
Tom Lane 4af3421161 Get rid of rd_nblocks field in relcache entries. Turns out this was
costing us lots more to maintain than it was worth.  On shared tables
it was of exactly zero benefit because we couldn't trust it to be
up to date.  On temp tables it sometimes saved an lseek, but not often
enough to be worth getting excited about.  And the real problem was that
we forced an lseek on every relcache flush in order to update the field.
So all in all it seems best to lose the complexity.
2004-05-08 19:09:25 +00:00
Bruce Momjian ef0ec907bd Improve style of new log_statement_stats error message, per Peter. 2004-05-08 02:11:46 +00:00
Tom Lane dd16b7aa9e Get rid of cluster.c's apparatus for rebuilding a relation's indexes
in favor of using the REINDEX TABLE apparatus, which does the same thing
simpler and faster.  Also, make TRUNCATE not use cluster.c at all, but
just assign a new relfilenode and REINDEX.  This partially addresses
Hartmut Raschick's complaint from last December that 7.4's TRUNCATE is
an order of magnitude slower than prior releases.  By getting rid of
a lot of unnecessary catalog updates, these changes buy back about a
factor of two (on my system).  The remaining overhead seems associated
with creating and deleting storage files, which we may not be able to
do much about without abandoning transaction safety for TRUNCATE.
2004-05-08 00:34:49 +00:00
Neil Conway 7c6baade7b Refactor CheckDropPermissions() to move some initialization code for
printing the proper error message out of the common path.
2004-05-07 19:12:26 +00:00
Tom Lane d905057853 The timezone() family of functions (a/k/a AT TIME ZONE construct) can
safely be marked immutable, since their results don't depend on the
TimeZone GUC variable.  Per recent discussion.
2004-05-07 16:57:16 +00:00
Michael Meskes 2b55612645 - Added additional test case.
- Fixed bug that reversed string length in typedefs.
- Added portability file to pgtypeslib.
2004-05-07 13:42:49 +00:00
Tom Lane 573aaa52bc NATURAL CROSS JOIN is a contradiction in terms, not to mention disallowed
by the SQL spec and by our parser.  Thanks to Jonathan Scott for finding
this longstanding error.
2004-05-07 03:19:44 +00:00
Bruce Momjian 63d0139061 Remove crude test for log_statement_stats in startup code now that we
have a more proper GUC based test.

Also change error return code to ERRCODE_INVALID_PARAMETER_VALUE so it
matches the old error return code.
2004-05-07 01:53:41 +00:00
Bruce Momjian ae96e629b8 Throw error if log_statement_stats is used with confliction options for
per-query stage stats.
2004-05-07 01:34:08 +00:00
Tom Lane 0bd61548ab Solve the 'Turkish problem' with undesirable locale behavior for case
conversion of basic ASCII letters.  Remove all uses of strcasecmp and
strncasecmp in favor of new functions pg_strcasecmp and pg_strncasecmp;
remove most but not all direct uses of toupper and tolower in favor of
pg_toupper and pg_tolower.  These functions use the same notions of
case folding already developed for identifier case conversion.  I left
the straight locale-based folding in place for situations where we are
just manipulating user data and not trying to match it to built-in
strings --- for example, the SQL upper() function is still locale
dependent.  Perhaps this will prove not to be what's wanted, but at
the moment we can initdb and pass regression tests in Turkish locale.
2004-05-07 00:24:59 +00:00
Bruce Momjian 38b85b15c1 sysv_shmem.c patch is to correct a bug that prevents the postmaster
recovering from an unexpected backend termination.

The remaining patches are to allow whitespace in db/install directory
names.

Claudio Natoli
2004-05-06 19:23:25 +00:00
Bruce Momjian 22a2c4b576 Erase MD5 user passwords when a user is renamed because the username is
used as salt for the MD5 password.
2004-05-06 16:59:16 +00:00
Tom Lane 8325a8d69e Make ALTER COLUMN TYPE preserve clustered status for indexes it doesn't
modify.  Also fix a passel of problems with ALTER TABLE CLUSTER ON:
failure to check that the index is safe to cluster on (or even belongs
to the indicated rel, or even exists), and failure to broadcast a relcache
flush event when changing an index's state.
2004-05-06 16:10:57 +00:00
Tom Lane eee6f9d5c2 Rewrite nodeRead() in a less obfuscated fashion, per discussion with
Neil Conway.
2004-05-06 14:01:33 +00:00
Neil Conway 839be02ee1 Fix grammatical error in comment. 2004-05-06 06:11:01 +00:00
Tom Lane 9e16195f3f Second try at a portable unsetenv(). 2004-05-05 21:18:29 +00:00
Tom Lane dadce6509a Don't assume that struct timeval's tv_sec field is the same datatype as
time_t; on some platforms they are not the same width.  Per Manfred Koizar.
2004-05-05 17:28:46 +00:00
Tom Lane 1899203f3d Fix get_rels_with_domain to not do the wrong thing with views and
composite types that use a domain.
2004-05-05 17:06:56 +00:00
Tom Lane c7007d1848 Use a more portable technique for unsetting environment variables,
and unset PGCLIENTENCODING to prevent backend from dying if it's set
to something incompatible with the -E option.
2004-05-05 16:09:31 +00:00
Michael Meskes e845adf31f - Fixed bug in adjust_informix that treated arrays as simple variables.
- Synced parser again.
- Synced lexer.
2004-05-05 15:03:04 +00:00
Tom Lane 077db40fa1 ALTER TABLE rewrite. New cool stuff:
* ALTER ... ADD COLUMN with defaults and NOT NULL constraints works per SQL
spec.  A default is implemented by rewriting the table with the new value
stored in each row.

* ALTER COLUMN TYPE.  You can change a column's datatype to anything you
want, so long as you can specify how to convert the old value.  Rewrites
the table.  (Possible future improvement: optimize no-op conversions such
as varchar(N) to varchar(N+1).)

* Multiple ALTER actions in a single ALTER TABLE command.  You can perform
any number of column additions, type changes, and constraint additions with
only one pass over the table contents.

Basic documentation provided in ALTER TABLE ref page, but some more docs
work is needed.

Original patch from Rod Taylor, additional work from Tom Lane.
2004-05-05 04:48:48 +00:00
Bruce Momjian 3e3cb0a14a More PWD adjustments for win32. 2004-05-03 13:25:23 +00:00
Bruce Momjian 0142c00180 Use $build_platform for PWD flag test, per suggestion from Peter. 2004-05-02 21:30:08 +00:00
Bruce Momjian 5d7aec483c Update catalog version for acl removal changes. 2004-05-02 13:39:51 +00:00
Bruce Momjian a9d3c2cb18 Revert patch --- needs more generalized solution.
> Please find a attached a small patch that adds accessor functions
> for "aclitem" so that it is not an opaque datatype.
>
> I needed these functions to browse aclitems from user land. I can load
> them when necessary, but it seems to me that these accessors for a
> backend type belong to the backend, so I submit them.
>
> Fabien Coelho
2004-05-02 13:38:28 +00:00
Bruce Momjian e4a03f9e75 Set PWDFLAGS based on test platform, not target platform.
Andrew Dunstan
2004-05-02 10:24:51 +00:00
Bruce Momjian 14a5330806 this patch makes sure that:
* correct platform specific regression files are used under ming
 * pwd prints out a usable win32 pathname

Claudio Natoli
2004-05-02 04:27:37 +00:00
Bruce Momjian 3363b847ec Set std error to no buffering on Win32. 2004-05-02 04:25:45 +00:00
Bruce Momjian deb78dd833 More win32 adjustment for timezone directory. 2004-05-02 03:12:12 +00:00
Bruce Momjian f4c69c8205 Fix timezone data path for Unix and win32. 2004-05-01 22:07:03 +00:00
Bruce Momjian d7ee665089 Align prototype in C code. 2004-05-01 19:25:08 +00:00
Bruce Momjian ddfc4d1681 Remove debug output line. 2004-05-01 01:38:53 +00:00
Bruce Momjian 0a2b9f9cde Rename function to be less win32 specific. 2004-05-01 01:34:47 +00:00
Bruce Momjian e572246565 Suppress use of timezone library by ecpg. 2004-04-30 20:47:33 +00:00
Bruce Momjian 85b7e8351f Fix zic compiler to use pg version.
Move timezone database to share/timezone.
2004-04-30 20:23:28 +00:00
Bruce Momjian 04d426ba70 Allow build of timezone database on unix. 2004-04-30 20:01:39 +00:00
Bruce Momjian 1360fe4096 More timezone build adjustments. 2004-04-30 17:52:07 +00:00
Bruce Momjian 46050a3b75 Timezone code checks for HAVE_SYMLINK of zero, so use in pgtz.h:
#ifndef HAVE_SYMLINK
#define HAVE_SYMLINK 0
#endif
2004-04-30 16:58:48 +00:00
Bruce Momjian 82700281d0 More cleanups for USE_PGTZ. 2004-04-30 16:08:01 +00:00
Bruce Momjian b99a3a7541 Rename to USE_PGTZ to match code. 2004-04-30 15:01:25 +00:00
Bruce Momjian a640845c88 Allow timezone to compile under Unix by blocking 'timezone' conflict with
system headers.

Allow system to find timezone database by pasing pkglibdir into the
binary via a define.
2004-04-30 14:24:14 +00:00
Bruce Momjian e9a028f81f Convert DOS newlines to Unix newlines. 2004-04-30 04:44:06 +00:00
Bruce Momjian 7146eb0bc3 Integrate timezone library to be called only from Win32.
Timezone code backend integration done by Magnus Hagander.
2004-04-30 04:31:52 +00:00
Bruce Momjian 7d6f37b8c0 Enable use of our own timezone library for Win32. 2004-04-30 04:18:28 +00:00
Bruce Momjian 4a73eb5ab1 Minor adjustments to enable public-domain timezone library to be called
from our code.
2004-04-30 04:14:06 +00:00
Bruce Momjian d248a67af1 Timezone library changes to map into our backend code. 2004-04-30 04:11:58 +00:00
Bruce Momjian 6a2b75c2c8 Add Olson's public domain timezone library to src/timezone. 2004-04-30 04:09:23 +00:00
Michael Meskes d51d870f9e Synced parser and keyword list. 2004-04-29 14:08:10 +00:00
Bruce Momjian e27338f26c Do thread testing from configure in a much cleaner fashion. 2004-04-27 19:51:12 +00:00
Bruce Momjian ca8a8baa76 Add comments. 2004-04-27 18:40:50 +00:00
Bruce Momjian f687c7e87f Use mktemp for temporary file names, per suggestion from Peter. 2004-04-27 18:36:31 +00:00
Bruce Momjian b498b795a0 Move postgres.h to the top of the C file. 2004-04-27 17:22:41 +00:00
Bruce Momjian 095ed37f13 Fix subdir for thread test program. 2004-04-26 18:32:33 +00:00
Bruce Momjian efc34e29a2 Add $(X) for cross-compiling. Seems the mingw compiler running on
FreeBSD doesn't add .EXE to links.

Michiel Ephraim
2004-04-26 17:40:48 +00:00
Bruce Momjian 725524bd3b Please find attached a small patch against current cvs head, so that
'information_schema' is considered a system schema by various
pg_stat*_*_{tables,sequences} views.

Fabien COELHO
2004-04-26 15:24:42 +00:00
Bruce Momjian 0a17fd726c Please find a attached a small patch that adds accessor functions
for "aclitem" so that it is not an opaque datatype.

I needed these functions to browse aclitems from user land. I can load
them when necessary, but it seems to me that these accessors for a
backend type belong to the backend, so I submit them.

Fabien Coelho
2004-04-26 15:06:49 +00:00
Dennis Bjorklund 9d8b414722 Translation updates 2004-04-26 06:33:10 +00:00
Bruce Momjian 30a06fe2c4 Unconditionally define:
-D_REENTRANT -D_THREAD_SAFE -D_POSIX_PTHREAD_SEMANTICS

for all ports.  It can't hurt if they are not supported, but it makes
our job easier for porting.

Should fix Darwin compile and other platforms without mucking with the
thread detection code.
2004-04-26 04:04:42 +00:00
Bruce Momjian f5b6ce7cb9 Clean tools/thread on make clean/distclean. 2004-04-26 00:48:38 +00:00
Bruce Momjian 144d828e7f More thread error improvments. 2004-04-26 00:38:25 +00:00
Bruce Momjian 2f5223600a More thread error message improvments. 2004-04-26 00:36:18 +00:00
Neil Conway 0370951347 Tiny assorted fixes: correct a typo in a comment in vacuumlazy.c, remove
some unused #include directives from bufmgr.c, and clarify comments in
bufmgr.h and buf.h
2004-04-25 23:50:58 +00:00
Bruce Momjian 6a27640230 Fix typo on thread lib name. 2004-04-25 21:03:27 +00:00
Bruce Momjian 45fbab2933 Make thread flags CFLAGS, not CPPFLAGS. 2004-04-25 20:57:32 +00:00
Bruce Momjian ae5bc8a601 No need to use our standard libs for the thread test --- they might not
be compiled yet.
2004-04-25 20:47:56 +00:00
Neil Conway 1812d3b233 Remove the last traces of Joe Hellerstein's "xfunc" optimization. Patch
from Alvaro Herrera. Also, removed lispsort.c, since it is no longer
used.
2004-04-25 18:23:57 +00:00
Tom Lane 2ce964b958 Ensure getaddrinfo_all returns null result on failure. 2004-04-24 20:10:34 +00:00
Bruce Momjian f6646efa4c Hook thread_test program run at the end of configure run.
Add test for cross-compiles that they have to run the thread_test
program on the target machine.
2004-04-23 23:58:12 +00:00
Bruce Momjian 95178c8d24 Report error if thread-test is run without having threading enabled in
configure.
2004-04-23 22:21:49 +00:00
Bruce Momjian 66b42d3028 Improve thread test program. Test only functions that need testing. 2004-04-23 20:35:50 +00:00
Neil Conway fc7fd50182 Add ceiling() as an alias for ceil(), and power() as an alias for pow().
Regression tests and documentation have both been updated.

SQL2003 requires that both ceiling() and ceil() be present, so I have
documented both spellings. SQL2003 doesn't mention pow() as far as I
can see, so I decided to replace pow() with power() in the documentation:
there is little reason to encourage the continued usage of a function
that isn't compliant with the standard, given a standard-compliant
alternative.

RELEASE NOTES: should state that pow() is considered deprecated
(although I don't see the need to ever remove it.)
2004-04-23 20:32:20 +00:00
Bruce Momjian 7a66015e98 Add new auto-detection of thread flags.
Allow additional thread flags to be added via port templates.

Change thread flag names to PTHREAD_CFLAGS and PTHREAD_LIBS to match new
configure script.
2004-04-23 18:15:55 +00:00
Michael Meskes 77528c9bd7 Fixed memory misusage in variable handling. 2004-04-23 06:17:14 +00:00
Bruce Momjian 1b4e82559c Simplify thread test program. 2004-04-22 23:58:03 +00:00
Neil Conway 0fa2afa93a Make psql's \d+ command indicate whether the table in question
contains OIDs. Also, minor documentation improvements to the
psql reference page.
2004-04-22 17:38:16 +00:00
Bruce Momjian b3bc93a4b7 Rename global psql startup file to psqlrc.sample. 2004-04-22 14:34:38 +00:00
Bruce Momjian 65b020bd61 Fix filename mention in psqlrc.sample file. 2004-04-22 14:33:49 +00:00
Neil Conway 139abc2896 Make LocalRefCount and PrivateRefCount arrays of int32, rather than long.
This saves a small amount of per-backend memory for LP64 machines.
2004-04-22 07:21:55 +00:00
Bruce Momjian b00d50d365 Per discussion earlier today, here is a fix that lets ereport() on win32
report socket errors.

Magnus Hagander
2004-04-22 03:51:24 +00:00
Bruce Momjian 914042fe5f This patch makes the EXECUTE command's completion tag return the
completion tag of the actual statement executed.  This allows the
correct update count to be returned for UPDATE/INSERT/DELETE
statements.

Kris Jurka
2004-04-22 02:58:21 +00:00
Bruce Momjian ec7c4c1b66 Please find attached a small patch so that "pg_restore" ignores some sql
errors. This is the second submission, which integrates Tom comments about
localisation and exit code. I also added some comments about one sql
command which is not ignored.

Fabien COELHO
2004-04-22 02:39:10 +00:00
Bruce Momjian be6bbcef56 Add global psql config file, psql.rc.sample. 2004-04-22 01:53:37 +00:00
Bruce Momjian f9a2d0b2fb More thread test program improvements. 2004-04-21 20:58:56 +00:00
Bruce Momjian 53b5455387 Improve thread test program to show if non-*_r functions are even called. 2004-04-21 20:51:54 +00:00
Tom Lane 37fa3b6c89 Tweak indexscan and seqscan code to arrange that steps from one page to
the next are handled by ReleaseAndReadBuffer rather than separate
ReleaseBuffer and ReadBuffer calls.  This cuts the number of acquisitions
of the BufMgrLock by a factor of 2 (possibly more, if an indexscan happens
to pull successive rows from the same heap page).  Unfortunately this
doesn't seem enough to get us out of the recently discussed context-switch
storm problem, but it's surely worth doing anyway.
2004-04-21 18:24:26 +00:00
Tom Lane 95a03e9cdf Another round of code cleanup on bufmgr. Use BM_VALID flag to keep track
of whether we have successfully read data into a buffer; this makes the
error behavior a bit more transparent (IMHO anyway), and also makes it
work correctly for local buffers which don't use Start/TerminateBufferIO.
Collapse three separate functions for writing a shared buffer into one.
This overlaps a bit with cleanups that Neil proposed awhile back, but
seems not to have committed yet.
2004-04-21 18:06:30 +00:00
Bruce Momjian 49d3d9cf40 Change COPY CSV keyword to be:
FORCE QUOTE to force quotes
	FORCE NOT NULL to quote null input values
2004-04-21 00:34:18 +00:00
Bruce Momjian 9b04ddc185 Add NetBSD thread compile flags. 2004-04-20 14:36:49 +00:00
Bruce Momjian 6949fc0269 Remove pg_encoding. Not needed anymore since we have an initdb in C. 2004-04-20 00:40:06 +00:00
PostgreSQL Daemon 41fa9e9bae Remove all of the libpgtcl and pgtclsh files, including all references to
them within the various makefiles

with_tcl is still required for the src/pl/tcl language
2004-04-20 00:33:53 +00:00
Tom Lane 011c3e62e7 Code review for ARC patch. Eliminate static variables, improve handling
of VACUUM cases so that VACUUM requests don't affect the ARC state at all,
avoid corner case where BufferSync would uselessly rewrite a buffer that
no longer contains the page that was to be flushed.  Make some minor
other cleanups in and around the bufmgr as well, such as moving PinBuffer
and UnpinBuffer into bufmgr.c where they really belong.
2004-04-19 23:27:17 +00:00
Bruce Momjian 52e4f27af9 Prevent doubling of escapes when not in quote mode for CSV. 2004-04-19 21:58:02 +00:00
Bruce Momjian e60da4bcf6 Remove debug code that acidentally got into CVS from previous commit. 2004-04-19 21:22:14 +00:00
Bruce Momjian 09f317539a Fix for BEGIN with ISOLATION/READONLY clauses.
Fix for code originally added for 7.5.
2004-04-19 21:21:34 +00:00
Bruce Momjian 31338352bd * Most changes are to fix warnings issued when compiling win32
* removed a few redundant defines
* get_user_name safe under win32
* rationalized pipe read EOF for win32 (UPDATED PATCH USED)
* changed all backend instances of sleep() to pg_usleep

    - except for the SLEEP_ON_ASSERT in assert.c, as it would exceed a
32-bit long [Note to patcher: If a SLEEP_ON_ASSERT of 2000 seconds is
acceptable, please replace with pg_usleep(2000000000L)]

I added a comment to that part of the code:

    /*
     *  It would be nice to use pg_usleep() here, but only does 2000 sec
     *  or 33 minutes, which seems too short.
     */
    sleep(1000000);

Claudio Natoli
2004-04-19 17:42:59 +00:00
Bruce Momjian 862b20b382 Complete TODO item:
o -Allow dump/load of CSV format

This adds new keywords to COPY and \copy:

        CSV - enable CSV mode (comma separated variable)
        QUOTE - specify quote character
        ESCAPE - specify escape character
        FORCE - force quoting of specified column
	LITERAL - suppress null comparison for columns

Doc changes included.  Regression updates coming from Andrew.
2004-04-19 17:22:31 +00:00
Tom Lane b5e52b080c Tweak findTargetlistEntry so that bare names occurring in GROUP BY clauses
are sought first as local FROM columns, then as local SELECT-list aliases,
and finally as outer FROM columns; the former behavior made outer FROM
columns take precedence over aliases.  This does not change spec
conformance because SQL99 allows only the first case anyway, and it seems
more useful and self-consistent.  Per gripe from Dennis Bjorklund 2004-04-05.
2004-04-18 18:12:58 +00:00
Bruce Momjian 3e2aef58a2 Handle Warn_restart_ready properly in SIGTERM safety patch. 2004-04-16 12:59:05 +00:00
Bruce Momjian 3a14336746 Modify COPY for() loop to use attnum as a variable name, not 'i'. 2004-04-15 22:36:03 +00:00
Tom Lane 6c72f44c62 Improve syntax error messages for invalid-argument cases in RETURN and
RETURN NEXT.
2004-04-15 13:01:45 +00:00