Commit Graph

885 Commits

Author SHA1 Message Date
Teodor Sigaev 239760209b Correct type for isalnum 2004-01-19 18:39:45 +00:00
Tom Lane 5390e284db Remove broken (and unnecessary) definition of operator <> for _int4
datatype; the generic array comparators added in 7.4 supersede this.
Per report and patch from Korea PostgreSQL Users' Group.
2004-01-08 23:40:27 +00:00
Tom Lane 2cdace962b Remove incorrect remark about having to restart backend to load a new
version of a shared library.
2003-12-27 18:20:18 +00:00
Teodor Sigaev 125d69cd9b Fix signed char in comparison and check memory allocation 2003-12-18 19:27:53 +00:00
Tom Lane a7e383d241 Repair badly broken estimation of output buffer size in lquery_out(). 2003-12-17 20:15:41 +00:00
Teodor Sigaev 565dc5d1ae Fix integer types to use definition from c.h. Per bug report by Patrick Boulay <patrick.boulay@medrium.com> 2003-12-10 15:54:58 +00:00
Tom Lane ee719299e4 Minor autovacuum fixes from Matthew O'Connor. 2003-12-08 21:54:00 +00:00
Tom Lane 1b5a2dbdff Add fflush() before sleeping, per Matthew O'Connor. 2003-12-08 21:51:31 +00:00
Tom Lane 9c26980f58 Replace unportable and overflow-prone use of 'long long' with safer
'double' arithmetic, per recent discussion.
2003-12-07 19:55:58 +00:00
Teodor Sigaev a5a68766e1 One more fix confusion 2003-12-05 15:37:51 +00:00
Teodor Sigaev 8f678600c2 Avoid confusion start_parse_str function with tsearch V1 2003-12-05 14:27:42 +00:00
Teodor Sigaev 6de3fe3c0d Avoid conflict strndup with glibc 2003-12-04 12:21:11 +00:00
Teodor Sigaev 32580efafb Fix for word with several infinitives 2003-12-03 16:07:48 +00:00
Bruce Momjian ea4b9f14f3 I've run across a pretty serious problem with pg_autovacuum.
pg_autovacuum looses track of any table that's ever been truncated
(possibly other situations too).   When i truncate a table it gets a
new relfilenode in pg_class.  This is a problem because pg_autovacuum
assumes pg_class.relfilenode will join to pg_stats_all_tables.relid.
pg_stats_all_tables.relid is actallly the oid from pg_class, not the
relfilenode.   These two values start out equal so pg_autovacuum works
initially, but it fails later on because of this incorrect assumption.

This patch fixes that problem.  Applied to HEAD and 7.4.X.

Brian Hirt
2003-12-01 23:19:33 +00:00
Bruce Momjian 15b5d6cfc6 I noticed in the 7.4 release that in contrib/pg_autovacuum, args->logfile is
not initialized if a log file is not specified on the command line.  This
causes an immediate segfault on systems that fill allocated memory with some
value other than zero (my FreeBSD machine uses 0xD0).

Several crashes later I discovered that args->user, password, host, and port
are also used without being initialized.

This doesn't appear to be fixed in CVS and I came up empty on a mailing list
search -- hope it hasn't been reported already.

Craig Boston
2003-12-01 23:13:07 +00:00
PostgreSQL Daemon 55b113257c make sure the $Id tags are converted to $PostgreSQL as well ... 2003-11-29 22:41:33 +00:00
PostgreSQL Daemon 969685ad44 $Header: -> $PostgreSQL Changes ... 2003-11-29 19:52:15 +00:00
Teodor Sigaev cabdf460d3 Fix free instead of pfree 2003-11-28 12:09:02 +00:00
Joe Conway d1824a5ccb Fix regression in dblink_disconnect() reported by Eduardo Stern:
persistent_conn was left dangling after a disconnect in the
unnamed connection case, causing a subsequent disconnect to
crash the backend.
2003-11-28 05:03:02 +00:00
Teodor Sigaev baeab89de6 Fixes about word with several infiniteve 2003-11-27 16:04:40 +00:00
Joe Conway 5392e73b6c Added missing SPI_finish() calls to get_tuple_of_interest(). Fixes bug
reported by Andrea Grassi.
2003-11-26 20:43:25 +00:00
Teodor Sigaev f5e8bfb4b1 Utility for convert myspell dictionaries to ispell, full README will be later 2003-11-26 14:06:16 +00:00
Tatsuo Ishii 43f77c06bb Patches from Yutaka Tanida. Create primary key indexes after data
insertion to reduce initialization time.
2003-11-26 06:53:18 +00:00
Teodor Sigaev 4ca765f9aa Ignore too long lexeme 2003-11-25 13:33:15 +00:00
Teodor Sigaev c63c1946a2 Optimize. Improve ispell support for compound words. This work was sponsored by ABC Startsiden AS. 2003-11-17 17:34:35 +00:00
Tom Lane fa5c8a055a Cross-data-type comparisons are now indexable by btrees, pursuant to my
pghackers proposal of 8-Nov.  All the existing cross-type comparison
operators (int2/int4/int8 and float4/float8) have appropriate support.
The original proposal of storing the right-hand-side datatype as part of
the primary key for pg_amop and pg_amproc got modified a bit in the event;
it is easier to store zero as the 'default' case and only store a nonzero
when the operator is actually cross-type.  Along the way, remove the
long-since-defunct bigbox_ops operator class.
2003-11-12 21:15:59 +00:00
Bruce Momjian f719f0f6db Typo fix in comment from David Wheeler 2003-11-12 03:27:26 +00:00
Tom Lane c1d62bfd00 Add operator strategy and comparison-value datatype fields to ScanKey.
Remove the 'strategy map' code, which was a large amount of mechanism
that no longer had any use except reverse-mapping from procedure OID to
strategy number.  Passing the strategy number to the index AM in the
first place is simpler and faster.
This is a preliminary step in planned support for cross-datatype index
operations.  I'm committing it now since the ScanKeyEntryInitialize()
API change touches quite a lot of files, and I want to commit those
changes before the tree drifts under me.
2003-11-09 21:30:38 +00:00
Bruce Momjian 6479ee28c0 Fix typo on autovacuum readme. 2003-11-09 03:15:46 +00:00
Bruce Momjian e781a1a95d Here is an update to the dbmirror README file.
-References to older versions of PostgreSQL have been removed(It no
longer
compiles against older versions)
-Added a link to PgPerl at GBorg.

