Commit Graph

830 Commits

Author SHA1 Message Date
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
Bruce Momjian 3e40ff58c5 Upgrade to my2pg 1.9 2003-01-07 22:18:43 +00:00
Bruce Momjian a24104eb5e Upgrade to even newer ora2pg 2.0. 2003-01-07 22:17:14 +00:00
Bruce Momjian ffab4fdf24 Upgrade to ora2pg 1.10. Backpatch to 7.3.X. 2003-01-07 22:15:56 +00:00
Tom Lane 30a800a0e9 Update for new we-always-have-getopt_long approach. 2003-01-07 21:42:38 +00:00
Hiroshi Inoue 9ab7ab5196 Add casts between lo and oid. 2002-12-31 10:22:03 +00:00
Bruce Momjian 1868b0be44 Small fix in documentation and some examples of usage. Please, apply to
7.3 and current CVS

Oleg Bartunov
2002-12-27 14:10:29 +00:00
Tom Lane 3a4f7dde16 Phase 3 of read-only-plans project: ExecInitExpr now builds expression
execution state trees, and ExecEvalExpr takes an expression state tree
not an expression plan tree.  The plan tree is now read-only as far as
the executor is concerned.  Next step is to begin actually exploiting
this property.
2002-12-13 19:46:01 +00:00
Bruce Momjian 8358302ded This patch fixes minor bugs in dictionary generator in contrib/tsearch
(contrib/tsearch/makedict/makedict.pl)

[ Backpatched to 7.3.]

Teodor Sigaev
2002-12-13 05:50:18 +00:00
Bruce Momjian bc6625970c Following patch avoids removing oids in the temporary table from the
temporary table.

Kenji Sugita
2002-12-10 01:57:16 +00:00
Bruce Momjian b842726fc7 I've simplified the Darwin/Mac OS X startup script I submitted earlier
in the year. This version has only the two files required by the Darwin
startup bundle design. Plus the sh script now uses Darwin-standard
functions to start up PostgreSQL, and it checks for the presence of a
variable in /etc/hostconfig, as do other Darwin startup scripts.

I suggest that a new directory be created,
contrib/start-scripts/darwin, and that these two files be put into it.
Folks who want to use the script can read the comments inside it to
figure out how to use it.

David Wheeler
2002-12-09 21:26:09 +00:00
Bruce Momjian a2bd3e2085 Thank you very much, you catch it :). This bug had a long life, because it
exists if and only if locale of postmaster
was a different from C (or ru_RU.KOI8-R).

Please, apply patch for current CVS & 7.3.1

Magnus Naeslund(f) wrote:
> Ok, I nailed the bug, but i'm not sure what the correct fix is.
> Attached tsearch_morph.diff that remedies this problem by avoiding it.
> Also there's a debug aid patch if someone would like to know how i
> finally found it out :)
>
> There problem in the lemmatize() function is that GETDICT(...) returned
> a value not handled (BYLOCALE).
> The value (-1) and later used as an index into the dicts[] array.
> After that everything went berserk stack went crazy somehow so trapping
> the fault sent me to the wrong place, and every time i read the value it
> was positive ;)
>
> So now i just return the initial word passed to the lemmatize function,
> because i don't know what to do with it.

Magnus Naeslund
2002-12-06 05:15:02 +00:00
Bruce Momjian 87cba401a4 Some time ago John Gray <jgray@azuli.co.uk> and myself worked out and
tested a patch to contrib/xml where the existing code was causing
postgres to crash when it encountered & entities in the XML. I've
enclosed a patch that John came up with to correct this problem. It
patches against 7.3 and will apply on 7.2x if the elog WARNING calls
are changed to elog NOTICE.

Michael Richards
2002-12-06 03:44:14 +00:00
Bruce Momjian fae2f14cdd It looks like the problem was introduced when the "SET autocommit" and
"SET search_path"  commands were added to the beginning of the script.

The attatched patch should fix the problem. It probably should be
applied  against the 7.3 and 7.4 branches.

Steven Singer
2002-12-05 21:03:51 +00:00
Tom Lane 565dcdf77f Fix off-by-one bug in usage check. 2002-12-03 07:12:18 +00:00
Tom Lane dfebfc1bc8 Fix script name in README. 2002-12-02 00:29:01 +00:00
Tom Lane b168915643 Fix dependency generation for multicolumn foreign keys. From Adam Buraczewski. 2002-12-02 00:28:29 +00:00
Tom Lane fd89de5156 Add note that scaling factor should be >= # of clients. 2002-11-27 19:26:10 +00:00
Bruce Momjian 46f4ed4921 Allocate proper length for sprintf string, from Tatsuo. 2002-11-26 03:08:00 +00:00
Tom Lane 11d337185d Fix inappropriate quoting in dblink. From Joe Conway. 2002-11-23 18:59:25 +00:00
Bruce Momjian c464212421 When I made the cube(text) function for 7.3, I neglected to add a
matching create cast command. The attached diff adds a create cast as
assignment to cube.sql.in .

Bruno Wolff III
2002-11-23 03:50:50 +00:00
Bruce Momjian 4987ca2d88 This is a patch to make cube output work like double precision output
with regard to the extra_float_digits setting.

