Commit Graph

1356 Commits

Author SHA1 Message Date
Neil Conway a323ede280 Fix a few places that were checking for the return value of palloc() to be
non-NULL: palloc() ereports on OOM, so we can safely assume it returns a
valid pointer.
2006-03-19 22:22:56 +00:00
Tom Lane 20ab467d76 Improve parser so that we can show an error cursor position for errors
during parse analysis, not only errors detected in the flex/bison stages.
This is per my earlier proposal.  This commit includes all the basic
infrastructure, but locations are only tracked and reported for errors
involving column references, function calls, and operators.  More could
be done later but this seems like a good set to start with.  I've also
moved the ReportSyntaxErrorPosition logic out of psql and into libpq,
which should make it available to more people --- even within psql this
is an improvement because warnings weren't handled by ReportSyntaxErrorPosition.
2006-03-14 22:48:25 +00:00
Neil Conway 48fb696753 Fix a number of syntax errors in contrib modules' uninstall scripts.
Most of the changes add the mandatory USING clause to DROP OPERATOR
CLASS statements.  DROP TYPE is now DROP TYPE CASCADE; without
CASCADE a DROP TYPE fails due to the circular dependency on the
type's I/O functions.  The DROP FUNCTION statements for the I/O
functions have been removed, as DROP TYPE CASCADE removes them
automatically. Patch from Michael Fuhr.
2006-03-13 18:04:58 +00:00
Bruce Momjian f3d99d160d Add CVS tag lines to files that were lacking them. 2006-03-11 04:38:42 +00:00
Neil Conway 7992d0fbca Remove a few places that attempted to define INT_MAX, SCHAR_MAX, and
similar constants if they were not previously defined. All these
constants must be defined by limits.h according to C89, so we can
safely assume they are present.
2006-03-11 01:19:22 +00:00
Tom Lane 7d84d3ec1c Fix order of linking of libxslt and libxml2, per Dave Page. 2006-03-10 15:39:42 +00:00
Bruce Momjian daab4a101f Update /contrib regression tests for escape_string_warning. 2006-03-08 03:51:52 +00:00
Tom Lane fb51ad3419 Make all our flex and bison files use %option prefix or %name-prefix
(respectively) to rename yylex and related symbols.  Some were doing
it this way already, while others used not-too-reliable sed hacks in
the Makefiles.  It's all nice and consistent now.
2006-03-07 01:03:12 +00:00
Bruce Momjian f2f5b05655 Update copyright for 2006. Update scripts. 2006-03-05 15:59:11 +00:00
Teodor Sigaev 38c4fe87ac Significantly improve ranking:
1) rank_cd now use weight of lexemes
2) rank_cd and rank can use any combination of normalization methods:
        no normalization
        normalization by log(length of document)
        -----/------- by length of document
        -----/------- by number of unique word in document
        -----/------- by log(number of unique word in document)
        -----/------- by number of covers (only rank_cd)

Improve cover's search.

TODO: changes in documentation
2006-03-02 19:07:19 +00:00
Neil Conway 305fcb7aa4 Woops: also update the alternative "expected" files for contrib/cube's
regression tests to account for the new error message wording. It seems
today is not my day...
2006-03-01 23:00:56 +00:00
Neil Conway 485541a3aa Update the expected regression test results to account for the changes to
error messages I made yesterday -- thanks to Andrew Dunstan for reporting
this, and my apologies for missing it the first time.
2006-03-01 21:09:32 +00:00
Neil Conway 0d9742f99a Attached is a patch that replaces a bunch of places where StringInfos
are unnecessarily allocated on the heap rather than the stack. If the
StringInfo doesn't outlive the stack frame in which it is created,
there is no need to allocate it on the heap via makeStringInfo() --
stack allocation is faster.  While it's not a big deal unless the
code is in a critical path, I don't see a reason not to save a few
cycles -- using stack allocation is not less readable.