Steven Singer
2003-10-27 02:52:45 +00:00
Tom Lane 5319ba3803 Update README file to show 7.4 oidjoins relationships. The regression
test was updated previously, but documentation is lagging.
2003-10-19 22:15:32 +00:00
Bruce Momjian 62fdc3dd60 I have run pg_autovacuum on AIX, so that can, at least loosely, be
considered "tested."

And I have turned all of the 7.4 HISTORY material into DocBook for
release.sgml

Christopher Browne
2003-10-16 03:47:28 +00:00
Bruce Momjian 18e5addb96 Fix core dump on root starting pg_autovacuum.
Change conditionals to be more constent with our code

if (const == var) => if (var == const).
2003-10-10 19:26:25 +00:00
Bruce Momjian 1dad866bb4 Someone report me small bug in contrib/pg_dumplo today. It's problem
with a little dirty snprintf() usage which I used some years ago:

    snprintf(path, BUFSIZ, "%s/lo_dump.index", path);

Karel Zak
2003-10-09 13:38:05 +00:00
Bruce Momjian 7ceadb8fab Change some awkward wording in the pg_autovacuum README file. I really
only read this because of Niel :-)

Robert Treat
2003-10-08 18:18:04 +00:00
Tom Lane 08c33c426b Attached is a patch for contrib/tablefunc. It fixes two issues raised by
Lars Boegild Thomsen (full email below) and also corrects the regression
expected output for a recent backend message adjustment. Please apply.

Joe Conway
2003-10-02 03:51:40 +00:00
Bruce Momjian 6000e32805 I've not changed any malloc/calloc to palloc. It looks to me that these memory
areas are for the lifetime of the backend and in the interests of not breaking
something that's not broken I left alone.

Note for anyone reading this and wanting it for tsearch-v2-stable (i.e. for 7.3
backend) this patch probably will not apply cleanly to that source. It should
be simple enough to see what's going on and apply the changes by hand if need
be.


--
Nigel J. Andrews
2003-09-29 18:54:38 +00:00
Bruce Momjian 04e401f97f A) Fixes a bug that prevented mirroring of data on a table that has had
a column dropped.

B) Updated the documentation for the 7.4 release.

Steven Singer
2003-09-29 18:16:48 +00:00
Bruce Momjian 44f8c5c10a Make dbf2pg safe for non-ASCII character sets.
M?rcio Dick Smiderle
2003-09-27 22:24:49 +00:00
Jan Wieck e9ff025345 Fixed calculation of bid when generating accounts. Used to create
accounts.bid values of zero.

Jan
2003-09-27 19:15:34 +00:00
Tom Lane 03858c078b Add positive defense against dropped columns, per suggestion from
Christopher Kings-Lynne.  Also fix a couple more schema-awareness issues.
2003-09-24 05:38:38 +00:00
Teodor Sigaev 0b1ee9b5a3 fix hlfinditem function. Thanks to "Stphane Bidoul" <stephane.bidoul@softwareag.com>.
The 'word' variable there is initialised from
the prs->words array, but immediately after,
that array may be reallocated, thus leaving
word pointing to unallocated memory.
2003-09-22 13:32:33 +00:00
Tom Lane 3f43446e36 Persuade tsearch/tsearch2 to work (or at least pass their regression
tests) when using flex 2.5.31.  The fix is to *not* try to use palloc
and pfree for allocations within the lexer; when you do that, the
yy_buffer_stack gets freed at inopportune times.  The code is already
set up to do manual deallocation, so I see no particular advantage to
using palloc anyway.
2003-09-14 18:44:23 +00:00
Tom Lane 0e9b05bde9 expected results for dblink test seem to be out of date ... 2003-09-14 02:30:07 +00:00
Tom Lane 043be9ad96 Make contrib/seg work with flex 2.5.31. Fix it up to have a real
btree operator class, too, since in PG 7.4 you can't GROUP without one.
2003-09-14 02:18:49 +00:00
Tom Lane 03e47392e0 Make contrib/cube work with flex 2.5.31. Fix it up to have a real
btree operator class, too, since in PG 7.4 you can't GROUP without one.
2003-09-14 01:52:25 +00:00
Tom Lane c472b8366f With Joe Conway's concurrence, remove srandom() call from normal_rand().
This was the last piece of code that took it upon itself to reset the
random number sequence --- now we only have srandom() in postmaster start,
backend start, and explicit setseed() operations.
2003-09-13 21:44:50 +00:00
Tom Lane f51759064c Minor wording improvements. 2003-09-13 17:33:46 +00:00
Bruce Momjian 2056f8a7da pgindent C file, per patch request. 2003-09-13 16:27:38 +00:00
Bruce Momjian 3bf080daaf > OK, well as we wait on the fix for the stats system, let me submit my
> patch for pg_autovacuum.  This patch assumes that the stats system will
> be fixed so that all inserts, updates and deletes performed on shared
> tables reguardless of what database those commands were executed from,
> will show up in the stats shown in each database.