Since builtins.h was already included, I just deleted the extern
statement (and accompaning comments).

 Bruno Wolff III
2002-11-23 03:50:21 +00:00
Tom Lane 1f1c332381 Remove inappropriate double-quoting in connectby() code; adjust
regression test to avoid using VALUE as a name.  From Joe Conway.
2002-11-23 01:54:09 +00:00
Tom Lane 95c9c22633 Fix a dozen or so places that were passing unpredictable data strings
as elog format strings.  Hai-Chen Tu pointed out the problem in
contrib/dbmirror, but it wasn't the only such error.
2002-11-22 16:25:32 +00:00
Bruce Momjian eeec0a6775 Fix elog in dbmirror to use %s.
Hai-Chen Tu
2002-11-22 16:04:41 +00:00
Bruce Momjian 728fa75edc OpenSSL 0.9.6g in Debian/unstable stopped working with pgcrypto. This
is pgcrypto bug as it assumed too much about inner workings of OpenSSL.

Following patch stops pgcrypto using EVP* functions for ciphers and lets
it manage ciphers itself.

This patch supports Blowfish, DES and CAST5 algorithms.

Marko Kreen
2002-11-15 02:54:44 +00:00
Tom Lane 3e8c4c7a73 Improve warning messages from tsearch trigger function; clean up some
casting infelicities.  Allow char(n) fields to be indexed.  Per
Bjoern Metzdorf.
2002-11-14 20:10:00 +00:00
Bruce Momjian 9b12ab6d5d Add new palloc0 call as merge of palloc and MemSet(0). 2002-11-13 00:39:48 +00:00
Bruce Momjian 75fee4535d Back out use of palloc0 in place if palloc/MemSet. Seems constant len
to MemSet is a performance boost.
2002-11-11 03:02:20 +00:00
Bruce Momjian 8fee9615cc Merge palloc()/MemSet(0) calls into a single palloc0() call. 2002-11-10 07:25:14 +00:00
Bruce Momjian a5715eecb6 Clean up format of SQL. 2002-11-08 20:22:12 +00:00
Bruce Momjian 4c1383efd1 The attached patch defines functions for getting distances between
points on the surface of the earth and locating points within a
specified distance using an index based on the contrib/cube package. The
new functions are all of language type sql. A couple of bugs in the old
earthdistance function based on the point datatype are fixed. A
regression test has been added for both sets of functions. The README
file has been updated to include documentation on the new stuff. There
are comments about how this package is also useful for Astronomers.

Bruno Wolff III
2002-11-08 20:20:22 +00:00
Tom Lane df7201c3c5 Remove no-longer-needed inclusions to improve backward compatibility
with older bison versions.
2002-11-07 06:06:17 +00:00
Tom Lane fc9814d17e Remove GPL file pursuant to relicensing. 2002-11-06 22:23:08 +00:00
Bruce Momjian 5a87147173 Change dbmirror lincense to BSD. 2002-11-06 17:50:53 +00:00
Tom Lane 3f435f9e99 Remove extraneous semicolons after routine bodies. These don't bother
gcc, but some other compilers don't like 'em.
2002-11-04 17:14:29 +00:00
Tom Lane bfccacf3f8 Fix dblink regression test so that it works when repeated: don't
create a second database, just loop back to 'regression'.  Patch
from Joe Conway 10/22/02.
2002-11-03 04:52:09 +00:00
Bruce Momjian 08e8c8a574 Use sed rather than perl for reindexdb. 2002-11-03 01:20:06 +00:00
Tom Lane 776d9651e1 Make it possible to run 'make installcheck' in contrib when building
outside the source tree.
2002-11-02 00:16:21 +00:00
Tom Lane 6423a8eef6 Fix contrib/rserv to install successfully when built outside source tree.
(Not that it will actually work with 7.3, I fear.)
2002-11-01 23:45:37 +00:00
Tom Lane c87867f47b Ooops, forgot to fix contrib regression tests for WARNING/NOTICE change. 2002-11-01 23:44:34 +00:00
Tom Lane 97915fcd14 Need -I. to build outside source tree. 2002-11-01 23:23:29 +00:00
Tom Lane e9e919f4ee Fix incorrect subdir value. 2002-11-01 23:16:52 +00:00
Tom Lane cab9437a43 Arrange to compile flex output files as inclusions into other files
(usually bison output files), not as standalone files.  This hack
works around flex's insistence on including <stdio.h> before we are
able to include postgres.h; postgres.h will already be read before
the compiler starts to read the flex output file.  Needed for largefile
support on some platforms.
2002-11-01 22:52:34 +00:00
Tom Lane 1e970dcee8 Ooops, forgot to fix contrib regression tests for WARNING/NOTICE change. 2002-11-01 22:46:04 +00:00
Tom Lane 5936055d46 Avoid use of inline functions that are not declared static. Needed to
conform to C99's brain-dead notion of how inline functions should work.
2002-10-31 19:11:48 +00:00
Tom Lane 3518fbe86f Add missing semicolons to a few PG_FUNCTION_INFO_V1 calls. 2002-10-26 15:01:01 +00:00
Peter Eisentraut 0bd223291f Update build system. 2002-10-22 20:03:09 +00:00
Bruce Momjian b825a8f025 When I removed the cube based stuff from eathdistance I accidentally
left a reference to cube in a comment in the regression test (that also
shows up in the expected output). This doesn't cause any real problem,
but people who read the comment might be confused. Attached is a diff to
remove the reference.

