Commit Graph

1004 Commits

Author SHA1 Message Date
Tom Lane 368739dca8 Fix bogus assumption that sizeof() produces an int-sized result. 2005-06-20 00:32:22 +00:00
Tom Lane 3f749924f8 Simplify uses of readdir() by creating a function ReadDir() that
includes error checking and an appropriate ereport(ERROR) message.
This gets rid of rather tedious and error-prone manipulation of errno,
as well as a Windows-specific bug workaround, at more than a dozen
call sites.  After an idea in a recent patch by Heikki Linnakangas.
2005-06-19 21:34:03 +00:00
Bruce Momjian 1f01d59e06 Fix display of database name during autovacuum.
Cosimo Streppone
2005-06-15 13:55:23 +00:00
Tom Lane 8563ccae2c Simplify shared-memory lock data structures as per recent discussion:
it is sufficient to track whether a backend holds a lock or not, and
store information about transaction vs. session locks only in the
inside-the-backend LocalLockTable.  Since there can now be but one
PROCLOCK per lock per backend, LockCountMyLocks() is no longer needed,
thus eliminating some O(N^2) behavior when a backend holds many locks.
Also simplify the LockAcquire/LockRelease API by passing just a
'sessionLock' boolean instead of a transaction ID.  The previous API
was designed with the idea that per-transaction lock holding would be
important for subtransactions, but now that we have subtransactions we
know that this is unwanted.  While at it, add an 'isTempObject' parameter
to LockAcquire to indicate whether the lock is being taken on a temp
table.  This is not used just yet, but will be needed shortly for
two-phase commit.
2005-06-14 22:15:33 +00:00
Teodor Sigaev 7148de1fa8 Prevent to divide by zero and range out of 0..1 2005-06-01 11:45:03 +00:00
Tom Lane 12a323b7a8 Change relblocknumber field of pg_buffercache view from numeric to int8
for efficiency's sake.  Mark Kirkwood.
2005-05-31 00:07:47 +00:00
Tom Lane 978129f28e Document get_call_result_type() and friends; mark TypeGetTupleDesc()
and RelationNameGetTupleDesc() as deprecated; remove uses of the
latter in the contrib library.  Along the way, clean up crosstab()
code and documentation a little.
2005-05-30 23:09:07 +00:00
Tom Lane 140b078d2a Improve LockAcquire API per my recent proposal. All error conditions
are now reported via elog, eliminating the need to test the result code
at most call sites.  Make it possible for the caller to distinguish a
freshly acquired lock from one already held in the current transaction.
Use that capability to avoid redundant AcceptInvalidationMessages() calls
in LockRelation().
2005-05-29 22:45:02 +00:00
Tom Lane e92a88272e Modify hash_search() API to prevent future occurrences of the error
spotted by Qingqing Zhou.  The HASH_ENTER action now automatically
fails with elog(ERROR) on out-of-memory --- which incidentally lets
us eliminate duplicate error checks in quite a bunch of places.  If
you really need the old return-NULL-on-out-of-memory behavior, you
can ask for HASH_ENTER_NULL.  But there is now an Assert in that path
checking that you aren't hoping to get that behavior in a palloc-based
hash table.
Along the way, remove the old HASH_FIND_SAVE/HASH_REMOVE_SAVED actions,
which were not being used anywhere anymore, and were surely too ugly
and unsafe to want to see revived again.
2005-05-29 04:23:07 +00:00
Tom Lane b4176e9f4c Clean up bogus checking of date and numeric fields in DBF files,
per report from Boris van Schooten.
2005-05-27 15:44:04 +00:00
Neil Conway a4374f9070 Remove second argument from textToQualifiedNameList(), as it is no longer
used. From Jaime Casanova.
2005-05-27 00:57:49 +00:00
Bruce Momjian b492c3accc Add parentheses to macros when args are used in computations. Without
them, the executation behavior could be unexpected.
2005-05-25 21:40:43 +00:00
Neil Conway a99b2852ca Correct a thinko in pgbench that might result in incorrectly ignoring an
error condition when executing some DDL. Per report from ITAGAKI Takahiro.
2005-05-24 00:26:40 +00:00
Neil Conway 36ab600511 Cleanup of GiST extensions in contrib/: now that we always invoke GiST
methods in a short-lived memory context, there is no need for GiST methods
to do their own manual (and error-prone) memory management.
2005-05-21 12:08:06 +00:00
Tom Lane 191b13aaca Factor out lock cleanup code that is needed in several places in lock.c.
Also, remove the rather useless return value of LockReleaseAll.  Change
response to detection of corruption in the shared lock tables to PANIC,
since that is the only way of cleaning up fully.
Originally an idea of Heikki Linnakangas, variously hacked on by
Alvaro Herrera and Tom Lane.
2005-05-19 23:30:18 +00:00
Tom Lane a9c4c9cd52 Extend the pg_locks system view so that it can fully display all lock
types, as per recent discussion.
2005-05-17 21:46:11 +00:00
Tom Lane 4e7d6f5349 Add a --dbname option to the pg_regress script, and use pl_regression
for testing PLs and contrib_regression for testing contrib, instead of
overwriting the core system's regression database as formerly done.
Andrew Dunstan
2005-05-17 18:26:23 +00:00
Neil Conway c891e05f26 Cleanup GiST header files. Since GiST extensions are often written as
external projects, we should be careful about what parts of the GiST
API are considered implementation details, and which are part of the
public API. Therefore, I've moved internal-only declarations into
gist_private.h -- future backward-incompatible changes to gist.h should
be made with care, to avoid needlessly breaking external GiST extensions.