I had to make a further change to this to take quotes off the 'last
ANALYZE' in order for it to not overquote the relation name, so
there's a _little_ work left to get it to play well.

I have deployed it onto several boxes that should be doing some
vacuuming over the weekend, and it is now certainly hitting pg_
tables.

I would like to present a CVS-oriented patch; unfortunately, I had to
change the indentation patterns when editing some of it :-(.  The
following _may_ be good; not sure...

Matthew T. O'Connor
Christopher Browne
2003-09-13 16:26:18 +00:00
Tom Lane 17d15ddf75 Fix incorrect pfree in to_tsquery_name(), per Nigel Andrews. 2003-09-12 16:34:28 +00:00
Bruce Momjian 3d48045ae1 > It quotes table names for vacuum and analyze, and uppercases the
> keywords for clarity.

Yeah, this is basically what I meant, sorry I didn't get to it quicker.

However, I tested it out a little and the patch you made doesn't work
because it produces commands like:

VACUUM ANALYZE "public.FooBar"

Which doesn't work, so I made my own patch that creates commands like:

VACUUM ANALYZE "public"."FooBar"

This allows for mixed case schema names as well as tables.

Adam, can you please give this a test as you are the person who caught
the bug in the first place.

Thanks,

Matthew T. O'Connor
2003-09-11 19:01:18 +00:00
Bruce Momjian a5e9e51fb0 on my timetravel.c I find a bug: after the
ALTER TABLE mytable drop column last_column_of_table;

the timetravel trigger say on UPDATE/DELETE:

ERROR:  parser: parse error at end of input


Here is the patch for this bug

B?jthe Zolt?n
2003-09-11 17:25:14 +00:00
Bruce Momjian 92e100dd33 Here is a patch that removes contrib/array, leaving only the README with
some examples of the new syntax and a reference to the documentation.

Joe Conway.
2003-09-11 17:15:27 +00:00
Bruce Momjian a72fce035d Add quotes to vacuum/analyze for upper/lowercase table names, per
Matthew T. O'Connor.
2003-09-10 19:57:48 +00:00
Bruce Momjian a9953097f4 Clean up printability test in dbase code. 2003-09-10 00:33:51 +00:00
Tom Lane 2f606ed87d Remove another useless, counterproductive srandom() call. 2003-09-07 15:27:25 +00:00
Teodor Sigaev 61366a9503 More accuracy works with stopwords in queries 2003-08-28 12:23:24 +00:00
Teodor Sigaev 9116f6c91a fix module name in MODULE_PATHNAME substitution 2003-08-26 10:01:02 +00:00
Peter Eisentraut 3d0d78ce2f Bring the makefiles up to our conventions. 2003-08-23 04:25:29 +00:00
Peter Eisentraut 4682776302 Enable uninstalling data files that were installed from a subdirectory of
the source tree.
2003-08-23 04:23:38 +00:00
Teodor Sigaev 38e2bf6283 ISpell info updated 2003-08-21 15:53:21 +00:00
Teodor Sigaev d3fe721a40 Eliminate function start_parse_fh and macro YY_INPUT 2003-08-15 13:44:35 +00:00
Teodor Sigaev 364ef51484 Correct error messages 2003-08-13 14:41:59 +00:00
Teodor Sigaev bcec1e617a More accuracy work with MinWords option of headline function 2003-08-13 14:37:55 +00:00
Bruce Momjian 46785776c4 Another pgindent run with updated typedefs. 2003-08-08 21:42:59 +00:00
Bruce Momjian 3b2440ebec Remove simple_prompt from /contrib C files, now that it is in /port.
They had the old versions anyway.
2003-08-08 20:20:49 +00:00
Tom Lane 33ab177a56 Don't assume that struct option is available just because we can find a
getopt_long().  This is more or less the same problem as we saw earlier
with getaddrinfo() and struct addrinfo, and for the same reason: random
user-added libraries might contain the subroutine, but there's no
guarantee we will find the matching header files.
2003-08-07 21:11:58 +00:00
Teodor Sigaev 8753157739 OpenFTS vs Tsearch2 comment 2003-08-06 14:53:01 +00:00
Teodor Sigaev d702313f0d Add documentation about ts_debug 2003-08-06 09:41:13 +00:00
Teodor Sigaev dd2870f76f Add ts_debug function for debugging configurations 2003-08-06 09:19:21 +00:00
Tom Lane 2f9c859ea1 Fix some copyright notices that weren't updated. Improve copyright tool
so it won't miss 'em again.
2003-08-04 23:59:41 +00:00
Tom Lane 77489f4523 Update vacuumlo to be properly schema-aware. Improve documentation. 2003-08-04 22:03:39 +00:00
Tom Lane 3b29525a79 Sub-Makefiles need to explicitly add CFLAGS_SL to CFLAGS, else their
object files do not get built with -fpic.
2003-08-04 20:34:26 +00:00
Tom Lane f237a80d8a Fix to build correctly outside source tree. 2003-08-04 19:52:37 +00:00
Teodor Sigaev d6f0f44b55 make sub-Makefiles in the sub-directories 2003-08-04 14:54:47 +00:00
Teodor Sigaev 8405e505c4 Docs fixes 2003-08-04 14:11:08 +00:00
Bruce Momjian f3c3deb7d0 Update copyrights to 2003. 2003-08-04 02:40:20 +00:00
Bruce Momjian 089003fb46 pgindent run. 2003-08-04 00:43:34 +00:00
Tom Lane 2c018f9b10 Fix for Alpha portability. 2003-08-01 03:55:05 +00:00
Tom Lane 6ed071bca5 Update contrib regression tests for recent error message editing. 2003-08-01 02:38:09 +00:00
Tom Lane 1e120a8e5d Add missing #include. 2003-08-01 02:25:31 +00:00
Tom Lane 3896f48d7e Fix some minor portability issues, per Chris K-L. 2003-08-01 02:21:17 +00:00
Bruce Momjian 82bade79dc dbf2pg - Insert xBase-style .dbf-files into a PostgreSQL-table
There is an option "-s oldname=newname", which changes the old field name of
  the dbf-file to the newname in PostgeSQL. If the length of the new name is 0,
  the field is skiped. If you want to skip the first field of the dbf-file,
  you get the wildest error-messages from the backend.
  dbf2pg load the dbf-file via "COPY tablename FROM STDIN". If you skip the
  first field, it is an \t to much in STDIN.

A fix could be an counter j=0, which increments only, if a field is imported
(IF (strlen(fields[h].db_name)> 0) j++. And only if j > 1 (if an other field is
imported) the \t is printed.

An other small bug in the README:
-s start
              Specify  the  first record-number in the xBase-file
              we will insert.
should be
-e start
              Specify  the  first record-number in the xBase-file
              we will insert.

Thomas Behr
2003-07-31 02:12:43 +00:00
Tom Lane 81b5c8a136 A visit from the message-style police ... 2003-07-28 00:09:16 +00:00
Bruce Momjian 606debf268 Updatge to skip composite types. 2003-07-27 20:12:06 +00:00
Bruce Momjian 51e46d14f8 Adjust oid2name to skip certain row types, per Tom. 2003-07-27 19:30:24 +00:00
Tom Lane aec57ea868 elog mop-up. 2003-07-27 18:07:19 +00:00
Tom Lane e8db9b26d0 elog mop-up. 2003-07-27 17:10:07 +00:00
Tom Lane aeea73d4ec Remove unportable // comments. 2003-07-27 16:32:34 +00:00
Bruce Momjian b29c557e0f Cleanup of timetravel compile warnings. 2003-07-27 04:59:29 +00:00
Bruce Momjian 524cfad23f Here is 4 file in tgz:
the new timetravel.c,
new timetravel.README (cut from spi/README and modified),
modified timetravel.sql.in
and modified timetravel.example.

Features:
- optionally 3 parameter for insert/update/delete user name

- work with CREATE UNIQUE INDEX ixxx on table xxx
(unique_field,time_off);
    (the  original version was work with unique index on 6.5.0-6.5.3,
and not work on 7.3.2,7.3.3)
     (before 6.5.0 and between 6.5.3 and 7.3.2 I dont know)

- get_timetravel(tablename) function for check timetravel-status.

- timetravel trigger not change  oid of the active record. (it is not a
good feature, because the  old version is automatice prevent the paralel
update with "where oid=nnn")

B?jthe Zolt?n
2003-07-27 04:51:45 +00:00
Bruce Momjian a265b7f70a > Am Son, 2003-06-22 um 02.09 schrieb Joe Conway:
>>Sounds like all that's needed for your case. But to be complete, in
>>addition to changing tablefunc.c we'd have to:
>>1) come up with a new function call signature that makes sense and does
>>not cause backward compatibility problems for other people
>>2) make needed changes to tablefunc.sql.in
>>3) adjust the README.tablefunc appropriately
>>4) adjust the regression test for new functionality
>>5) be sure we don't break any of the old cases
>>
>>If you want to submit a complete patch, it would be gratefully accepted
>>-- for review at least ;-)
>
> Here's the patch, at least for steps 1-3