Bruno Wolff III
2002-10-21 20:33:21 +00:00
Peter Eisentraut de9d7f4bd5 Add DLLIMPORT declarations needed by contrib modules. 2002-10-21 18:57:35 +00:00
Peter Eisentraut 0530d7a24b Need sys/param.h for endianness macros. 2002-10-21 18:56:30 +00:00
Peter Eisentraut 6adf38ac8c Might need to link with -lcrypt. 2002-10-21 18:55:10 +00:00
Bruce Momjian e5cf1a8a26 SET autocommit no longer needed in /contrib because pg_regress.sh does
it automatically now on regression session startup.
2002-10-21 01:42:14 +00:00
Bruce Momjian 20d31fd609 Completely remove /contrib/retep, with Peter's approval; now on Source
Forge.
2002-10-21 00:35:41 +00:00
Bruce Momjian 9c7cd8ba15 First step to removing /contrib/retep, with Peter Mount's approval. 2002-10-21 00:12:46 +00:00
Tom Lane 4d1aaedac0 Fix core dump recently introduced into pgbench. 2002-10-20 19:38:10 +00:00
Bruce Momjian 8e6b5c8b27 It includes
-Support for mirroring tables in different Schema's
-Improved documentation for compiling with 7.1.x and 7.2.x
-Fixes a buffer overrun bug.

Steven Singer
2002-10-19 02:16:40 +00:00
Bruce Momjian 5214f09b27 Clean up for dblink autocommit OFF handling. 2002-10-18 19:11:27 +00:00
Bruce Momjian aa4c702eac Update /contrib for "autocommit TO 'on'".
Create objects in public schema.

Make spacing/capitalization consistent.

Remove transaction block use for object creation.

Remove unneeded function GRANTs.
2002-10-18 18:41:22 +00:00
Bruce Momjian 4c59afaee6 This trivial patch fixes a bunch of spelling mistakes in the
contrib/dbmirror/README.dbmirror doc file.

Neil Conway
2002-10-14 04:27:25 +00:00
Bruce Momjian 8031b066fa Update README for oid2name. 2002-10-12 19:15:09 +00:00
Bruce Momjian 0215dc9b0f Well, this patch makes Makefile for contrib/rserv use the
contrib/contrib-global.mk library and _generally_ behave like
   Makefiles for other contrib modules.
   Besides it fixes Perl's interpolation of $libdir variable, which
   should be passed to backend instead. This patch is done against
   PostgreSQL 7.3b2

   Besides, I want to thank Peter Eisentraut for his very friendly and
   helpful attitude and politely ask him to check whether contrib
   modules actually continue to work after he implements another
   major change to their build process.

Alexey Borzov
2002-10-09 16:23:55 +00:00
Tatsuo Ishii 9a2e9c6804 Avoid PQisBusy/PQconsumeInput busy loop in case of PQisBusy returning
false. per Tom Lane's suggestion. See:

Subject: Suggested change to pgbench
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Tatsuo Ishii <t-ishii@sra.co.jp>
Cc: pgsql-patches@postgreSQL.org
Date: Sun, 06 Oct 2002 12:37:27 -0400

for more details.
2002-10-07 05:10:02 +00:00
Tom Lane 9886a46e76 Restore NOTICEs that were mistakenly removed from triggers regression
test expected output.  Tweak contrib/spi Makefile so that refint.so is
by default built with appropriate NOTICE support for regression testing.
2002-10-03 18:40:02 +00:00
Bruce Momjian 0a85eea07e It's just a cosmetic change, fixes the help screen. Should be applied in
/contrib/vacuumlo

Mario Weilguni
2002-10-03 17:20:39 +00:00
Bruce Momjian e654065f11 This is small README fix for contrib/intarray. Thank you.
Teodor Sigaev
2002-10-03 17:16:31 +00:00
Bruce Momjian a62873d279 The attached adds a bit to the contrib/tablefunc regression test for
behavior of connectby() in the presence of infinite recursion. Please
apply this one in addition to the one sent earlier.

Joe Conway
2002-10-03 17:15:36 +00:00
Bruce Momjian 620dddf88a > The previous patch fixed an infinite recursion bug in
> contrib/tablefunc/tablefunc.c:connectby. But, other unmanageable error
> seems to occur even if a table has commonplace tree data(see below).
>
> I would think the patch, ancestor check, should be
>
>   if (strstr(branch_delim || branchstr->data || branch_delim,
>                        branch_delim || current_key || branch_delim))
>
> This is my image, not a real code. However, if branchstr->data includes
> branch_delim, my image will not be perfect.

Good point. Thank you Masaru for the suggested fix.

Attached is a patch to fix the bug found by Masaru. His example now
produces:

regression=# SELECT * FROM connectby('connectby_tree', 'keyid',
'parent_keyid', '11', 0, '-') AS t(keyid int, parent_keyid int, level
int,
branch text);
  keyid | parent_keyid | level |  branch