I also cleaned up a bit of code along the way: moved variable
declarations into a more tightly-enclosing scope where possible,
fixed some pointless copying of strings in dblink, etc.
2006-03-01 06:51:01 +00:00
Neil Conway 8e5a10d46c This patch makes the error message strings throughout the backend
more compliant with the error message style guide. In particular,
errdetail should begin with a capital letter and end with a period,
whereas errmsg should not. I also fixed a few related issues in
passing, such as fixing the repeated misspelling of "lexeme" in
contrib/tsearch2 (per Tom's suggestion).
2006-03-01 06:30:32 +00:00
Peter Eisentraut 7f4f42fa10 Clean up CREATE FUNCTION syntax usage in contrib and elsewhere, in
particular get rid of single quotes around language names and old WITH ()
construct.
2006-02-27 16:09:50 +00:00
Peter Eisentraut fe83b3ebc6 contrib uninstall scripts
by David Fetter
2006-02-27 12:54:39 +00:00
Peter Eisentraut e6917b1255 Remove ora2pg; now available at <http://www.samse.fr/GPL/ora2pg/>. 2006-02-25 19:18:58 +00:00
Tom Lane f87d4875e9 Fix vacuumlo to avoid unnecessary use of backslash in search pattern.
Per Michael Fuhr.
2006-02-23 22:33:59 +00:00
Teodor Sigaev dde9457294 Fixing and improve compound word support. This changes cannot be applied to
previous version iwthout recreating tsvector fields...

Thanks to Alexander Presber <aljoscha@weisshuhn.de> to discover a problem.
2006-02-20 17:51:05 +00:00
Neil Conway ce9b75db6b Patch from Marko Kreen:
pgcrypto crypt()/md5 and hmac() leak memory when compiled against
OpenSSL as openssl.c digest ->reset will do two DigestInit calls
against a context.  This happened to work with OpenSSL 0.9.6
but not with 0.9.7+.

Reason for the messy code was that I tried to avoid creating
wrapper structure to transport algorithm info and tried to use
OpenSSL context for it.  The fix is to create wrapper structure.

It also uses newer digest API to avoid memory allocations
on reset with newer OpenSSLs.

Thanks to Daniel Blaisdell for reporting it.
2006-02-18 20:48:51 +00:00
Tom Lane e9b978c82b Need a DLLIMPORT for MaxFSMPages, per buildfarm failure on snake. 2006-02-14 15:03:59 +00:00
Bruce Momjian d5dd3d451e Add contrib/pg_freespacemap to display free space map information.
Mark Kirkwood
2006-02-12 03:55:53 +00:00
Tom Lane b35fdaaa1a Clean up some signedness warnings. 2006-02-10 15:57:58 +00:00
Tom Lane b2be41a710 Fix fallout from psql line-wrapping patch. 2006-02-10 15:47:44 +00:00
Teodor Sigaev 01f2172ec1 Allow "'" symbol in affixes ("'s" affix in english): it was diallowed during
multibyte support work.
Add line number to error output during affix file parsing.
2006-02-10 12:56:14 +00:00
Teodor Sigaev 011c520cb6 renew output of regression test accordingly to
http://archives.postgresql.org/pgsql-committers/2006-02/msg00089.php
2006-02-10 11:18:40 +00:00
Teodor Sigaev 46a25ce6a9 1 Fix bug with very short word: prefix and suffix might be overlapped,
sorry but fix can't be applyed to previous version: it's require
  refill tsvector...
2 Small optimize of load time for huge dictionaries
3 use palloc instead of malloc during load dict file
2006-02-09 18:04:20 +00:00
Teodor Sigaev a6fefc866c Check number of affixes to prevent core dump with zero number of affixes 2006-02-06 15:45:34 +00:00
Teodor Sigaev 5e2707c45f Snowball multibyte. It's a pity, but snowball sources is very diferent for multibyte and
singlebyte encodings, so we should have snowball for every encodings.

I hope that finalize multibyte support work in tsearch2, but testing is needed...
2006-01-27 16:32:31 +00:00
Tom Lane 97ec950186 Update btree_gist for CIDR/INET changes --- there's really no need to
have a separate set of CIDR code here, either.
2006-01-26 04:22:36 +00:00
Teodor Sigaev 80324fb1e3 Fix typeing as Tom suggest 2006-01-23 14:24:06 +00:00
Tom Lane 33feb55c47 Replace bitwise looping with bytewise looping in hemdistsign and
sizebitvec of tsearch2, as well as identical code in several other
contrib modules.  This provided about a 20X speedup in building a
large tsearch2 index ... didn't try to measure its effects for other
operations.  Thanks to Stephan Vollmer for providing a test case.
2006-01-20 22:46:16 +00:00
Tom Lane 2645cb54cb Fix the assert_enabled issue properly. This eliminates the former ABI
difference between USE_ASSERT_CHECKING and not: the assert_enabled
variable is always there.
2006-01-08 21:24:37 +00:00
Tom Lane 507e07e277 There is a signedness bug in Openwall gen_salt code that pgcrypto uses.
This makes the salt space for md5 and xdes algorithms a lot smaller than
it should be.

Marko Kreen
2006-01-03 23:46:24 +00:00
Joe Conway 925952603d When the remote query result has a different number of columns
than the local query specifies (e.g. in the FROM clause),
throw an ERROR (instead of crashing). Fix for bug #2129 reported
by Akio Iwaasa.
2006-01-03 23:45:52 +00:00
Teodor Sigaev 7ac8a4be89 Multibyte encodings support for ISpell dictionary 2005-12-21 13:05:49 +00:00
Teodor Sigaev cb4ea994c6 Improve support of multibyte encoding:
- tsvector_(in|out)
- tsquery_(in|out)
- to_tsvector
- to_tsquery, plainto_tsquery
- 'simple' dictionary
2005-12-12 11:10:12 +00:00
Tom Lane 69525fc0ef Remove incorrect increment of lineno, per David Fetter.
Sync HEAD and 8.1 branches of pgbench.
2005-12-10 01:09:07 +00:00
Peter Eisentraut a29c04a541 Allow installation into directories containing spaces in the name. 2005-12-09 21:19:36 +00:00
Tom Lane c599a247bb Simplify lock manager data structures by making a clear separation between
the data defining the semantics of a lock method (ie, conflict resolution
table and ancillary data, which is all constant) and the hash tables
storing the current state.  The only thing we give up by this is the
ability to use separate hashtables for different lock methods, but there
is no need for that anyway.  Put some extra fields into the LockMethod
definition structs to clean up some other uglinesses, like hard-wired
tests for DEFAULT_LOCKMETHOD and USER_LOCKMETHOD.  This commit doesn't
do anything about the performance issues we were discussing, but it clears
away some of the underbrush that's in the way of fixing that.
2005-12-09 01:22:04 +00:00
Bruce Momjian 96e1fbe396 I recently received the Debian bug report below about missing iconv
support for the dbf2pg contrib module.

The submitter created a patch which replaces the silent ignoring of -F
(when iconv support is disabled) with a meaningful warning.

Martin Pitt
2005-12-08 18:04:33 +00:00
Teodor Sigaev faacdab101 Improve tag recognizing 2005-12-08 09:11:19 +00:00
Teodor Sigaev 9551ab2fe9 Fix small memory leak 2005-12-07 13:30:15 +00:00
Teodor Sigaev 4f94b49a31 Improve word parser.
- allow ~ in filenames
 - -8.2.1 now is '-' and '8.2.1' instead of '-8.2' '.' '3'
 - '.text' now is not a file
2005-12-07 13:12:54 +00:00
Teodor Sigaev 73f47aa0cd Fix stupid bug with sizeof 2005-12-06 18:22:33 +00:00
Teodor Sigaev e8c81e179e Improve word parser.
- improve file and path recognition
 - fix misspeling
 - improve tag recognition
2005-12-05 18:13:22 +00:00
Tatsuo Ishii baa6b22fcb Having blank lines in -f scripts was causing silent failures.
per David Fetter
2005-11-23 12:19:12 +00:00
Bruce Momjian aac96b8994 Fix pgindent of libpq-fe.h by hacking pgindent script.
Remove pgbench comment that was causing problems.
2005-11-23 04:23:30 +00:00
Bruce Momjian 436a2956d8 Re-run pgindent, fixing a problem where comment lines after a blank
comment line where output as too long, and update typedefs for /lib
directory.  Also fix case where identifiers were used as variable names
in the backend, but as typedefs in ecpg (favor the backend for
indenting).

Backpatch to 8.1.X.
2005-11-22 18:17:34 +00:00
Teodor Sigaev 3c6cd8a113 Fixes motivated by snake and spoonbill pgbuildfarm members 2005-11-22 09:01:35 +00:00
Teodor Sigaev 62699337bc remove forgotten // comments 2005-11-21 18:00:52 +00:00
Teodor Sigaev c52795d18a Text parser rewritten:
- supports multibyte encodings
        - more strict rules for lexemes
        - flex isn't used
Add:
        - tsquery plainto_tsquery(text)
          Function makes tsquery from plain text.
        - &&, ||, !! operation for tsquery for combining
          tsquery from it's parts:  'foo & bar' || 'asd' => 'foo & bar | asd'
2005-11-21 12:27:57 +00:00
Tom Lane 8ef289dba1 Defend against nulls-in-arrays in contrib/intarray. I may have put in
more tests than strictly necessary, but did not feel like tracing call
paths in detail ...
2005-11-19 03:00:09 +00:00
Tom Lane 25c00833cb Add defenses against nulls-in-arrays to contrib/ltree. Possibly it'd
be useful to actually do something with nulls, rather than reject them,
but I'll just close the hole for now.
2005-11-19 02:08:45 +00:00
Tom Lane 1d0d8d3c38 Mop-up for nulls-in-arrays patch: fix some places that access array
contents directly.
2005-11-18 02:38:24 +00:00
Tom Lane cecb607559 Make SQL arrays support null elements. This commit fixes the core array
functionality, but I still need to make another pass looking at places
that incidentally use arrays (such as ACL manipulation) to make sure they
are null-safe.  Contrib needs work too.
I have not changed the behaviors that are still under discussion about
array comparison and what to do with lower bounds.
2005-11-17 22:14:56 +00:00
Tatsuo Ishii 2feb930af6 Fix comment on -v option 2005-11-16 13:13:08 +00:00
Teodor Sigaev 08ee64ebf5 Remove usage of ArrayType->flags field, use pgsql's macros BITS_PER_BYTE instead
of self-defined macros, add limit of Array  to gist__int_ops. BTW, intarray now
doesn't support NULLs in arrays.
2005-11-14 16:11:37 +00:00
Teodor Sigaev bad1a5c217 Use postgres-wide macros BITS_PER_BYTE instead self-definenig macros, also use it for calculating bit length of TPQTGist 2005-11-14 14:44:06 +00:00
Teodor Sigaev 34b934f658 fix returning value 2005-11-14 09:59:13 +00:00
Teodor Sigaev 134bed8089 Fix rwrite(ARRAY) on 64-bit boxes:
Instead of getting elements of array manually call deconstruct_array
2005-11-09 09:26:04 +00:00
Teodor Sigaev 0645663e6c New features for tsearch2:
1 Comparison operation for tsquery
2 Btree index on tsquery
3 numnode(tsquery) - returns 'length' of tsquery
4 tsquery @ tsquery, tsquery ~ tsquery - contains, contained for tsquery.
  Note: They don't gurantee exact result, only MAY BE, so it
  useful only for speed up rewrite functions
5 GiST index support for @,~
6 rewrite():
        select rewrite(orig, what, to);
        select rewrite(ARRAY[orig, what, to]) from tsquery_table;
        select rewrite(orig, 'select what, to from tsquery_table;');
7 significantly improve cover algorithm
2005-11-08 17:08:46 +00:00
Tom Lane 2a8d3d83ef R-tree is dead ... long live GiST. 2005-11-07 17:36:47 +00:00
Teodor Sigaev 6812abb673 Fix incorrect header size macros 2005-11-03 18:16:31 +00:00
Tom Lane da9fc25909 pgcrypto documentation polishing from Marko Kreen, and a small amount
of copy-editing from myself.
2005-11-03 02:54:07 +00:00
Teodor Sigaev 1dd6bd19fa Add sanity check of query 2005-10-31 13:47:09 +00:00
Tom Lane 9ee0a7df50 Fix some allocation size calculation errors that would cause pgbench
to fail with large test scripts.
2005-10-29 19:38:07 +00:00
Teodor Sigaev 21b748e76a 1 Fix problem with lost precision in rank with OR-ed lexemes
2 Allow tsquery_in to input void tsquery: resolve dump/restore problem with tsquery
2005-10-28 13:05:06 +00:00
Joe Conway 056eb1412c When a cursor is opened using dblink_open, only start a transaction
if there isn't one already open. Upon dblink_close, only commit
the open transaction if it was started by dblink_open, and only
then when all cursors opened by dblink_open are closed. The transaction
accounting is done individually for all named connections, plus
the persistent unnamed connection.
2005-10-18 02:55:49 +00:00
Tom Lane c62b29a603 Fix several contrib makefiles that failed in VPATH builds, particularly
when not using gcc (which has slightly nonstandard inclusion rules).
2005-10-18 01:30:49 +00:00
Tom Lane ad148c4154 Suppress warnings on platforms where fprintf is a macro (eg, recent
Fedora).  This was already done by somebody for the core flex files,
but these contrib files seem to have been missed.
2005-10-15 20:37:36 +00:00
Tom Lane b562639561 Fix bogus error test in get_ti_Oid(). 2005-10-15 20:28:59 +00:00
Tom Lane 0631059c9c Fix unportable struct initializations. 2005-10-15 20:24:00 +00:00
Bruce Momjian 1dc3498251 Standard pgindent run for 8.1. 2005-10-15 02:49:52 +00:00
Bruce Momjian 3af21fa568 Mark xslt_process() as volatile. 2005-10-13 16:10:14 +00:00
Bruce Momjian 40e1b30f63 Change xpath_table() and xslt_process() from IMMUTABLE to STABLE. 2005-10-13 14:58:33 +00:00
Bruce Momjian 7d43349ab5 Fix capitalization of example. 2005-10-13 14:44:58 +00:00
Tom Lane 07eeb9d109 Do all accesses to shared buffer headers through volatile-qualified
pointers, to ensure that compilers won't rearrange accesses to occur
while we're not holding the buffer header spinlock.  It's probably
not necessary to mark volatile in every single place in bufmgr.c,
but better safe than sorry.  Per trouble report from Kevin Grittner.
2005-10-12 16:45:14 +00:00
Tom Lane 313ed1ed94 Fix (hopefully for the last time) problems with datetime values displaying
like '23:59:60' because of fractional-second roundoff problems.  Trying
to control this upstream of the actual display code was hopeless; the right
way is to explicitly round fractional seconds in the display code and then
refigure the results if the fraction rounds up to 1.  Per bug #1927.
2005-10-09 17:21:47 +00:00
Bruce Momjian 4909357237 Remove unnecessary ABORT commands in dblink regression tests. 2005-10-08 16:10:38 +00:00
Bruce Momjian 768dfd0375 Cosmetic improvements to dblink. 2005-10-08 12:18:48 +00:00
Bruce Momjian f3576c33f8 Cosmetic changes to dblink. 2005-10-08 12:12:29 +00:00
Bruce Momjian 7d937cd408 Cosmetic changes to dblink. 2005-10-08 11:33:45 +00:00
Tom Lane d156e1f850 (Apologies for fat-fingering cvs commit command...) Should have read:
Remove unportable use of tfind/tsearch in favor of bsearch.  Fix up
random number generator to use random() not rand() and to actually honor
its min/max arguments properly.  That wasn't so important before, but
with exposure of capability to ask for general ranges, it will be.
2005-10-07 15:34:17 +00:00
Tom Lane 6ae7671497 gni 2005-10-07 15:31:49 +00:00
Tom Lane dd0fa0f958 Minor dbf2pg fixes from Martin Pitt: check for failure when issuing
CREATE TABLE command, and translate dBase's 'M' field type to 'text'.
2005-10-06 23:05:22 +00:00
Teodor Sigaev 380ab3669f Fix compile error 2005-10-04 17:10:55 +00:00
Tatsuo Ishii 8e48e91bc7 Oops. Partially saved file was committed. 2005-10-04 13:46:52 +00:00
Tatsuo Ishii f50ae06e14 Allow multiple -f options.
Make pgbench "script driven" to eliminate hard coded transaction
scenario. (Tatsuo Ishii)
2005-10-04 13:40:45 +00:00
Teodor Sigaev 8c73dfcc8b Optimize benchmark query and update benchmark's results. 2005-10-03 14:41:42 +00:00
Tom Lane aa731ed843 Change nextval and other sequence functions to specify their sequence
argument as a 'regclass' value instead of a text string.  The frontend
conversion of text string to pg_class OID is now encapsulated as an
implicitly-invocable coercion from text to regclass.  This provides
backwards compatibility to the old behavior when the sequence argument
is explicitly typed as 'text'.  When the argument is just an unadorned
literal string, it will be taken as 'regclass', which means that the
stored representation will be an OID.  This solves longstanding problems
with renaming sequences that are referenced in default expressions, as
well as new-in-8.1 problems with renaming such sequences' schemas or
moving them to another schema.  All per recent discussion.
Along the way, fix some rather serious problems in dbmirror's support
for mirroring sequence operations (int4 vs int8 confusion for instance).
2005-10-02 23:50:16 +00:00
Bruce Momjian c40cd3660f One of the web pages mentioned in dmetaphone.c has moved. Also fix
a few typos in comments.

The dictionaries I checked list "altho" as a variant of "although,"
but I didn't find any other instances of the former in the source
tree so I changed it.

Michael Fuhr
2005-09-30 22:38:44 +00:00
Tom Lane c775b423c1 Fix unportable usages in new pgbench code (strndup, ctype macros) 2005-09-29 16:18:26 +00:00
Tatsuo Ishii 9b19abd74f Add -f option which enables to read SQL commands from a file.
Patches Contributed by Tomoaki Sato.
2005-09-29 13:44:25 +00:00
Tom Lane 1610fcc351 Some marginal tweaks to make 'make installcheck' mostly work when
building contrib with USE_PGXS.  To make it work all the way, the
pg_regress script would need to be included in the installation tree.
2005-09-27 17:43:31 +00:00
Tom Lane 0b36cb83dc PGXS should be set with := not =, as specified in the documentation,
to avoid useless multiple executions of pg_config.
2005-09-27 17:13:14 +00:00
Tom Lane 0df7f493f8 Clean up possibly-uninitialized-variable warnings reported by gcc 4.x. 2005-09-24 23:07:18 +00:00
Tom Lane 8a65b820e2 Suppress signed-vs-unsigned-char warnings in contrib. 2005-09-24 19:14:05 +00:00
Tom Lane bb6b1a38b6 Document that chkpass ignores password characters after the eighth. 2005-09-23 15:05:04 +00:00
Teodor Sigaev f82b853b47 1 Update Snowball sources
2 Makefile fixes
2005-09-15 11:14:18 +00:00
Tom Lane ce128c01a6 Correct comment about why contrib/xml2 isn't built automatically. 2005-09-01 22:02:44 +00:00
Tom Lane e6a30121be int_array_enum function should be using fcinfo->flinfo->fn_extra for
working state, not fcinfo->context.  Silly oversight on my part in last
go-round of fixes.
2005-08-15 19:05:16 +00:00
Bruce Momjian f547909db7 Remove API file.
Marko Kreen
2005-08-13 15:27:41 +00:00
Bruce Momjian 87688ddf87 The large one adds support for RSA keys and reorganizes
the pubkey functions a bit.  The actual RSA-specific code
there is tiny, most of the patch consists of reorg of the
pubkey code, as lots of it was written as elgamal-only.

---------------------------------------------------------------------------

The SHLIB section was copy-pasted from somewhere and contains
several unnecessary libs.  This cleans it up a bit.

 -lcrypt
   we don't use system crypt()

 -lssl, -lssleay32
   no SSL here

 -lz in win32 section
   already added on previous line

 -ldes
   The chance anybody has it is pretty low.
   And the chance pgcrypto works with it is even lower.

Also trim the win32 section.

---------------------------------------------------------------------------

It is already disabled in Makefile, remove code too.

---------------------------------------------------------------------------

I was bit hasty making the random exponent 'k' a prime.  Further researh
shows that Elgamal encryption has no specific needs in respect to k,
any random number is fine.

It is bit different for signing, there it needs to be 'relatively prime'
to p - 1,  that means GCD(k, p-1) == 1, which is also a lot lighter than
full primality.  As we don't do signing, this can be ignored.

This brings major speedup to Elgamal encryption.

---------------------------------------------------------------------------

o  pgp_mpi_free: Accept NULLs
o  pgp_mpi_cksum: result should be 16bit
o  Remove function name from error messages - to be similar to other
   SQL functions, and it does not match anyway the called function
o  remove couple junk lines

---------------------------------------------------------------------------

o  Support for RSA encryption
o  Big reorg to better separate generic and algorithm-specific code.
o  Regression tests for RSA.

---------------------------------------------------------------------------

o  Tom stuck a CVS id into file.  I doubt the usefulness of it,
   but if it needs to be in the file then rather at the end.
   Also tag it as comment for asciidoc.
o  Mention bytea vs. text difference
o  Couple clarifications

---------------------------------------------------------------------------

There is a choice whether to update it with pgp functions or
remove it.  I decided to remove it, updating is pointless.

I've tried to keep the core of pgcrypto relatively independent
from main PostgreSQL, to make it easy to use externally if needed,
and that is good.  Eg. that made development of PGP functions much
nicer.

But I have no plans to release it as generic library, so keeping such
doc
up-to-date is waste of time.  If anyone is interested in using it in
other products, he can probably bother to read the source too.

Commented source is another thing - I'll try to make another pass
over code to see if there is anything non-obvious that would need
more comments.

---------------------------------------------------------------------------

Marko Kreen
2005-08-13 02:06:21 +00:00
Tom Lane 80f6c35833 Remove contrib version of pg_autovacuum --- superseded by integrated
version.
2005-07-29 19:38:22 +00:00
Bruce Momjian 85e9a5a014 Move reindexdb from /contrib to /bin.
Euler Taveira de Oliveira
2005-07-29 15:13:11 +00:00
Bruce Momjian 46c5b4bf5d Remove dbsize mention. 2005-07-29 15:03:51 +00:00
Bruce Momjian 358a897fa1 Move dbsize functions into the backend. New functions:
pg_tablespace_size
	pg_database_size
	pg_relation_size
	pg_complete_relation_size
	pg_size_pretty

Remove /contrib/dbsize.

Dave Page
2005-07-29 14:47:04 +00:00
Tom Lane ac652466ec Partial fixes for contrib build on AIX: include -lm where needed.
Per Rocco Altier.
2005-07-24 23:30:10 +00:00
Tom Lane 3976899f29 Fix storage size for btree_gist interval indexes. Fix penalty
calculations for interval and time/timetz to behave sanely for both
integer and float timestamps; up to now I think it's been doing
something pretty strange...
2005-07-21 04:15:04 +00:00
Bruce Momjian a45f4c2533 /contrib/btree_gist adjustments for new 'day' interval value. 2005-07-20 18:17:39 +00:00
Tom Lane 24ce1438c0 pgcrypto documentation update. Marko Kreen 2005-07-18 17:17:12 +00:00
Tom Lane 35c675a7fd Fortuna fixes. Marko Kreen 2005-07-18 17:12:54 +00:00
Tom Lane 2787db9b1d Small cleanups for pgcrypto. Marko Kreen 2005-07-18 17:09:01 +00:00
Tom Lane dd4a190d18 Fix C++-style comments, per Rocco Altier. 2005-07-18 16:35:06 +00:00
Neil Conway 75c76e93c7 Mark xml2 CREATE FUNCTIONs as IMMUTABLE, and use the "STRICT" syntax
rather than the deprecated "WITH (isStrict)" syntax. Patch from Ilia
Kantor, minor editorializing by Neil Conway.
2005-07-14 07:12:27 +00:00
Tom Lane 807bbe6051 More pgcrypto fixes: handle long messages correctly, suppress
compiler warnings.  Marko Kreen and Kris Jurka.
2005-07-12 20:27:45 +00:00
Tom Lane a1a64bb7c3 Further tweaking of Win32-specific random code. Marko Kreen 2005-07-11 19:06:46 +00:00
Tom Lane e82f7e9e7e I forgot to update win32 code when doing a renaming in random.c.
Marko Kreen
2005-07-11 17:00:03 +00:00
Tom Lane 067a5cdb35 Avoid bzero/bxopy in favor of more standard library routines.
Marko Kreen
2005-07-11 15:40:38 +00:00
Tom Lane e997758cb6 More pgcrypto fixes: avoid bogus alignment assumptions in sha2,
be more wary about having a value for BYTE_ORDER, clean up randomly-
chosen ways of including Postgres core headers.
Marko Kreen and Tom Lane
2005-07-11 15:07:59 +00:00
Tom Lane 3c52d17fa6 Add support for AES cipher with older OpenSSL libraries.
Marko Kreen
2005-07-11 14:38:05 +00:00
Bruce Momjian 2e330699fa > One more failure:
>
> I think this is because we don't have -lz in SHLIB_LINK.
> Following patch fixes it.

Marko Kreen
2005-07-10 18:32:55 +00:00
Bruce Momjian 21634e513f Add extra argument for new pg_regexec API. 2005-07-10 18:31:59 +00:00
Tom Lane aacfeba61b Suppress compile warning. 2005-07-10 17:22:54 +00:00
Bruce Momjian 6e1004f0fd Remove #include <openssl/bn.h> as compile fix.
Marko Kreen
2005-07-10 15:37:03 +00:00
Bruce Momjian d51df91897 As Kris Jurka found out, pgcrypto does not work with
OpenSSL 0.9.6x.  The DES functions use the older 'des_'
API, but the newer 3DES functions use the 0.9.7x-only
'DES_' API.

I think I just used /usr/include/openssl/des.h for reference
when implementing them, and had upgraded OpenSSL in the
meantime.

Following patch converts DES also to newer API and provides
compatibility functions for OpenSSL < 0.9.7.

I chose this route because:

- openssl.c uses few DES functions.
- compatibility for old 'des_' API is going away at some point
  of time from OpenSSL.
- as seen from macros, new API is saner
- Thus pgcrypto supports any OpenSSL version from 0.9.5 to 1.0

Tested with OpenSSL 0.9.6c and 0.9.7e.

Marko Kreen
2005-07-10 13:54:34 +00:00
Bruce Momjian e94dd6ab91 Add missing pgcrypto files from previous commit. 2005-07-10 13:46:29 +00:00
Bruce Momjian 73e2431817 Major pgcrypto changes:
of password-based encryption from RFC2440 (OpenPGP).

The goal of this code is to be more featureful encryption solution
than current encrypt(), which only functionality is running cipher
over data.

Compared to encrypt(), pgp_encrypt() does following:

* It uses the equvialent of random Inital Vector to get cipher
  into random state before it processes user data
* Stores SHA-1 of the data into result so any modification
  will be detected.
* Remembers if data was text or binary - thus it can decrypt
  to/from text data.  This was a major nuisance for encrypt().
* Stores info about used algorithms with result, so user needs
  not remember them - more user friendly!
* Uses String2Key algorithms (similar to crypt()) with random salt
  to generate full-length binary key to be used for encrypting.
* Uses standard format for data - you can feed it to GnuPG, if needed.

Optional features (off by default):

* Can use separate session key - user data will be encrypted
  with totally random key, which will be encrypted with S2K
  generated key and attached to result.
* Data compression with zlib.
* Can convert between CRLF<->LF line-endings - to get fully
  RFC2440-compliant behaviour.  This is off by default as
  pgcrypto does not know the line-endings of user data.

Interface is simple:


    pgp_encrypt(data text, key text) returns bytea
    pgp_decrypt(data text, key text) returns text
    pgp_encrypt_bytea(data bytea, key text) returns bytea
    pgp_decrypt_bytea(data bytea, key text) returns bytea

To change parameters (cipher, compression, mdc):

    pgp_encrypt(data text, key text, parms text) returns bytea
    pgp_decrypt(data text, key text, parms text) returns text
    pgp_encrypt_bytea(data bytea, key text, parms text) returns bytea
    pgp_decrypt_bytea(data bytea, key text, parms text) returns bytea

Parameter names I lifted from gpg:

   pgp_encrypt('message', 'key', 'compress-algo=1,cipher-algo=aes256')

For text data, pgp_encrypt simply encrypts the PostgreSQL internal data.

This maps to RFC2440 data type 't' - 'extenally specified encoding'.
But this may cause problems if data is dumped and reloaded into database
which as different internal encoding.  My next goal is to implement data
type 'u' - which means data is in UTF-8 encoding by converting internal
encoding to UTF-8 and back.  And there wont be any compatibility
problems with current code, I think its ok to submit this without UTF-8
encoding by converting internal encoding to UTF-8 and back.  And there
wont be any compatibility problems with current code, I think its ok to
submit this without UTF-8 support.


Here is v4 of PGP encrypt.  This depends on previously sent
Fortuna-patch, as it uses the px_add_entropy function.

- New function: pgp_key_id() for finding key id's.
- Add SHA1 of user data and key into RNG pools.  We need to get
  randomness from somewhere, and it is in user best interests
  to contribute.
- Regenerate pgp-armor test for SQL_ASCII database.
- Cleanup the key handling so that the pubkey support is less
  hackish.

Marko Kreen
2005-07-10 03:57:55 +00:00
Bruce Momjian 4fcf8b11ff - Add Fortuna PRNG to pgcrypto.
- Move openssl random provider to openssl.c and builtin provider
  to internal.c
- Make px_random_bytes use Fortuna, instead of giving error.
- Retarget random.c to aquiring system randomness, for initial seeding
  of Fortuna.  There is ATM 2 functions for Windows,
  reader from /dev/urandom and the regular time()/getpid() silliness.

Marko Kreen
2005-07-10 03:55:28 +00:00
Bruce Momjian 248eeb82f0 This patch adds implementation of SHA2 to pgcrypto.
New hashes: SHA256, SHA384, SHA512.

Marko Kreen
2005-07-10 03:52:56 +00:00
Tom Lane be3aa30da3 Fix inadequate error checking: you can't assume that fcinfo->resultinfo
is a ReturnSetInfo unless you've tested it with IsA.
2005-07-09 01:53:22 +00:00
Neil Conway 86897f54a8 This patch updates the DDL for contrib/pgcrypto to create all
functions as STRICT, and all functions except gen_salt() as IMMUTABLE.
gen_salt() is VOLATILE.

Although the functions are now STRICT, I left their PG_ARGISNULL()
checks in place as a protective measure for users who install the
new code but use old (non-STRICT) catalog entries (e.g., restored
from a dump).  Per recent discussion in pgsql-hackers.

Patch from Michael Fuhr.
2005-07-08 04:27:49 +00:00
Tom Lane 3d6b0d8631 Fix incorrect PG_CPPFLAGS initialization, per Marko. 2005-07-06 16:14:42 +00:00
Tom Lane 84d630eb24 Dept of second thoughts: don't expose rijndael.tbl: rijndael.c dependency
to make.  We ship the table file in the tarball and so this dependency
just opens file timestamp skew problems without doing anything useful.
(Not that it should hurt, either ... except for cross-compile builds.)
2005-07-05 23:18:44 +00:00
Tom Lane c19aa704c8 Fix contrib/pgcrypto to autoconfigure for OpenSSL when --with-openssl
is used in the toplevel configure.  Per Marko Kreen.
2005-07-05 23:13:57 +00:00
Tom Lane 576ac4b8c9 Fix initialization bug in pgcrypto openssl code. Marko Kreen 2005-07-05 18:15:36 +00:00
Tom Lane eb5949d190 Arrange for the postmaster (and standalone backends, initdb, etc) to
chdir into PGDATA and subsequently use relative paths instead of absolute
paths to access all files under PGDATA.  This seems to give a small
performance improvement, and it should make the system more robust
against naive DBAs doing things like moving a database directory that
has a live postmaster in it.  Per recent discussion.
2005-07-04 04:51:52 +00:00
Bruce Momjian a3ff1aad5d Bruce, please apply this additional patch, that fixes the
auto-detection of AES.

Now openssl.c just checks OpenSSL version.  Whoever compiles
newer OpenSSL without AES is on his own.

Marko Kreen
2005-07-04 02:02:01 +00:00
Bruce Momjian 76eca0ec98 This patch allows contrib/pgcrypto to build with OpenSSL 0.9.8
(currently in beta) when cryptolib = openssl.  According to the
following checkin message from several years ago, OpenSSL application
developers should no longer rely on <openssl/evp.h> to include
everything they need:

http://cvs.openssl.org/chngview?cn=9888

This patch adds the necessary header files.  It doesn't appear to
break anything when building against OpenSSL 0.9.7.

BTW, core appears to build and work fine with OpenSSL 0.9.8.  I've
built 7.3 through HEAD against 0.9.8-beta6 without noticing any
problems.

Michael Fuhr
2005-07-03 02:32:56 +00:00
Tom Lane e6a8eba3f2 Remove contrib version of rtree_gist --- now in core system. 2005-07-01 19:23:07 +00:00
Teodor Sigaev ef770cbb69 Fixes from Janko Richter <jankorichter@yahoo.de>
- Fix wrong index results on text, char, varchar for multibyte strings
- Fix some SIGFPE signals
- Add support for infinite timestamps
- Because of locale settings, btree_gist can not be a prefix index anymore (for text).
  Each node holds now just the lower and upper boundary.
2005-07-01 13:44:56 +00:00
Tom Lane b5f7cff84f Clean up the rather historically encumbered interface to now() and
current time: provide a GetCurrentTimestamp() function that returns
current time in the form of a TimestampTz, instead of separate time_t
and microseconds fields.  This is what all the callers really want
anyway, and it eliminates low-level dependencies on AbsoluteTime,
which is a deprecated datatype that will have to disappear eventually.
2005-06-29 22:51:57 +00:00
Tom Lane dcf2e1c8c7 Remove the << >> &< and &> operators for contrib/cube, which were
wrong, but nobody noticed because they were also useless.
2005-06-27 01:19:43 +00:00
Tom Lane 54c80a3434 Adjust contrib/seg &< and &> operators so that r-tree indexing logic
works properly for 1-D comparisons.  Fix some other errors such as
bogus commutator specifications.
2005-06-27 00:48:07 +00:00
Bruce Momjian bb3cce4ec9 Add E'' syntax so eventually normal strings can treat backslashes
literally.

Add GUC variables:

        "escape_string_warning" - warn about backslashes in non-E strings
        "escape_string_syntax" - supports E'' syntax?
        "standard_compliant_strings" - treats backslashes literally in ''

Update code to use E'' when escapes are used.
2005-06-26 03:04:37 +00:00
Tom Lane b90f8f20f0 Extend r-tree operator classes to handle Y-direction tests equivalent
to the existing X-direction tests.  An rtree class now includes 4 actual
2-D tests, 4 1-D X-direction tests, and 4 1-D Y-direction tests.
This involved adding four new Y-direction test operators for each of
box and polygon; I followed the PostGIS project's lead as to the names
of these operators.
NON BACKWARDS COMPATIBLE CHANGE: the poly_overleft (&<) and poly_overright
(&>) operators now have semantics comparable to box_overleft and box_overright.
This is necessary to make r-tree indexes work correctly on polygons.
Also, I changed circle_left and circle_right to agree with box_left and
box_right --- formerly they allowed the boundaries to touch.  This isn't
actually essential given the lack of any r-tree opclass for circles, but
it seems best to sync all the definitions while we are at it.
2005-06-24 20:53:34 +00:00
Tom Lane 9a09248edd Fix rtree and contrib/rtree_gist search behavior for the 1-D box and
polygon operators (<<, &<, >>, &>).  Per ideas originally put forward
by andrew@supernews and later rediscovered by moi.  This patch just
fixes the existing opclasses, and does not add any new behavior as I
proposed earlier; that can be sorted out later.  In principle this
could be back-patched, since it changes only search behavior and not
system catalog entries nor rtree index contents.  I'm not currently
planning to do that, though, since I think it could use more testing.
2005-06-24 00:18:52 +00:00
Tom Lane 2f5c47e882 Move findoidjoins out of contrib and into src/tools, which is a more
logical place for it since it is of no use to users.  Per recent
discussions on cleaning up contrib.
2005-06-23 02:33:28 +00:00
Tom Lane 5b0c9d3603 Cleanup the contrib/lo module: there is no need anymore to implement
a physically separate type.  Defining 'lo' as a domain over OID works
just fine and is more efficient.  Improve documentation and fix up the
test script.  (Would like to turn test script into a proper regression
test, but right now its output is not constant because of numeric OIDs;
plus it makes Unix-specific assumptions about files it can import.)
2005-06-23 00:06:37 +00:00
Tom Lane d20763dbee Remove contrib modules that have been agreed to be obsolete.
(There are more that will be removed once they've been copied to
pgfoundry.org.)
2005-06-22 22:56:29 +00:00
Tom Lane 6f7fc0bade Cause initdb to create a third standard database "postgres", which
unlike template0 and template1 does not have any special status in
terms of backend functionality.  However, all external utilities such
as createuser and createdb now connect to "postgres" instead of
template1, and the documentation is changed to encourage people to use
"postgres" instead of template1 as a play area.  This should fix some
longstanding gotchas involving unexpected propagation of database
objects by createdb (when you used template1 without understanding
the implications), as well as ameliorating the problem that CREATE
DATABASE is unhappy if anyone else is connected to template1.
Patch by Dave Page, minor editing by Tom Lane.  All per recent
pghackers discussions.
2005-06-21 04:02:34 +00:00
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
Teodor Sigaev e1662cb6b8 Simplify/clean up code for varlena types 2005-03-01 15:40:04 +00:00
Bruce Momjian 4f51368bad Add routines to dbsize to return the index size and total relation size.
Improve documentation.

Ed L.
2005-02-26 23:31:15 +00:00
Teodor Sigaev ea90a93a46 Fix float8->int64 transformation 2005-02-25 14:03:04 +00:00
Teodor Sigaev 4784fe9ea2 Simplify defines 2005-02-21 14:09:49 +00:00
Teodor Sigaev 47979e671c Fix memory leak for timestamp(with and w/o tz) and indexes 2005-02-21 10:03:57 +00:00
Tom Lane b7d236d663 Make sure contrib C functions are marked strict where needed.
Kris Jurka
2005-01-29 22:35:02 +00:00
Tom Lane 728775d781 Now that I look at it, int_array_enum() didn't work either. 2005-01-27 21:49:57 +00:00
Tom Lane 368964e153 Fix security and 64-bit issues in contrib/intagg. This code could
stand to be rewritten altogether, but for now just stick a finger in
the dike.
2005-01-27 21:35:40 +00:00
Teodor Sigaev 5e95311442 Add intset() to README 2005-01-27 14:14:01 +00:00
Tom Lane b0e3dd7e61 Adjust Windows autovacuum service to retry for up to 5 minutes waiting
for the postmaster to start.  Dave Page
2005-01-26 22:25:13 +00:00
Tom Lane c0e0d3e2e9 Avoid unnecessary dependence on u_int16_t, per buildfarm failure.
(It doesn't compile on HPUX either...)
2005-01-26 18:49:39 +00:00
Neil Conway 1ac9f0e9f7 The attached patch implements the soundex difference function which
compares two strings' soundex values for similarity, from Kris Jurka.
Also mark the text_soundex() function as STRICT, to avoid crashing
on NULL input.
2005-01-26 08:04:04 +00:00
Teodor Sigaev 324300bc7c improve support of agglutinative languages (query with compound words).
regression=# select to_tsquery( '\'fotballklubber\'');
                   to_tsquery
------------------------------------------------
 'fotball' & 'klubb' | 'fot' & 'ball' & 'klubb'
(1 row)

So, changed interface to dictionaries, lexize method of dictionary shoud return
pointer to aray of TSLexeme structs instead of char**. Last element should
have TSLexeme->lexeme == NULL.

typedef struct {
        /* number of variant of split word , for example
                Word 'fotballklubber' (norwegian) has two varian to split:
                ( fotball, klubb ) and ( fot, ball, klubb ). So, dictionary
                should return:
                nvariant        lexeme
                1               fotball
                1               klubb
                2               fot
                2               ball
                2               klubb

        */
        uint16  nvariant;

        /* currently unused */
        uint16  flags;

        /* C-string */
        char    *lexeme;
} TSLexeme;
2005-01-25 15:24:38 +00:00
Teodor Sigaev fe30edbab8 Change
typedef struct {} WordEntryPos;
to
typedef uint16 WordEntryPos
according to http://www.pgsql.ru/db/mw/msg.html?mid=2035188

Require re-fill all tsvector fields and reindex tsvector indexes.
2005-01-25 12:36:25 +00:00
Neil Conway 810de88d35 Fix typo. 2005-01-24 00:17:33 +00:00
Neil Conway e02e0564f1 pg_autovacuum fixes from Dave Page:
- Dependency services may not be correctly registered when installing as
a Windows Service.

- The sleep time is changed from milliseconds to seconds as it should
be.

- Error messages during service installation/removal are logged to
stderr.
2005-01-24 00:13:38 +00:00
Bruce Momjian 2d16f7c458 Update version restriction on xml2. 2005-01-22 22:14:14 +00:00
Bruce Momjian 082283b9b9 Fix README /contrib/xml2 reference in 8.0 and HEAD. 2005-01-22 21:21:34 +00:00
Teodor Sigaev 5b354d2c7e Fixes:
1 Report error message instead of do nothing in case of error in regex
2 Malloced storage for mask, find and repl part of Affix. This parts may be
  large enough in real life (for example in czech, thanks to moje <moje@kalhotky.net>)
2005-01-11 16:07:55 +00:00
Tom Lane 0549de06ba Fix segfault when xpath_list function is applied to an invalid document.
John Gray
2005-01-09 17:40:40 +00:00
Tom Lane 8afe005f42 Consistently use geteuid() not getuid(); there were a few places deviating
from our long-established standard.
2005-01-08 22:51:15 +00:00
Tom Lane 7e1c8ef4fc Some more missed copyright notices. Many of these look like they
should have been caught by the src/tools/copyright script ... why
weren't they?
2005-01-01 20:44:34 +00:00
Bruce Momjian 2daed8c5b3 Update copyrights that were missed. 2005-01-01 05:43:09 +00:00
PostgreSQL Daemon 2ff501590b Tag appropriate files for rc3
Also performed an initial run through of upgrading our Copyright date to
extend to 2005 ... first run here was very simple ... change everything
where: grep 1996-2004 && the word 'Copyright' ... scanned through the
generated list with 'less' first, and after, to make sure that I only
picked up the right entries ...
2004-12-31 22:04:05 +00:00
Tom Lane 1ade4b33f6 Triggers should return TRIGGER not OPAQUE. Looks like this script got
overlooked in 7.3 updates.  Not a critical fix but avoids a notice when
the resulting SQL script is executed.
2004-12-30 00:30:40 +00:00
Tom Lane f6a1a8e254 In 'make installcheck' for contrib/, insert 'sleep 1' between subdirectory
checks, to ensure the previous test backend has time to quit out of the
regression database.  Also, allow all the checks to be run even if one
of them fails.  Per suggestions from Andrew Dunstan to improve the
usefulness of buildfarm testing.
2004-12-14 22:50:23 +00:00
Bruce Momjian 9269699b9d > > 8.0beta3 has pg_autovacuum included, when I want to run this as a
> > Windows service, it says you can use the -I and -R options.
> >
> > When I do that and I specify a password with '-P'
> (uppercase) then in
> > the registry it's saved as '-p' (lowercase) in the
> service-commandline
> > (ImagePath).

This was fixed in v1.21 of pg_autovacuum.c, That rev is tagged for
beta3, so you should not be seeing this issue unless you actually have
an older version for some reason.

http://developer.postgresql.org/cvsweb.cgi/pgsql/contrib/pg_autovacuum/p
g_autovacuum.c.diff?r1=1.20;r2=1.21;f=h

> > Also it removes the quotes I added and I'm not so sure it
> would work
> > the way it's supposed to, without it.

It's not so much that it strips them (that happens automagically), more
that it doesn't re-add them when it writes the command line in the
registry. The attached patch fixes that by simply quoting all options
that may need it.
> > If you add DependOnService (a REG_MULTI_SZ an
> array-like-thingie) and
> > have the name (in this case: pgsql-8.0-beta2-dev3) of a service it
> > depends on, it will not fail to start (it will not even try, as
> > PostgreSQL is not running), when PostgreSQL already failed.
> >
> > Maybe it's an idea to specify it on the commandline (what
> service to
> > depend on).

A -E <service> option is added in the attached patch.

Dave Page
2004-12-02 22:48:10 +00:00
Bruce Momjian 1646586271 Attached is a patch that adds the function xml_encode_special_chars to
the xml2 contrib module. It's against 8.0beta4. It's intended for
commit.

Markus Bertheau <twanger@bluetwanger.de>
2004-12-02 22:21:12 +00:00
Bruce Momjian e8d46bcd44 Prevent pg_autovacuum -D from needing an argument.
Kenneth Marshall
2004-12-02 20:31:17 +00:00
Neil Conway e02ef267fc Fix a potential free() of string literal in oid2name, per report from
Michael Fuhr. Along the way, fix a bunch of accesses to uninitialized
memory, add a mystrdup() routine and use it to cleanup some code.
2004-12-02 06:14:50 +00:00
Tom Lane db086aa962 Make pg_dumplo schema-aware. Karel Zak 2004-11-28 23:49:49 +00:00
Tom Lane 90c3ebe4d7 Fix HAVE_OPTRESET to be HAVE_INT_OPTRESET. Typos spotted by Lorne Sunley. 2004-11-27 18:51:08 +00:00
Tom Lane b82323e05e This adds mention of my latest tweak to the tsearch2/pg_trgm
integration.  It is much better to create a word list of unstemmed words
than stemmed ones.

Chris K-L
2004-11-27 00:01:02 +00:00
Neil Conway dec2c77c1f Prevent pgcrypto from successfully compiling if no valid random source
has been defined. Previously, pgcrypto would compile but would be
unusable.
2004-11-23 23:44:08 +00:00
Tom Lane c87ddbafe4 Rename vacuum_cost_limit switch from -N to -l to avoid conflict with
existing Windows-only switch.
2004-11-17 21:30:36 +00:00
Tom Lane 5d72ef83fd Miscellaneous Cygwin build fixes from Reini Urban. 2004-11-17 17:46:24 +00:00
Tom Lane c47fc6d050 Add options to pg_autovacuum to support setting the cost-based-vacuum
parameters differently from their default values.  Matthew T. O'Connor
2004-11-17 16:54:15 +00:00
Tom Lane cf956d512d Remove now-redundant description of Postgres file layout, in favor of
referencing the Database File Layout chapter I just added to the main
documentation.
2004-11-12 21:55:01 +00:00
Neil Conway 1b3e769682 This patch makes some cleanups to contrib/ to silence some sparse
warnings:

- remove pointless "extern" keyword from some function definitions in
contrib/tsearch2

- use "NULL" not "0" as NULL pointer in contrib/tsearch,
contrib/tsearch2, contrib/pgbench, and contrib/vacuumlo
2004-11-09 06:09:40 +00:00
Tom Lane 98e8b48053 Create 'default_tablespace' GUC variable that supplies a TABLESPACE
clause implicitly whenever one is not given explicitly.  Remove concept
of a schema having an associated tablespace, and simplify the rules for
selecting a default tablespace for a table or index.  It's now just
(a) explicit TABLESPACE clause; (b) default_tablespace if that's not an
empty string; (c) database's default.  This will allow pg_dump to use
SET commands instead of tablespace clauses to determine object locations
(but I didn't actually make it do so).  All per recent discussions.
2004-11-05 19:17:13 +00:00
Neil Conway c874e7727a Fix build break, per report from Kris Jurka. Rename README to README.mysql,
for consistency.
2004-11-04 09:12:35 +00:00
Neil Conway 8f012ac89b Contrib build fixes:
- add some additional files to the dbmirror install (approved by
ssinger)

- add a makefile for contrib/mysql, and add mysql to the list of
contribs build by default

- use xml2-config to pickup -I flags for libxml2 in contrib/xml and
contrib/xml2

Original work from Martin Pitt of Debian, minor cleanups by Neil
Conway.
2004-11-04 06:09:26 +00:00
Bruce Momjian c21214f1c0 Honor TMPDIR.
Add the script name to the tmp directory name.

Move trap up now that the dir is more unique.
2004-11-04 02:04:10 +00:00
Bruce Momjian ed9e8f5480 Move trap to after the directory is created. 2004-11-03 23:06:52 +00:00
Bruce Momjian 0f7a2a5fbe Create temporary files securely. 2004-11-03 22:46:15 +00:00
Neil Conway feac3364ed Trivial fixes for English grammar in contrib/btree_gist and contrib/rtree_gist
documentation.
2004-11-01 11:11:13 +00:00
Tom Lane fe2bfa6332 This makes dblink pass its installcheck test on platforms where
snprintf(data, len, %s, NULL) crash.

The code was trying to find a connection by name when it already had an
unnamed connection and did not have a name to search with.

Kris Jurka
2004-10-28 22:31:11 +00:00
Tom Lane 0636d55843 Fix some more 'old-style parameter declaration' warnings. 2004-10-25 02:30:29 +00:00