Nabil Sayegh
Joe Conway
2003-07-27 03:51:59 +00:00
Bruce Momjian 9df03060e9 Fix for Linux startup script.
Slawomir Sudnik
2003-07-26 20:42:55 +00:00
Tom Lane 658fca8d3a Fix a few portability issues, adjust error messages. 2003-07-24 17:59:56 +00:00
Tom Lane 8fd5b3ed67 Error message editing in contrib (mostly by Joe Conway --- thanks Joe!) 2003-07-24 17:52:50 +00:00
Tom Lane f0c5384d4a Add tsearch2. 2003-07-24 16:54:58 +00:00
Teodor Sigaev 11eb002c5b Remove link of tarball 2003-07-22 14:06:36 +00:00
Teodor Sigaev f5c0ef4dda Mark tsearch v1 as deprecated 2003-07-22 13:21:48 +00:00
Teodor Sigaev 8f146a9077 Fix output to psql:tsearch2.sql:13: NOTICE: ... "pg_ts_dict_pkey" 2003-07-21 15:15:19 +00:00
Teodor Sigaev b88605337e tsearch2 module 2003-07-21 10:27:44 +00:00
Teodor Sigaev 2c914937c1 Fix subpath and subltree. Allow to return '' value.
subpath(ltree,0,0) returns ''.
2003-07-18 13:27:43 +00:00
Tom Lane ede1734cf8 Update contrib/Makefile's list of subdirectories that it does not try
to build.
2003-06-30 20:02:53 +00:00
Tom Lane 142cb7b3f4 Put back inappropriately-removed entry for earthdistance subdirectory. 2003-06-30 19:58:57 +00:00
Bruce Momjian e8902f00cc Group ISBN/ISSN definitions. 2003-06-28 00:36:40 +00:00
Bruce Momjian ec67d2a3fe Back out rserv changes that would allow limit of replicated tables ---
not ready yet.
2003-06-25 21:37:53 +00:00
Tom Lane 91e6f51afb 'third' -> 'fourth' where needed, per Joe Conway. 2003-06-25 18:13:50 +00:00
Bruce Momjian c70e606a4c Includes:
- LIKE <subtable> [ INCLUDING DEFAULTS | EXCLUDING DEFAULTS ]
- Quick cleanup of analyze.c function prototypes.
- New non-reserved keywords (INCLUDING, EXCLUDING, DEFAULTS), SQL 200X