-------+--------------+-------+----------
     11 |              |     0 | 11
     10 |           11 |     1 | 11-10
    111 |           11 |     1 | 11-111
      1 |          111 |     2 | 11-111-1
(4 rows)

While making the patch I also realized that the "no show branch" form of
the  function was not going to work very well for recursion detection.
Therefore  there is now a default branch delimiter ('~') that is used
internally, for  that case, to enable recursion detection to work. If
you need a different  delimiter for your specific data, you will have to
use the "show branch" form  of the function.

Joe Conway
2002-10-03 17:11:12 +00:00
Bruce Momjian 603f601269 Attached is a patch to contrib/dbmirror that fixes a bug that was
causing  the postmaster to crash when the trigger was running on a table
without a  primary key.

I've also updated the docs to explicitly say that tables need primary
keys.

Steven Singer
2002-09-26 05:24:30 +00:00
Tom Lane 691aefcf42 Shouldn't be here ... 2002-09-25 14:27:16 +00:00
Bruce Momjian df88a3cfc5 Install proper earthdistance file, regression passes. 2002-09-25 13:04:48 +00:00
Bruce Momjian 65bf5a39e0 Add missing earthdistance regression test files. 2002-09-25 03:46:04 +00:00
Bruce Momjian 87eb561c88 Add earthdistance regression file. 2002-09-24 20:09:33 +00:00
Tom Lane c99f820053 Tweak dblink functions to use int4 arguments instead of int2,
to avoid having to write explicit casts.  From Joe Conway.
2002-09-23 18:03:32 +00:00
Tom Lane c5a09067d8 Remove extraneous | ... while bison 1.28 doesn't object, newer versions
do.
2002-09-22 21:51:18 +00:00
Tom Lane fce573ae16 I haven't seen any objections, so here is a patch. It removes "#define
YYERROR_VERBOSE" from contrib/cube and contrib/seg, and adjusts the expected
output accordingly. Hopefully this will consistently pass across multiple
bison versions.

Joe Conway
2002-09-22 20:08:51 +00:00
Bruce Momjian ec63143f81 Tiny patch fixing small documentation typo.
Oleg Bartunov
2002-09-20 03:54:21 +00:00
Bruce Momjian 24bebf0b72 I have included fixes to declare some floating point constants as double
instead of int, change the calculation method to use the haversine
formula
which is more accurrate for short distances, added a grant to public for
geo_distance and added a regression test.

I will resubmit the earth distance stuff based on cube after 7.3 is
released.

Bruno Wolff III
2002-09-20 03:47:22 +00:00
Bruce Momjian 1336ecb332 This grants execute privileges to public for the fti() function. Should
we go through and give all the contribs grants?

Christopher Kings-Lynne
2002-09-20 03:42:39 +00:00
Bruce Momjian 9152bebfe4 Add 'adddepend' script to handle pre-7.3 object dependencies. 2002-09-18 20:38:59 +00:00
Tatsuo Ishii 6bea242750 Add GRANT EXECUTE ON FUNCTION 2002-09-18 06:38:29 +00:00
Tom Lane cd7a3b6c0d Simplify handling of second database for dblink tests. 2002-09-14 22:00:59 +00:00
Tom Lane b66ba36be9 Clean up mess from duplicate patches. 2002-09-14 21:32:38 +00:00
Tom Lane d724c314da The attached adds GRANTs to PUBLIC for dblink functions, removes the
non-standard regression test, and adds standard installcheck regression test
support.

The test creates a second database (regression_slave) and drops it again, in
order to avoid the cheesy-ness of connecting back to the same database ;-)

Joe Conway
2002-09-14 20:28:54 +00:00
Tom Lane c0edc53a36 The attached adds GRANTs to PUBLIC for contrib/fuzzystringmatch.
Joe Conway
2002-09-14 19:56:01 +00:00
Tom Lane bd04184b11 Attached is a patch to fix some recently raised issues that exist in
contrib/tablefunc. Specifically it replaces the use of VIEWs (for needed
composite type creation) with use of CREATE TYPE. It also performs GRANT
EXECUTE ON FUNCTION foo() TO PUBLIC for all of the created functions. There
was also a cosmetic change to two regression files.

Joe Conway
2002-09-14 19:53:59 +00:00
Tom Lane d3ebc1ae4a Fix portability bug in get_normal_pair (RAND_MAX != MAX_RANDOM_VALUE).
Also try to improve readability and performance.
2002-09-14 19:32:54 +00:00
Bruce Momjian e57ab04565 This is a comprehensive set of diffs (versus current CVS) that replaces those
attached to the same message with the Earth Distance patches.
Recent changes include changing the subscript in one place I forgot
in the previous bugfix patch. A couple of added regression tests, which
should help catch this mistake if it reappears.
I also put in a limit of 100 dimensions in cube_large and cube_in to
prevent making it easy to create very large cubes. Changing one define
in cubedata.h will raise the limit if some needs more dimensions.

Bruno Wolff III
2002-09-12 00:26:00 +00:00
Bruce Momjian eb5bf51372 > intarray and ltree both seem to be mapping their own declarations onto
> arrays using largely-similar code.  But while intarray fails its
> regression test, I find ltree still passes.  So I'm confused about what
> that code is really doing and don't want to touch it.