Also did some related header cleanup: remove some unnecessary #includes
from gist.h, and remove some unused definitions: isAttByVal(), _gistdump(),
and GISTNStrategies.
2005-05-17 03:34:18 +00:00
Neil Conway c6c6fa8f7e Fix typo in comment. 2005-05-16 06:45:57 +00:00
Neil Conway 8d6e9bca37 This patch makes some minor style cleanups to contrib/btree_gist: remove
the "extern" keyword from function definitions, reorganize some
PG_GETARG_XXX() usage, and similar.
2005-05-12 00:39:37 +00:00
Bruce Momjian cc99c57e1e a small tweak to enable display in the log file
of database name before table name
when VACUUMing or ANALYZing a table.

Cosimo Streppone
2005-05-11 18:07:14 +00:00
Bruce Momjian be1cc6955c Fix pg_autovacuum -s flag to handle values > 2000 by using sleep()
instead of pg_usleep.

Backpatch to 8.0.X.
2005-05-11 17:57:56 +00:00
Bruce Momjian 8ca26e7799 Tag 1000000L as long for compuation. 2005-05-11 14:53:43 +00:00
Tom Lane 278bd0cc22 For some reason access/tupmacs.h has been #including utils/memutils.h,
which is neither needed by nor related to that header.  Remove the bogus
inclusion and instead include the header in those C files that actually
need it.  Also fix unnecessary inclusions and bad inclusion order in
tsearch2 files.
2005-05-06 17:24:55 +00:00
Tom Lane 177af51c04 Change tsearch2 to not use the unsafe practice of creating functions
that return INTERNAL without also having INTERNAL arguments.  Since the
functions in question aren't meant to be called by hand anyway, I just
redeclared them to take 'internal' instead of 'text'.  Also add code
to ProcedureCreate() to enforce the restriction, as I should have done
to start with :-(
2005-05-03 16:51:00 +00:00
Neil Conway 39e54e3208 Fix typos in documentation. 2005-05-03 03:10:01 +00:00
Tom Lane 3a694bb0a1 Restructure LOCKTAG as per discussions of a couple months ago.
Essentially, we shoehorn in a lockable-object-type field by taking
a byte away from the lockmethodid, which can surely fit in one byte
instead of two.  This allows less artificial definitions of all the
other fields of LOCKTAG; we can get rid of the special pg_xactlock
pseudo-relation, and also support locks on individual tuples and
general database objects (including shared objects).  None of those
possibilities are actually exploited just yet, however.

I removed pg_xactlock from pg_class, but did not force initdb for
that change.  At this point, relkind 's' (SPECIAL) is unused and
could be removed entirely.
2005-04-29 22:28:24 +00:00
Tom Lane c5b08d3b7d Fix btree_gist to handle timetz zone correctly per recent changes. 2005-04-25 07:00:32 +00:00
Tom Lane d79eeef38b Treat a zero-D array as empty in int_enum(), per Andrew@supernews. 2005-04-23 17:55:50 +00:00
Tom Lane 0548497cc5 int_aggregate's int_enum() doesn't work correctly with arrays that
aren't 1-D, so give an error message instead of failing.  Per report
from Ron Mayer.
2005-04-23 05:38:22 +00:00
Teodor Sigaev 04ce41ca62 Add comment about permissions on pg_ts* tables 2005-04-19 13:58:48 +00:00
Bruce Momjian 7cce39c7ce The following patch should allow UPDATE_INTERVAL to be specified on the
command line. We find this useful because we frequently deal with
thousands of tables in an environment where neither the databases nor
the tables are updated frequently. This helps allow us to cut down on
the overhead of updating the list for every other primary loop of
pg_autovacuum.

I chose -i as the command-line argument and documented it briefly in
the README.

The patch was applied to the 7.4.7 version of pg_autovacuum in contrib.

Thomas F.O'Connell
2005-04-19 03:35:15 +00:00
Tom Lane 162bd08b3f Completion of project to use fixed OIDs for all system catalogs and
indexes.  Replace all heap_openr and index_openr calls by heap_open
and index_open.  Remove runtime lookups of catalog OID numbers in
various places.  Remove relcache's support for looking up system
catalogs by name.  Bulky but mostly very boring patch ...
2005-04-14 20:03:27 +00:00
Tom Lane 503edbdbff Put back code mistakenly removed from copy of postmaster's
daemonize routine, namely forcing stdin/stdout/stderr to point
to /dev/null.  Per Karl Denninger.
2005-04-03 00:01:51 +00:00
Neil Conway f5dbbdcf00 Remove pg_buffercache_pages.h -- patch from Mark Kirkwood. 2005-04-01 08:41:19 +00:00
Teodor Sigaev fb13881f42 1 fix various comparing functions
2 implement gtsvector_out for use with gevel module (debug GiST indexes, http://www.sai.msu.su/~megera/postgres/gist/gevel/)
2005-03-31 15:08:08 +00:00
Neil Conway e1b398c6f5 Fix build error in pg_buffercache on Win32 (native and cygwin). From
Mark Kirkwood.
2005-03-31 00:45:26 +00:00
Neil Conway 8962b6106b Document that the "-P" option to pg_autovacuum is insecure on many
platforms, and suggest using ~/.pgpass instead.
2005-03-30 05:05:01 +00:00
Tom Lane 70c9763d48 Convert oidvector and int2vector into variable-length arrays. This
change saves a great deal of space in pg_proc and its primary index,
and it eliminates the former requirement that INDEX_MAX_KEYS and
FUNC_MAX_ARGS have the same value.  INDEX_MAX_KEYS is still embedded
in the on-disk representation (because it affects index tuple header
size), but FUNC_MAX_ARGS is not.  I believe it would now be possible
to increase FUNC_MAX_ARGS at little cost, but haven't experimented yet.
There are still a lot of vestigial references to FUNC_MAX_ARGS, which
I will clean up in a separate pass.  However, getting rid of it
altogether would require changing the FunctionCallInfoData struct,
and I'm not sure I want to buy into that.
2005-03-29 00:17:27 +00:00
Bruce Momjian 6b7ef076b5 Have libpgport link before libpq so that PG client applications are more
immunte to changes in libpq's usage of pgport between major versions.
2005-03-25 18:17:14 +00:00
Neil Conway 6a8eb1a7b6 pgcrypto update:
* test error handling
* add tests for des, 3des, cast5
* add some tests to blowfish, rijndael
* Makefile: ability to specify different tests for different crypto
  libraries, so we can skip des, 3des and cast5 for builtin.

Marko Kreen
2005-03-21 05:24:52 +00:00
Neil Conway 19b676869a pgcrypto update:
Reserve px_get_random_bytes() for strong randomness,
add new function px_get_pseudo_random_bytes() for
weak randomness and use it in gen_salt().

On openssl case, use RAND_pseudo_bytes() for
px_get_pseudo_random_bytes().

Final result is that is user has not configured random
souce but kept the 'silly' one, gen_salt() keeps
working, but pgp_encrypt() will throw error.

Marko Kreen
2005-03-21 05:22:14 +00:00
Neil Conway 1ea9169b42 pgcrypto update:
* openssl.c: Add 3des and AES support
* README.pgcrypto: list only supported ciphers for openssl

OpenSSL has pre-processor symbol OPENSSL_NO_AES, which
isn't that helpful for detecting if it _does_ exist.
Thus the hack with AES_ENCRYPT.

Marko Kreen
2005-03-21 05:21:04 +00:00
Neil Conway b160d6b9dc pgcrypto update:
* Use error codes instead of -1
* px_strerror for new error codes
* calling convention change for px_gen_salt - return error code
* use px_strerror in pgcrypto.c

Marko Kreen
2005-03-21 05:19:55 +00:00
Neil Conway fa332a06ec * construct "struct {} list [] = {}" confuses pgindent - split those.
It was a bad style to begin with, and now several loops can be clearer.
* pgcrypto.c: Fix function comments
* crypt-gensalt.c, crypt-blowfish.c: stop messing with errno
* openssl.c: use px_free instead pfree
* px.h: make redefining px_alloc/px_realloc/px_free easier

Marko Kreen
2005-03-21 05:18:46 +00:00
Neil Conway 3cc8661232 Remove support for libmhash/libmcrypt.
libmcrypt seems to dead, maintainer address bounces,
and cast-128 fails on 2 of the 3 test vectors from RFC2144.

So I see no reason to keep around stuff I don't trust
anymore.

Support for several crypto libraries is probably only
confusing to users, although it was good for initial
developing - it helped to find hidden assumptions and
forced me to create regression tests for all functionality.

Marko Kreen
2005-03-21 05:17:16 +00:00
Tom Lane fa5e44017a Adjust the API for aggregate function calls so that a C-coded function
can tell whether it is being used as an aggregate or not.  This allows
such a function to avoid re-pallocing a pass-by-reference transition
value; normally it would be unsafe for a function to scribble on an input,
but in the aggregate case it's safe to reuse the old transition value.
Make int8inc() do this.  This gets a useful improvement in the speed of
COUNT(*), at least on narrow tables (it seems to be swamped by I/O when
the table rows are wide).  Per a discussion in early December with
Neil Conway.  I also fixed int_aggregate.c to check this, thereby
turning it into something approaching a supportable technique instead
of being a crude hack.
2005-03-12 20:25:06 +00:00
Neil Conway de004e44e2 Add pg_buffercache contrib module, from Mark Kirkwood. 2005-03-12 15:36:24 +00:00
Neil Conway 919594f3e2 Some builds (depends on crypto engine support?) of OpenSSL
0.9.7x have EVP_DigestFinal function which which clears all of
EVP_MD_CTX.  This makes pgcrypto crash in functions which
re-use one digest context several times: hmac() and crypt()
with md5 algorithm.

Following patch fixes it by carring the digest info around
EVP_DigestFinal and re-initializing cipher.

Marko Kreen.
2005-03-12 06:53:54 +00:00
Teodor Sigaev 31b6d840f6 Prevent rank change in case of duplicate search terms 2005-03-05 15:48:32 +00:00