Opted not to extend for check constraints at this time.

As per the definition that it's user defined columns, OIDs are NOT
inherited.

Doc and Source patches attached.

--
Rod Taylor <rbt@rbt.ca>
2003-06-25 03:40:19 +00:00
Bruce Momjian b24a0293cc Attached is a patch that provides *VERY* limited support for multiple
slave
servers.  I haven't tested it very well, so use at your own risk (and I
recommend against using it in production).

Basically, I have a central database server that has 4 summary tables
inside
it replicated to a remote slave (these database tables are for my mail
server
authentication, so these are replicated to another server tuned for many
connections, and so I don't have postgres connections opened straight to
my
back-end database server).

Unfortunately, I also wanted to implement a replication database server
for
hot-backups.  I realized, too late, that the replication process is
pretty
greedy and will try to replicate all tables marked as a
"MasterAddTable".

To make a long story, I made a patch to RServ.pm and Replicate that
allows you
to specify, on the command line, a list of tables that you want to
replicate...it'll ignore all others.

I haven't finished, since this has to be integrated with CleanLog for
instance, but this should (and does) suffice for the moment.

I have yet to test it with two slaves, but at least my mail server
replication
database now works (it was failing every time it tried to replicate, for
a
variety of reasons).

Anyone have any suggestions on how to improve on this?  (or, if someone
more
familiar with this code wants to take the ball and run with it, you're
welcome to).

--
Michael A Nachbaur <mike@nachbaur.com>
2003-06-25 01:17:44 +00:00
Bruce Momjian 51d16423ae - Corrections for tables, columns with uppercase characters
- Don't attempt to convert partial or expressional unique indexes
- Don't attempt to convert unique indexes based on a non-default
opclasses

- Untested prevention of conversion of non-btree indexes unique
indexes.  Untested as postgresql doesn't allow hash, gist, or rtree
based indexes to be unique.

rbt=# create unique index t on a using hash (col);
ERROR:  DefineIndex: access method "hash" does not support UNIQUE
indexes
rbt=# create unique index t on a using gist (col);
ERROR:  DefineIndex: access method "gist" does not support UNIQUE
indexes
rbt=# select version();
                                version
------------------------------------------------------------------------
 PostgreSQL 7.4devel on i386-unknown-freebsd4.8, compiled by GCC 2.95.4

Rod Taylor
2003-06-25 01:11:09 +00:00
Bruce Momjian 8f337e86cd Please apply attached patch to contrib/dblink. It adds named persistent
connections to dblink.

Shridhar Daithanka
2003-06-25 01:10:15 +00:00
Bruce Momjian 7b1f6ffaab Jim C. Nasby wrote:
> Second argument to metaphone is suposed to set the limit on the
> number of characters to return, but it breaks on some phrases:
>
> usps=# select metaphone(a,3),metaphone(a,4),metaphone(a,20) from
> (select 'Hello world'::varchar AS a) a;
> HLW       | HLWR      | HLWRLT
>
> usps=# select metaphone(a,3),metaphone(a,4),metaphone(a,20) from
> (select 'A A COMEAUX MEMORIAL'::varchar AS a) a;
  > AKM       | AKMKS     | AKMKSMMRL
>
> In every case I've found that does this, the 4th and 5th letters are
> always 'KS'.

Nice catch.

There was a bug in the original metaphone algorithm from CPAN. Patch
attached (while I was at it I updated my email address, changed the
copyright to PGDG, and removed an unnecessary palloc). Here's how it
looks now:

regression=# select metaphone(a,4) from (select 'A A COMEAUX
MEMORIAL'::varchar AS a) a;
   metaphone
-----------
   AKMK
(1 row)

regression=# select metaphone(a,5) from (select 'A A COMEAUX
MEMORIAL'::varchar AS a) a;
   metaphone
-----------
   AKMKS
(1 row)

Joe Conway
2003-06-24 22:59:46 +00:00
Tom Lane 3fb6f1347f Replace cryptic 'Unknown kind of return type' messages with something
hopefully a little more useful.
2003-06-15 17:59:10 +00:00
Bruce Momjian a647e30ba3 New patch with corrected README attached.
Also quickly added mention that it may be a qualified schema name.