Please, apply attached patch, it solves the problem.

Teodor Sigaev
2002-09-12 00:24:46 +00:00
Bruce Momjian f490dbe594 > Now I'm testing connectby() in the /contrib/tablefunc in 7.3b1, which would
> be a useful function for many users.   However, I found the fact that
> if connectby_tree has the following data, connectby() tries to search the end
> of roots without knowing that the relations are infinite(-5-9-10-11-9-10-11-)
.
> I hope connectby() supports a check routine to find infinite relations.
>
>
> CREATE TABLE connectby_tree(keyid int, parent_keyid int);
> INSERT INTO connectby_tree VALUES(1,NULL);
> INSERT INTO connectby_tree VALUES(2,1);
> INSERT INTO connectby_tree VALUES(3,1);
> INSERT INTO connectby_tree VALUES(4,2);
> INSERT INTO connectby_tree VALUES(5,2);
> INSERT INTO connectby_tree VALUES(6,4);
> INSERT INTO connectby_tree VALUES(7,3);
> INSERT INTO connectby_tree VALUES(8,6);
> INSERT INTO connectby_tree VALUES(9,5);
>
> INSERT INTO connectby_tree VALUES(10,9);
> INSERT INTO connectby_tree VALUES(11,10);
> INSERT INTO connectby_tree VALUES(9,11);    <-- infinite
>

The attached patch fixes the infinite recursion bug in
contrib/tablefunc/tablefunc.c:connectby found by Masaru Sugawara.

test=# SELECT * FROM connectby('connectby_tree', 'keyid',
'parent_keyid', '2', 4, '~') AS t(keyid int, parent_keyid int, level
int, branch text);
  keyid | parent_keyid | level |   branch
-------+--------------+-------+-------------
      2 |              |     0 | 2
      4 |            2 |     1 | 2~4
      6 |            4 |     2 | 2~4~6
      8 |            6 |     3 | 2~4~6~8
      5 |            2 |     1 | 2~5
      9 |            5 |     2 | 2~5~9
     10 |            9 |     3 | 2~5~9~10
     11 |           10 |     4 | 2~5~9~10~11
(8 rows)

test=# SELECT * FROM connectby('connectby_tree', 'keyid',
'parent_keyid', '2', 5, '~') AS t(keyid int, parent_keyid int, level
int, branch text);
ERROR:  infinite recursion detected

I implemented it by checking the branch string for repeated keys
(whether or not the branch is returned). The performance hit was pretty
minimal -- about 1% for a moderately complex test case (220000 record
table, 9 level tree with 3800 members).

Joe Conway
2002-09-12 00:19:44 +00:00
Bruce Momjian 5dd74c0f21 The attached small patch fixes the cause of the regression test failure
for contrib/intarray.

The cause was that the library uses its own function to construct a new
array, new_intArrayType, and that function did not set the new array
struct attribute elemtype.

Joe Conway
2002-09-12 00:15:33 +00:00
Bruce Momjian 6fff9a7475 The attached removes the current non-standard file
"contrib/tablefunc/tablefunc-test.sql", and adds a standard regression
test suite to contrib/tablefunc.

Joe Conway
2002-09-12 00:14:40 +00:00
Tom Lane 497baca6b5 Fix compile warning. 2002-09-05 21:19:13 +00:00
Tom Lane 8d7904f526 Fix bit-rotted reference to GetUserName() ...
it's GetUserNameFromId() now.
2002-09-05 21:13:03 +00:00
Tom Lane bed4f65499 Fix breakage introduced by careless snprintf patching. 2002-09-05 21:09:54 +00:00
Tom Lane fb473bc6fa Fix unsafe macro definitions (which were producing incorrect code,
leading to compile warnings).
2002-09-05 21:08:26 +00:00
Tom Lane da2e0ddeb4 Remove compile warnings, ensure consistent build environment for
largefile usage.
2002-09-05 21:01:16 +00:00
Tom Lane f2a242f988 Fix compile warning. 2002-09-05 20:57:00 +00:00
Tom Lane fcbe62ee51 findoidjoins and tsearch are not broken anymore. 2002-09-05 20:53:45 +00:00
Tom Lane 5d1c8a3b07 Fix compile errors. 2002-09-05 20:51:39 +00:00
Tom Lane d7e654ff79 findoidjoins is updated for schemas, does not use libpgeasy.
From Joe Conway.
2002-09-05 19:57:32 +00:00
Peter Eisentraut 012288d565 Commenting out doesn't work, so move the broken modules out of the list. 2002-09-05 18:40:33 +00:00
Peter Eisentraut 337da0678a Assorted fixes for Cygwin:
Eliminate the mysterious games that the Cygwin build plays with the linker
flag variables.  DLLLIBS is gone, use SHLIB_LINK like everyone else.
Detect cygipc in configure, after the linker flags are set up, otherwise
configure might not work at all.

Make sure everything is covered by make clean.

Fix the build of the new conversion procedure modules.

Add new DLLIMPORT markers where required.

Finally, the compiler complains if we use an explicit
-I/usr/local/include, so don't do that.  Curiously, -L/usr/local/lib is
still necessary.
2002-09-05 18:28:46 +00:00
Tom Lane edc71eced0 Remove include of libpq-int.h --- dblink.c should not be (and was not)
depending on libpq internals.
2002-09-05 00:56:35 +00:00
Tom Lane 52c9d25933 Be careful to include postgres.h *before* any system headers, to ensure
that the right flavors of largefile-related definitions are seen.
Most of these changes are probably unnecessary, but better safe than
sorry.
2002-09-05 00:43:07 +00:00
Peter Eisentraut be475f92cd Fix compile warning. 2002-09-04 22:51:23 +00:00
Peter Eisentraut f9b7ba2871 Disable findoidjoins while it doesn't compile. 2002-09-04 22:50:43 +00:00
Bruce Momjian e50f52a074 pgindent run. 2002-09-04 20:31:48 +00:00
Tatsuo Ishii 5e3a28f4de Refrect changes made by Tom Lane 2002-09-04 02:54:59 +00:00
Peter Eisentraut 77f7763b55 Remove all traces of multibyte and locale options. Clean up comments
referring to "multibyte" where it really means character encoding.
2002-09-03 21:45:44 +00:00
Tom Lane e167510a4f Clean out cruft left by nonstandard test procedure. 2002-09-03 04:01:05 +00:00
Tom Lane 74cbe50439 last-minute CreateTemplateTupleDesc fixes. 2002-09-03 04:00:37 +00:00
Bruce Momjian a02780ffd0 Add missing dblink files. 2002-09-02 06:32:41 +00:00
Bruce Momjian 81631ac435 Fixes for intagg regression tests to match new array internal handling.
mlw
2002-09-02 06:28:06 +00:00
Bruce Momjian f68fe6716c In case Florian and I don't finish his changes to this contrib before
beta, at least get this stuff in.

ftipatch.txt - Updates to docs and scripts.  Run in the fulltextindexdir
WARNING - Add to fulltextindex dir
uninstall.sql - Add to fulltextindex dir
2002-09-02 06:27:04 +00:00
Bruce Momjian 7b8eb0b4f1 Attached is a fairly sizeable update to contrib/dblink. I'd love to get
review/feedback if anyone is interested and can spend the time. But I'd
also love to get this committed and address changes as incremental
patches ;-), so if there are no objections, please apply.

Below I'll give a synopsis of the changes. More detailed descriptions
are now in a new doc directory under contrib/dblink. There is also a new

dblink.test.sql file which will give a pretty good overview of the
functions and their use.

Joe Conway
2002-09-02 06:13:31 +00:00
Bruce Momjian a12b4e279b I checked all the previous string handling errors and most of them were
already fixed by You. However there were a few left and attached patch
should fix the rest of them.

I used StringInfo only in 2 places and both of them are inside debug
ifdefs. Only performance penalty will come from using strlen() like all
the other code does.