Rod Taylor
2003-06-12 08:02:57 +00:00
Bruce Momjian 310c084921 Add Linux restart --- Slawomir Sudnik
Add "-l $PGLOG" for restart --- Darko Prenosil
2003-06-12 02:02:24 +00:00
Bruce Momjian 9243664dd4 This patch updates pg_autovacuum in several ways:
* A few bug fixes
* fixes solaris compile and crash issue
* decouple vacuum analyze and analyze thresholds
* detach from tty (dameonize)
* improved logging layout
* more conservative default configuration
* improved, expanded and updated README

please apply and 1st convenience, or before code freeze which ever comes
first :-)

At this point I think I have brought pg_autovacuum and its client side
design as far as I think it should go.  It works, keeping file sizes in
check, helps performance and give the administrator a fair amount
flexibility in configuring it.

Next up is to do the FSM based design that is integrated into the back
end.

p.s. Thanks to Christopher Browne for his help.

Matthew T. O'Connor
2003-06-12 01:36:44 +00:00
Tom Lane 6a276b7bfd Update expected file to match new _int.sql. 2003-06-11 19:43:36 +00:00
Bruce Momjian a237dd2b30 Add missing intarray files. 2003-06-11 19:31:05 +00:00
Bruce Momjian 47d5c3d5e7 Changes:
1 intarray: bugfix for int[]-int[] operation
2 intarray: split _int.c to several files (_int.c now is unused)
3 ntarray (gist__intbig_ops opclass): use special type for index storage
4 ltree (gist__ltree_ops opclass), intarray (gist__intbig_ops): optimize
GiST's
penalty and picksplit interface functions, now use Hemming distance.

Teodor Sigaev
2003-06-11 18:44:15 +00:00
Tom Lane bd48e09f2a Remove platform-specific executable; does not belong in distribution. 2003-06-11 14:02:57 +00:00
Tatsuo Ishii 412893b416 Fix uninitialized memory bug
Add support for PGHOST, PGPORT, PGUSER environment variables
2003-06-10 09:07:15 +00:00
Tom Lane 5666462f2e Ensure that in all flex lexers that are part of the backend, a
yy_fatal_error() call results in elog(ERROR) not exit().  This was
already fixed in the main lexer and plpgsql, but extend same technique
to all the other dot-l files.  Also, on review of the possible calls
to yy_fatal_error(), it seems safe to use elog(ERROR) not elog(FATAL).
2003-05-29 22:30:02 +00:00
Tom Lane fc8d970cbc Replace functional-index facility with expressional indexes. Any column
of an index can now be a computed expression instead of a simple variable.
Restrictions on expressions are the same as for predicates (only immutable
functions, no sub-selects).  This fixes problems recently introduced with
inlining SQL functions, because the inlining transformation is applied to
both expression trees so the planner can still match them up.  Along the
way, improve efficiency of handling index predicates (both predicates and
index expressions are now cached by the relcache) and fix 7.3 oversight
that didn't record dependencies of predicate expressions.
2003-05-28 16:04:02 +00:00
Bruce Momjian 98b6f37e47 Make debug_ GUC varables output DEBUG1 rather than LOG, and mention in
docs that CLIENT/LOG_MIN_MESSAGES now controls debug_* output location.
Doc changes included.
2003-05-27 17:49:47 +00:00
Tom Lane f45df8c014 Cause CHAR(n) to TEXT or VARCHAR conversion to automatically strip trailing
blanks, in hopes of reducing the surprise factor for newbies.  Remove
redundant operators for VARCHAR (it depends wholly on TEXT operations now).
Clean up resolution of ambiguous operators/functions to avoid surprising
choices for domains: domains are treated as equivalent to their base types
and binary-coercibility is no longer considered a preference item when
choosing among multiple operators/functions.  IsBinaryCoercible now correctly
reflects the notion that you need *only* relabel the type to get from type
A to type B: that is, a domain is binary-coercible to its base type, but
not vice versa.  Various marginal cleanup, including merging the essentially
duplicate resolution code in parse_func.c and parse_oper.c.  Improve opr_sanity
regression test to understand about binary compatibility (using pg_cast),
and fix a couple of small errors in the catalogs revealed thereby.
Restructure "special operator" handling to fetch operators via index opclasses
rather than hardwiring assumptions about names (cleans up the pattern_ops
stuff a little).
2003-05-26 00:11:29 +00:00
Tom Lane bf45bff004 Repair quoting sloppiness, lack of schema awareness in reindexdb. 2003-05-19 01:00:12 +00:00
Tom Lane 86f5fcfeb7 Fix failure when uniq-ifying an array of zero elements.
Teodor Sigaev
2003-05-16 18:49:51 +00:00
Tom Lane bcfeca5856 Check calling context for connectby_text(), per Joe Conway. 2003-05-16 06:07:51 +00:00
Tom Lane 78b08584b4 Fix various recent build and regression-test problems in contrib/.
Includes fixes from Joe Conway.
2003-05-14 03:27:22 +00:00
Tom Lane f85f43dfb5 Backend support for autocommit removed, per recent discussions. The
only remnant of this failed experiment is that the server will take
SET AUTOCOMMIT TO ON.  Still TODO: provide some client-side autocommit
logic in libpq.
2003-05-14 03:26:03 +00:00
Tom Lane de28dc9a04 Portal and memory management infrastructure for extended query protocol.
Both plannable queries and utility commands are now always executed
within Portals, which have been revamped so that they can handle the
load (they used to be good only for single SELECT queries).  Restructure
code to push command-completion-tag selection logic out of postgres.c,
so that it won't have to be duplicated between simple and extended queries.
initdb forced due to addition of a field to Query nodes.
2003-05-02 20:54:36 +00:00
Bruce Momjian baf6c8d21d Please, apply patch for contrib/ltree to current CVS and 7.3.2
CHANGES

Mar 28, 2003
    Added finctions index(ltree,ltree,offset), text2ltree(text),
                    ltree2text(text)

Teodor Sigaev
2003-03-31 20:53:45 +00:00
Tom Lane bb3c00ee28 Regression output didn't get updated to match recent commit. 2003-03-28 17:24:28 +00:00
Bruce Momjian 54f7338fa1 This patch implements holdable cursors, following the proposal
(materialization into a tuple store) discussed on pgsql-hackers earlier.
I've updated the documentation and the regression tests.

Notes on the implementation:

- I needed to change the tuple store API slightly -- it assumes that it
won't be used to hold data across transaction boundaries, so the temp
files that it uses for on-disk storage are automatically reclaimed at
end-of-transaction. I added a flag to tuplestore_begin_heap() to control
this behavior. Is changing the tuple store API in this fashion OK?

- in order to store executor results in a tuple store, I added a new
CommandDest. This works well for the most part, with one exception: the
current DestFunction API doesn't provide enough information to allow the
Executor to store results into an arbitrary tuple store (where the
particular tuple store to use is chosen by the call site of
ExecutorRun). To workaround this, I've temporarily hacked up a solution
that works, but is not ideal: since the receiveTuple DestFunction is
passed the portal name, we can use that to lookup the Portal data
structure for the cursor and then use that to get at the tuple store the
Portal is using. This unnecessarily ties the Portal code with the
tupleReceiver code, but it works...

The proper fix for this is probably to change the DestFunction API --
Tom suggested passing the full QueryDesc to the receiveTuple function.
In that case, callers of ExecutorRun could "subclass" QueryDesc to add
any additional fields that their particular CommandDest needed to get
access to. This approach would work, but I'd like to think about it for
a little bit longer before deciding which route to go. In the mean time,
the code works fine, so I don't think a fix is urgent.

- (semi-related) I added a NO SCROLL keyword to DECLARE CURSOR, and
adjusted the behavior of SCROLL in accordance with the discussion on
-hackers.

- (unrelated) Cleaned up some SGML markup in sql.sgml, copy.sgml

Neil Conway
2003-03-27 16:51:29 +00:00
Bruce Momjian cb1672e9f8 Rename README in autovacuum code to match Makefile. 2003-03-23 20:16:06 +00:00
Bruce Momjian e0d043b94d please apply attached patch to current CVS.
btree_gist now supports int2 !
Thanks Janko Richter for contribution.
2003-03-20 18:59:18 +00:00
Bruce Momjian bd18c50ba8 I have updated my pg_autovacuum program (formerly pg_avd, the name
changed as per discussion on the patches list).

This version should be a good bit better.  It addresses all the issues
pointed out by Neil Conway. Vacuum and Analyze are now handled
separately.  It now monitors for xid wraparound.  The number of database
connections and queries has been significantly reduced compared the
previous version.  I have moved it from bin to contrib.  More detail on
the changes are in the TODO file.

I have not tested the xid wraparound code as I have to let my AthlonXP
1600 run select 1 in a tight loop for approx. two days in order to
perform the required 500,000,000 xacts.

Matthew T. O'Connor
2003-03-20 18:14:46 +00:00
Bruce Momjian 64d0b8b05f Attached is an update to contrib/tablefunc. It implements a new hashed
version of crosstab. This fixes a major deficiency in real-world use of
the original version. Easiest to undestand with an illustration:

Data:
-------------------------------------------------------------------
select * from cth;
  id | rowid |        rowdt        |   attribute    |      val
----+-------+---------------------+----------------+---------------
   1 | test1 | 2003-03-01 00:00:00 | temperature    | 42
   2 | test1 | 2003-03-01 00:00:00 | test_result    | PASS
   3 | test1 | 2003-03-01 00:00:00 | volts          | 2.6987
   4 | test2 | 2003-03-02 00:00:00 | temperature    | 53
   5 | test2 | 2003-03-02 00:00:00 | test_result    | FAIL
   6 | test2 | 2003-03-02 00:00:00 | test_startdate | 01 March 2003
   7 | test2 | 2003-03-02 00:00:00 | volts          | 3.1234
(7 rows)

Original crosstab:
-------------------------------------------------------------------
SELECT * FROM crosstab(
   'SELECT rowid, attribute, val FROM cth ORDER BY 1,2',4)
AS c(rowid text, temperature text, test_result text, test_startdate
text, volts text);
  rowid | temperature | test_result | test_startdate | volts
-------+-------------+-------------+----------------+--------
  test1 | 42          | PASS        | 2.6987         |
  test2 | 53          | FAIL        | 01 March 2003  | 3.1234
(2 rows)

Hashed crosstab:
-------------------------------------------------------------------
SELECT * FROM crosstab(
   'SELECT rowid, attribute, val FROM cth ORDER BY 1',
   'SELECT DISTINCT attribute FROM cth ORDER BY 1')