I also modified some of the already patched parts by changing
snprintf(buf, 2 * BUFSIZE, ... style lines to
snprintf(buf, sizeof(buf), ... where buf is an array.

Jukka Holappa
2002-09-02 06:11:43 +00:00
Bruce Momjian 6aa4482f2f Attached is an update to contrib/tablefunc. It introduces a new
function, connectby(), which can serve as a reference implementation for

the changes made in the last few days -- namely the ability of a
function to return an entire tuplestore, and the ability of a function
to make use of the query provided "expected" tuple description.

Description:

   connectby(text relname, text keyid_fld, text parent_keyid_fld,
     text start_with, int max_depth [, text branch_delim])
   - returns keyid, parent_keyid, level, and an optional branch string
   - requires anonymous composite type syntax in the FROM clause. See
     the instructions in the documentation below.

Joe Conway
2002-09-02 05:44:05 +00:00
Tom Lane c7a165adc6 Code review for HeapTupleHeader changes. Add version number to page headers
(overlaying low byte of page size) and add HEAP_HASOID bit to t_infomask,
per earlier discussion.  Simplify scheme for overlaying fields in tuple
header (no need for cmax to live in more than one place).  Don't try to
clear infomask status bits in tqual.c --- not safe to do it there.  Don't
try to force output table of a SELECT INTO to have OIDs, either.  Get rid
of unnecessarily complex three-state scheme for TupleDesc.tdhasoids, which
has already caused one recent failure.  Improve documentation.
2002-09-02 01:05:06 +00:00
Tom Lane d803de50d4 intagg subdirectory was missing. 2002-08-30 01:44:00 +00:00
Tom Lane e107f3a7e3 PL/pgSQL functions can return sets. Neil Conway's patch, modified so
that the functionality is available to anyone via ReturnSetInfo, rather
than hard-wiring it to PL/pgSQL.
2002-08-30 00:28:41 +00:00
Bruce Momjian dbc4d615ca Add cube changes file. 2002-08-29 23:05:03 +00:00
Bruce Momjian 32784cddf1 The changes I have made are described in CHANGES. This was based on
diffs to 7.3-devel and may not be applicable to 7.2. I have included a
change covered by a previous bugfix patch I submitted (the problem with
-.1 not being accepted by cube_in). It does not include a fix for the
potential buffer overrun issue I reported for cube_yyerror in
cubeparse.y.


Bruno Wolff III
2002-08-29 23:03:58 +00:00
Peter Eisentraut 6d27cfdd89 Make pg_resetxlog options parsing more standard and prepare messages for
translation.
2002-08-29 22:19:03 +00:00
Bruce Momjian 1761990e38 please apply small patch for README.tsearch.
I've documented space usage and using CLUSTER command

Oleg Bartunov
2002-08-29 19:55:26 +00:00
Tom Lane e4186762ff Adjust nodeFunctionscan.c to reset transient memory context between calls
to the table function, thus preventing memory leakage accumulation across
calls.  This means that SRFs need to be careful to distinguish permanent
and local storage; adjust code and documentation accordingly.  Patch by
Joe Conway, very minor tweaks by Tom Lane.
2002-08-29 17:14:33 +00:00
D'Arcy J.M. Cain 5f97dc3e7c chkpass_rout returns text so change PG_RETURN_CSTRING to PG_RETURN_TEXT_P.
This is currently a cosmetic difference but I make the change now in case
the macros diverge one day.
2002-08-29 12:18:20 +00:00
Tom Lane 64505ed58b Code review for standalone composite types, query-specified composite
types, SRFs.  Not happy with memory management yet, but I'll commit these
other changes.
2002-08-29 00:17:06 +00:00
Tom Lane 7483749d82 Improve description of tablefunc. 2002-08-28 22:05:46 +00:00
Tom Lane 5cabcfccce Modify array operations to include array's element type OID in the
array header, and to compute sizing and alignment of array elements
the same way normal tuple access operations do --- viz, using the
tupmacs.h macros att_addlength and att_align.  This makes the world
safe for arrays of cstrings or intervals, and should make it much
easier to write array-type-polymorphic functions; as examples see
the cleanups of array_out and contrib/array_iterator.  By Joe Conway
and Tom Lane.
2002-08-26 17:54:02 +00:00
Tatsuo Ishii cf7ee638a7 Adapt for SRF(Set Returning Function). 2002-08-23 08:19:49 +00:00
Bruce Momjian 52ee800ed3 Patch resolve ERROR problem for non-goog query_txt.
Teodor Sigaev
2002-08-23 02:56:36 +00:00
Tom Lane ceb9e60e8e Update contrib regression tests for OPAQUE datatype changes. 2002-08-23 00:04:52 +00:00
Tom Lane b663f3443b Add a bunch of pseudo-types to replace the behavior formerly associated
with OPAQUE, as per recent pghackers discussion.  I still want to do some
more work on the 'cstring' pseudo-type, but I'm going to commit the bulk
of the changes now before the tree starts shifting under me ...
2002-08-22 00:01:51 +00:00
Tom Lane e1b040a7c3 Fix potential buffer overrun in cube_out(), per report from
Bruno Wolff.
2002-08-18 20:15:52 +00:00
Tom Lane 675a7b8280 Cleanup. 2002-08-17 04:06:48 +00:00
Bruce Momjian 6945ea3445 Move pg_controldata to /bin. 2002-08-17 02:43:08 +00:00
Bruce Momjian cd1f4087c9 Move pg_controldata from /contrib to src/bin. 2002-08-16 20:34:06 +00:00
Bruce Momjian 2860041bf0 August 13, 2002
Use parser of OpenFTS v0.33.

--
Teodor Sigaev
2002-08-15 03:02:08 +00:00
Bruce Momjian 66eb8df6a4 The attached patch changes most of the usages of sprintf() to
snprintf() in contrib/. I didn't touch the places where pointer
arithmatic was being used, or other areas where the fix wasn't
trivial. I would think that few, if any, of the usages of sprintf()
were actually exploitable, but it's probably better to be paranoid...

Neil Conway
2002-08-15 02:58:29 +00:00
Bruce Momjian 45e2544584 As discussed on several occasions previously, the new anonymous
composite type capability makes it possible to create a system view
based on a table function in a way that is hopefully palatable to
everyone. The attached patch takes advantage of this, moving
show_all_settings() from contrib/tablefunc into the backend (renamed
all_settings(). It is defined as a builtin returning type RECORD. During
initdb a system view is created to expose the same information presently
available through SHOW ALL. For example:

test=# select * from pg_settings where name like '%debug%';
          name          | setting
-----------------------+---------
  debug_assertions      | on
  debug_pretty_print    | off
  debug_print_parse     | off
  debug_print_plan      | off
  debug_print_query     | off
  debug_print_rewritten | off
  wal_debug             | 0
(7 rows)


Additionally during initdb two rules are created which make it possible
to change settings by updating the system view -- a "virtual table" as
Tom put it. Here's an example:

Joe Conway
2002-08-15 02:51:27 +00:00
Bruce Momjian 106c733c34 Spacing improvement. 2002-08-14 03:01:43 +00:00
Bruce Momjian 87cfb8eb29 Fixed very stupid but important bug: mixing calls of some founctions from
contrib/tsearch and contrib/ltree :)

Teodor Sigaev
2002-08-10 20:46:24 +00:00
Bruce Momjian be2de3b9c8 The patch solves this problem, I hope...
Christopher Kings-Lynne wrote:
> I'm still getting ltree failures on 64bit freebsd:
>
> sed 's,MODULE_PATHNAME,$libdir/ltree,g' ltree.sql.in >ltree.sql
> gcc -pipe -O -g -Wall -Wmissing-prototypes -Wmissing-declarations -fpic -DPI
> C -DLOWER_NODE -I. -I../../src/include   -c -o ltree_io.o ltree_io.c -MMD
> ltree_io.c: In function `ltree_in':
> ltree_io.c:57: warning: int format, different type arg (arg 3)
> ltree_io.c:63: warning: int format, different type arg (arg 4)
> ltree_io.c:68: warning: int format, different type arg (arg 3)

Teodor Sigaev
2002-08-10 20:45:48 +00:00
Bruce Momjian 181ca96e7a August 6, 2002
1. Reworked patch from Andrey Oktyabrski (ano@spider.ru) with
      functions: icount, sort, sort_asc, uniq, idx, subarray
      operations: #, +, -, |, &

FUNCTIONS:

  int   icount(int[]) - the number of elements in intarray
  int[] sort(int[], 'asc' | 'desc') - sort intarray
  int[] sort(int[]) - sort in ascending order
  int[] sort_asc(int[]),sort_desc(int[]) - shortcuts for sort
  int[] uniq(int[]) - returns unique elements
  int   idx(int[], int item) - returns index of first intarray matching element
                               to item, or '0' if matching failed.
  int[] subarray(int[],int START [, int LEN]) - returns part of intarray
                               starting from element number START (from 1)
                               and length LEN.
OPERATIONS:

  int[] && int[]  - overlap - returns TRUE if arrays has at least one common elements.
  int[] @  int[]  - contains - returns TRUE if left array contains right array
  int[] ~ int[]   - contained - returns TRUE if left array is contained in right array
  # int[]         - return the number of elements in array
  int[] + int     - push element to array ( add to end of array)
  int[] + int[]   - merge of arrays (right array added to the end of left one)
  int[] - int     - remove entries matched by right argument from array
  int[] - int[]   - remove left array from right
  int[] | int     - returns intarray - union of arguments
  int[] | int[]   - returns intarray as a union of two arrays
  int[] & int[]   - returns intersection of arrays

Oleg Bartunov
2002-08-10 20:38:29 +00:00
Tom Lane 4ab8e69094 has_table_privilege spawns scions has_database_privilege, has_function_privilege,
has_language_privilege, has_schema_privilege to let SQL queries test
all the new privilege types in 7.3.  Also, add functions pg_table_is_visible,
pg_type_is_visible, pg_function_is_visible, pg_operator_is_visible,
pg_opclass_is_visible to test whether objects contained in schemas are
visible in the current search path.  Do some minor cleanup to centralize
accesses to pg_database, as well.
2002-08-09 16:45:16 +00:00
Bruce Momjian 34f03b1630 Patch for current CVS. It add test of lca() to ltree test suite.
Teodor Sigaev
2002-08-06 05:35:29 +00:00
Bruce Momjian 4132106055 Tom Lane:
>       please find attached patch to current CVS ( contrib/ltree)
>       Version for 7.2 is distributed as separate package -

I believe that patch also intended to remove contrib/ltree/patch.72
2002-08-04 05:12:43 +00:00
Bruce Momjian 978c8c6d2f please find attached patch to current CVS ( contrib/ltree )
Changes:

July 31, 2002
   Now works on 64-bit platforms.
   Added function lca - lowest common ancestor
   Version for 7.2 is distributed as separate package -
   http://www.sai.msu.su/~megera/postgres/gist/ltree/ltree-7.2.tar.gz

Oleg Bartunov
2002-08-04 05:02:50 +00:00
Bruce Momjian ce3d087010 This patch adds support for inet[] arrays to the /contrib/array module.
Neil Conway
2002-08-04 04:25:02 +00:00
Tom Lane 38bb77a5d1 ALTER TABLE DROP COLUMN works. Patch by Christopher Kings-Lynne,
code review by Tom Lane.  Remaining issues: functions that take or
return tuple types are likely to break if one drops (or adds!)
a column in the table defining the type.  Need to think about what
to do here.

Along the way: some code review for recent COPY changes; mark system
columns attnotnull = true where appropriate, per discussion a month ago.
2002-08-02 18:15:10 +00:00
Tom Lane 45e584a445 Replace ad-hoc insertions into pg_opclass and friends with CREATE
OPERATOR CLASS commands.
2002-07-30 18:48:34 +00:00
Tom Lane 65b6868b13 Replace ad-hoc insertions into pg_opclass and friends with CREATE
OPERATOR CLASS commands.  Further tweaking of documentation for same.
2002-07-30 17:34:37 +00:00
Tom Lane ea2d97414c Use Max/Min macros, not MAX/MIN, to eliminate portability issues. 2002-07-30 17:32:10 +00:00
Bruce Momjian 1dedbf2da5 Add ltree data type to contrib, from Teodor Sigaev and Oleg Bartunov. 2002-07-30 16:40:34 +00:00
Tom Lane 9f1fc1080e Since we're depending on %option noyywrap in the main scanner now,
we may as well use it in all our flex files.  Make all the flex files
have a consistent set of options.
2002-07-30 16:33:08 +00:00