AS c(rowid text, temperature int4, test_result text, test_startdate
timestamp, volts float8);
  rowid | temperature | test_result |   test_startdate    | volts
-------+-------------+-------------+---------------------+--------
  test1 |          42 | PASS        |                     | 2.6987
  test2 |          53 | FAIL        | 2003-03-01 00:00:00 | 3.1234
(2 rows)

Notice that the original crosstab slides data over to the left in the
result tuple when it encounters missing data. In order to work around
this you have to be make your source sql do all sorts of contortions
(cartesian join of distinct rowid with distinct attribute; left join
that back to the real source data). The new version avoids this by
building a hash table using a second distinct attribute query.

The new version also allows for "extra" columns (see the README) and
allows the result columns to be coerced into differing datatypes if they
are suitable (as shown above).

In testing a "real-world" data set (69 distinct rowid's, 27 distinct
categories/attributes, multiple missing data points) I saw about a
5-fold improvement in execution time (from about 2200 ms old, to 440 ms
new).

I left the original version intact because: 1) BC, 2) it is probably
slightly faster if you know that you have no missing attributes.

README and regression test adjustments included. If there are no
objections, please apply.

Joe Conway
2003-03-20 06:46:30 +00:00
Bruce Momjian ee303739d3 Just some fixups to a couple contrib directories I was trying out.
. replace CREATE OR REPLACE AGGREGATE with a separate DROP and CREATE
. add DROP for all CREATE OPERATORs
. use IMMUTABLE and STRICT instead of WITH (isStrict)
. add IMMUTABLE and STRICT to int_array_aggregate's accumulator function

Gregory Stark
2003-03-20 04:39:27 +00:00
Bruce Momjian 900fa3d0f5 The attatched patch fixes a memory error with contrib/dbmirror/pending.c
when running it with older(Pre 7.3.x) versions of Postgresql.

Backpatched to 7.3.X.

Steven Singer
2003-03-20 03:58:13 +00:00
Tom Lane e4704001ea This patch fixes a bunch of spelling mistakes in comments throughout the
PostgreSQL source code.

Neil Conway
2003-03-10 22:28:22 +00:00
Tom Lane aa60eecc37 Revise tuplestore and nodeMaterial so that we don't have to read the
entire contents of the subplan into the tuplestore before we can return
any tuples.  Instead, the tuplestore holds what we've already read, and
we fetch additional rows from the subplan as needed.  Random access to
the previously-read rows works with the tuplestore, and doesn't affect
the state of the partially-read subplan.  This is a step towards fixing
the problems with cursors over complex queries --- we don't want to
stick in Materialize nodes if they'll prevent quick startup for a cursor.
2003-03-09 02:19:13 +00:00
Bruce Momjian 71e1f531d3 Please apply patches for contrib/ltree.
ltree_73.patch.gz - for 7.3 :
        Fix ~ operation bug: eg '1.1.1' ~ '*.1'

ltree_74.patch.gz - for current CVS
    Fix ~ operation bug: eg '1.1.1' ~ '*.1'
    Add ? operation
    Optimize index storage

Last change needs drop/create all ltree indexes, so only for 7.4

Teodor Sigaev
2003-02-19 03:50:09 +00:00
Bruce Momjian 4efbbd7318 We just released new version of contrib/btree_gist
(7.3 and current CVS) with support of int8, float4, float8
in addition to int4. Thanks Janko Richter for contribution.

Oleg Bartunov
2003-02-19 03:46:00 +00:00
Bruce Momjian 9ccaaf676f The attached patches change earthdistance to use the new cube functions
in one of the earth functions so that latitude and longitude to
cartesian coordinates conversion will be more accurrate. (Previously
a text string was built to provide as input which limited the accuracy
to the number of digits printed.)

The new functions were included in a recent patch to contrib/cube that has not
as yet been accepted as of yet.

I also added check constraints to the domain 'earth' since they are now
working in 7.4.

Bruno Wolff III
2003-02-13 05:31:06 +00:00
Bruce Momjian 80b3513d57 The attached patch provides cube with 4 functions for building cubes
directly from float8 values. (As opposed to converting the values to
strings
and then parsing the strings.)
The functions are:
cube(float8) returns cube
cube(float8,float8) returns cube
cube(cube,float8) returns cube
cube(cube,float8,float8) returns cube

Bruno Wolff III
2003-02-13 05:26:50 +00:00
Tom Lane 9d00798720 Tweak bison build rules so that we get the same error messages from
bison 1.875 and later as we did from earlier bison releases.  Eventually
we will probably want to adopt the newer message spelling ... but not yet.
Per recent discussion on pgpatches.
Note: I didn't change the build rules for bootstrap, ecpg, or plpgsql
grammars, since these do not affect regression test results.
2003-01-31 20:58:00 +00:00
Bruce Momjian d14c64c4a3 This patch fixes an incorrect statement and makes a few cleanups to
contrib/fulltextindex/README.fti

Backpatched to 7.3.X too.

Neil Conway
2003-01-15 16:45:17 +00:00
Tom Lane 59779c81ba Add missing #include <getopt.h>. 2003-01-09 18:27:39 +00:00
Tom Lane 2e98da5246 Call timestamp_in with proper arguments, per gripe from Mark Halliwell. 2003-01-09 07:10:07 +00:00