Commit Graph

10837 Commits

Author SHA1 Message Date
Tom Lane d51260aa9d Fix wrong/misleading comments, be more consistent about where to call
ExecAssignResultTypeFromTL().
2003-01-12 22:01:38 +00:00
Peter Eisentraut 13437d1e9c Replace RelidGetNamespaceId() by get_rel_namespace(). 2003-01-12 18:19:37 +00:00
Tom Lane 19b886332a First cut at implementing IN (and NOT IN) via hashtables. There is
more to be done yet, but this is a good start.
2003-01-12 04:03:34 +00:00
Bruce Momjian bb6652552a Back out flockfile change for NetBSD. Giles Lean reports they are not
supported.
2003-01-11 19:38:23 +00:00
Tom Lane 43057c7a27 Cause symlinks for shared-library versioning to run in the standard
direction on HP-UX; our former approach has been obsolete since HPUX 9.

Giles Lean
2003-01-11 17:22:19 +00:00
Tatsuo Ishii 38535f8e32 Fix typo in an error message 2003-01-11 06:55:11 +00:00
Bruce Momjian 3cd7edfee0 > > This patch improves the documentation for the shared_buffers GUC param.
>
> I'd suggest that the runtime.sgml description explicitly say "values of
> at least a few thousand are recommended for production installations".

Neil Conway
2003-01-11 05:04:14 +00:00
Bruce Momjian ef581f0552 Rewrite for-loop, because this is not the Obfuscated C Code Contest.
Manfred Koizar
2003-01-11 05:01:03 +00:00
Bruce Momjian bcf7a35f3c A tiny patch to fix a typo in configure.in and another one in
RELEASE_CHANGES.

Manfred Koizar
2003-01-11 04:58:44 +00:00
Tom Lane 1afac12910 Create a new file executor/execGrouping.c to centralize utility routines
shared by nodeGroup, nodeAgg, and soon nodeSubplan.
2003-01-10 23:54:24 +00:00
Tom Lane c83702606c Add missing <limits.h> for INT64_IS_BUSTED case. 2003-01-10 23:49:06 +00:00
Peter Eisentraut b65cd56240 Read-only transactions, as defined in SQL. 2003-01-10 22:03:30 +00:00
Peter Eisentraut b7ca9bdf18 Do not shell-quote the name of the editor, so that the editor can be a
command with arguments.
2003-01-10 21:57:44 +00:00
Tom Lane e69785debf Further tweaking of parsetree & plantree representation of SubLinks.
Simplify SubLink by storing just a List of operator OIDs, instead of
a list of incomplete OpExprs --- that was a bizarre and bulky choice,
with no redeeming social value since we have to build new OpExprs
anyway when forming the plan tree.
2003-01-10 21:08:15 +00:00
Peter Eisentraut 36ea26793a Add optional drop behavior clause to REVOKE command, for SQL conformance.
Currently, only RESTRICT is allowed.
2003-01-10 11:02:51 +00:00
Peter Eisentraut 611278cc0b Clean ip.c. 2003-01-10 10:59:08 +00:00
Tom Lane 6bc61fc046 Adjust parser so that 'x NOT IN (subselect)' is converted to
'NOT (x IN (subselect))', that is 'NOT (x = ANY (subselect))',
rather than 'x <> ALL (subselect)' as we formerly did.  This
opens the door to optimizing NOT IN the same way as IN, whereas
there's no hope of optimizing the expression using <>.  Also,
convert 'x <> ALL (subselect)' to the NOT(IN) style, so that
the optimization will be available when processing rules dumped
by older Postgres versions.
initdb forced due to small change in SubLink node representation.
2003-01-09 20:50:53 +00:00
Tom Lane 83b06823f6 Move new typedef AclId into c.h, so as to avoid cluttering namespace
by having to include miscadmin.h into other header files.
2003-01-09 18:00:24 +00:00
Peter Eisentraut 9df2c44032 Fix IPv6 detection and IPv6 to 4 conversion to use only standard
interfaces.
2003-01-09 14:35:03 +00:00
Bruce Momjian 8e20b91e78 Fix indenting of log_min_error_statement. 2003-01-09 05:19:02 +00:00
Bruce Momjian 0481f3f461 Remove bit.c/h routines. Not used anymore. 2003-01-09 01:23:55 +00:00
Tom Lane fb715e05f5 Repair inconsistent rounding behavior for timestamp, time, interval,
per gripe from Csaba Nagy.  There is still potential for platform-specific
behavior for values that are exactly halfway between integers, but at
least we now get the expected answer for all other cases.
2003-01-09 01:06:57 +00:00
Tom Lane 1c25c52c66 Add missing pg_proc entry for interval_scale(). The lack of this entry
causes interval rounding not to work as expected in 7.3, for example
SELECT '18:17:15.6'::interval(0) does not round the value.
I did not force initdb, but one is needed to install the added row.
2003-01-09 00:58:41 +00:00
Bruce Momjian 7aa2038d82 Remove 'const' from secure_write, to prevent compiler warning. 2003-01-08 23:34:22 +00:00
Tom Lane 3bb248ac23 Guard against stopping when numberTuples=0 and counter wraps around. 2003-01-08 23:32:29 +00:00
Bruce Momjian b56af49849 The second was that renegotiation was just plain broken. I can't
believe I didn't notice this before -- once 64k was sent to/from the
server the client would crash.  Basicly, in 7.3 the server SSL code set
the initial state to "about to renegotiate" without actually starting
the renegotiation.  In addition, the server and client didn't properly
handle the SSL_ERROR_WANT_(READ|WRITE) error.  This is fixed in the
second patch.

Nathan Mueller
2003-01-08 23:18:25 +00:00
Bruce Momjian 6ccb5aebad I was playing around with 7.3.1 and found some more SSL problems. The
first, that I missed when checking over 7.3.1, was that the client
method was switched to SSLv23 along with the server.  The SSLv23 client
method does SSLv2 by default, but can also understand SSLv3.  In our
situation the SSLv2 backwords compatibility is really only needed on the
server.  This is the first patch.

The last thing is that I found a way for the server to understand SSLv2
HELLO messages (sent by pre-7.3 clients) but then get them to talk
SSLv3.  This is the last one.

Nathan Mueller
2003-01-08 22:56:58 +00:00
Bruce Momjian d31b20af69 Fix dumping of DEFERRABLE/INITIALLY DEFERRED:
> The big problem is that while pg_dump's dump_trigger() looks at
> tginitdeferred and dumps accordingly, pg_get_constraintdef doesn't look
> at tginitdeferred, and therefore doesn't record the requirement as part
> of ALTER TABLE ADD CONSTRAINT.

pg_get_constraintdef should probably be looking at condeferrable and
condeferred in the pg_constraint row it's looking at.  Maybe something
like the attached.

(Added, output only non-default values.)

Stephan Szabo
2003-01-08 22:54:06 +00:00
Bruce Momjian 5e36cbe6ee Updated deferred trigger patch.
Neil Conway
2003-01-08 22:29:23 +00:00
Bruce Momjian c77bc1380a This trivial patch implements disabled, deferred triggers, per my
proposal on -hackers a couple days ago. The 'tgenabled' status of the
trigger is consulted when the trigger is added to the deferred queue
(i.e. when the event occurs that fires the trigger), not when the
deferred event is executed.

No regression tests, as another bug prevents them (the pg_trigger row
for a trigger is only loaded once per session, so any changes to it are
not noticed unless the client disconnects and reconnects).

Neil Conway
2003-01-08 22:28:32 +00:00
Bruce Momjian c9967a4909 Enhanced error/help message for pg_controldata.
Serguei Mokhov
2003-01-08 22:26:34 +00:00
Tom Lane 2d140d35a4 Reconsider old decision to try to constant-fold default and constraint
expressions before they are stored.  This seems like not such a hot idea,
particularly now that the constant-folder will try to inline SQL functions.
2003-01-08 22:06:23 +00:00
Tom Lane 51d2e3bd6e Repair bug noticed by Deepak Bhole: a shell type should have a dependency
on its namespace, so that it will go away if the schema is dropped.
2003-01-08 21:40:39 +00:00
Bruce Momjian fe7f8f2b91 Fix pgpass to work with PQconnectDB().
Backpatch to 7.3.X.

Report from ljb.
2003-01-08 21:33:27 +00:00
Tom Lane cbca6c4896 Fix for bug #866. 7.3 contains new logic for avoiding redundant calls to
the index AM when we know we are fetching a unique row.  However, this
logic did not consider the possibility that it would be asked to fetch
backwards.  Also fix mark/restore to work correctly in this scenario.
2003-01-08 19:41:40 +00:00
Bruce Momjian 9270f1cdaa Only set the database name if we find a match in the services file. 2003-01-08 16:21:53 +00:00
D'Arcy J.M. Cain 6f14e2771a Correction to last patch. As per the DB-API spec, we need to return None
here, not -1.
2003-01-08 13:42:16 +00:00
Tom Lane 061168d38f Code review for FETCH/MOVE 0 changes. Improve documentation, do the
right thing with the destination when FETCH 0 can't return a row,
don't try to stuff LONG_MAX into an int value.
2003-01-08 00:22:27 +00:00
Tom Lane 1bc9e98549 SendFunctionResult should take care to detoast varlena results. 2003-01-07 22:32:10 +00:00
Tom Lane 9f1f2bfb66 Fix various places where global s/NOTICE/WARNING/ was applied with too
much enthusiasm.
2003-01-07 22:23:17 +00:00
Tom Lane b4b62cff93 Apply the proper version of Christopher Kings-Lynne's describe patch
(ie, the one with describe-schema support).  Minor code review.
Adjust display of casts to use standard type names.
2003-01-07 20:56:07 +00:00
Bruce Momjian 1b59b442ce Add connection service file. 2003-01-07 20:29:30 +00:00
Bruce Momjian 7320a81ad6 Silence compiler warning caused by removal of netinet/in.h 2003-01-07 18:48:13 +00:00
Bruce Momjian cb200245a1 Fix missing tab in file. 2003-01-07 15:12:17 +00:00
Bruce Momjian c859cda782 Document libpq service capability, and add sample file. 2003-01-07 04:25:29 +00:00
Tom Lane 973a210cce Tweak mdnblocks() to avoid doing lseek() on segments that it has
previously determined not to be the last segment of a relation.
This reduces the expected cost to one seek, rather than one seek per
segment.  We can get away with this because truncation of a relation
will cause a relcache flush and so the md.c file descriptor will be
closed; when it is re-opened we will re-determine the last segment.
2003-01-07 01:19:12 +00:00
Bruce Momjian c9cf982038 Enable IPv6 libpq 'hostaddr' addresses. Update docs. 2003-01-06 22:48:16 +00:00
Peter Eisentraut 939a59ffc6 Use our own version of getopt_long() if the OS doesn't have one. 2003-01-06 18:53:25 +00:00
Peter Eisentraut 6e90803f90 Fix for systems that don't have INET_ADDRSTRLEN. 2003-01-06 09:58:36 +00:00
Bruce Momjian 6b39507498 Update comments on IPv6 #define. 2003-01-06 06:07:20 +00:00
Bruce Momjian 895f954f24 Update ipv6 comment, move configure test to the right place 2003-01-06 05:46:18 +00:00
Bruce Momjian 2d5e27c637 Add prototype for getaddrinfo(). 2003-01-06 05:33:45 +00:00
Bruce Momjian c3e9699f21 Enable IPv6 connections to the server, and add pg_hba.conf IPv6 entries
if the OS supports it.  Code will still compile on non-IPv6-aware
machines (feature added by Bruce).

Nigel Kukard
2003-01-06 03:18:27 +00:00
Tom Lane daec989f6a ALTER DOMAIN OWNER, from Rod Taylor. 2003-01-06 00:31:45 +00:00
Peter Eisentraut 1bf1597e3a Revert rpath-mangling patch. See discussion on -patches around Nov 29 for
the rationale.
2003-01-05 13:45:47 +00:00
Tom Lane a60f9db508 Fix inherited UPDATE for cases where child column numbering doesn't
match parent table.  This used to work, but was broken in 7.3 by
rearrangement of code that handles targetlist sorting.  Add a regression
test to catch future breakage.
2003-01-05 00:56:40 +00:00
Tom Lane 17194f4112 Partial code review for ALTER DOMAIN patch. Incorporates Rod Taylor's
patches of 9-Dec (permissions fix) and 13-Dec (performance) as well as
a partial fix for locking issues: concurrent DROP COLUMN should not
create trouble anymore.  But concurrent DROP TABLE is still a risk, and
there is no protection at all against creating a column of a domain while
we are altering the domain.
2003-01-04 00:46:08 +00:00
Hiroshi Inoue 150ffb2d50 Adjust lo type in contrib during pg_restore so that pg_restore could
reload the type.
2003-01-03 18:05:02 +00:00
Bruce Momjian 7e4d4354bc flockfile/funlockfile is POSIX, so NetBSD has them too --- use them. 2003-01-02 23:22:49 +00:00
Tom Lane 0a02d47a11 Enforces NOT NULL constraints to be applied against new PRIMARY KEY
columns in DefineIndex.  So, ALTER TABLE ... PRIMARY KEY will now
automatically add the NOT NULL constraint.  It appeared the alter_table
regression test wanted this to occur, as after the change the regression
test better matched in inline 'fails'/'succeeds' comments.

Rod Taylor
2003-01-02 19:29:22 +00:00
Bruce Momjian 2f86f146d9 Fix BSD/OS thread file locking bug in new fseeko code.
Backpatch to 7.3.X.
2003-01-02 06:00:33 +00:00
Tom Lane d6dbb6b283 fastpath code neglected to check whether user has privileges to call the
target function.  Also, move SetQuerySnapshot() call to avoid assert
failure when a fastpath call is attempted in an aborted transaction.
2003-01-01 21:57:05 +00:00
Tom Lane a26ac42b76 Awhile back I wrote that freebsd.h was probably broken in the places where
it diverged from netbsd.h and openbsd.h.  This has now been confirmed.
Accordingly, make all three exactly alike.
2003-01-01 20:35:39 +00:00
Tom Lane 699782b695 Adjust Tcl-related code to compile cleanly with Tcl 8.4 (add const modifiers as
needed).  Some desultory const-ification of SPI interface to support this.
2002-12-30 22:10:54 +00:00
Bruce Momjian d82794ee33 Attached is a patch to provide makefiles, etc. to allow the compilation
of the libpq interface static and dynamic libraries with the freely
downloadable Borland C++ compiler version 5.5 and/or C++ Builder.

Lester Godwin
2002-12-30 21:07:26 +00:00
Tom Lane 896bd121cc Code review for transaction-safe-TRUNCATE patch: minor cleanups. 2002-12-30 19:45:17 +00:00
Tom Lane a03c0d93d5 Code review for CLUSTER ALL patch. Fix bogus locking, incorrect transaction
stop/start nesting, other infelicities.
2002-12-30 18:42:17 +00:00
Tom Lane 2e1f2c3109 Make use of TCL_INCLUDE_SPEC if available (it's new in Tcl 8.4, too bad
it took 'em this long to realize it's needed...)
2002-12-30 17:19:54 +00:00
Bruce Momjian 33f0108df8 Cause FETCH 1 to return the current cursor row, or zero if at
beginning/end of cursor.

Have MOVE return 0/1 depending on cursor position.

Matches SQL spec.

Pass cursor counter from parser as a long rather than int.

Doc updates.
2002-12-30 15:31:51 +00:00
Tom Lane a0fa0117a5 Better solution to integer overflow problem in hash batch-number
computation: reduce the bucket number mod nbatch.  This changes the
association between original bucket numbers and batches, but that
doesn't matter.  Minor other cleanups in hashjoin code to help
centralize decisions.
2002-12-30 15:21:23 +00:00
Bruce Momjian e533e7dcf5 Add missing slash to python install path. 2002-12-30 05:06:50 +00:00
Tom Lane 500ba40915 Point does not return a center of lseg.
Kenji Sugita
2002-12-30 02:18:29 +00:00
Tom Lane b33265e9e6 Adjust hash table sizing algorithm to avoid integer overflow in
ExecHashJoinGetBatch().  Fixes core dump on large hash joins, as in
example from Rae Stiening.
2002-12-29 22:28:50 +00:00
Tom Lane a8a820668a Deliver better error message when a relation name is used in an expression.
Per report from Ian Barwick.
2002-12-27 20:06:19 +00:00
Tom Lane 6c08905d4c Remove overenthusiastic free'ing of comment dependencies; could lead to
core dump in pg_dump when dumping views having comments.  See bug #855.
2002-12-27 17:10:45 +00:00
Bruce Momjian 9a39ba4b0f Trivial patch to increase max_fsm_pages as per earlier discussion.
Philip Warner
2002-12-27 14:06:34 +00:00
Tom Lane f772e6cbf7 Clamp the output of estimate_hash_bucketsize() to a sane range;
per example from Bruno Wolff in which it produced a silly result.
2002-12-26 23:38:42 +00:00
Tom Lane 1dfbbd51e7 Don't try to free executor state of an InitPlan early --- this breaks
EXPLAIN ANALYZE.  (Premature optimization is the root of all evil?)
2002-12-26 22:37:42 +00:00
Bruce Momjian 572d95150e Update SSL error message for improper permissions. Backpatch to 7.3.X. 2002-12-23 22:19:00 +00:00
Dave Cramer 3daad2ae91 case sensitive updates by Kris Jurka 2002-12-23 16:12:36 +00:00
Tom Lane b222867534 pg_dump should consider information_schema to be a system schema.
Also, tweak -C option (emit CREATE DATABASE command) to emit encoding
name rather than encoding number, for consistency with pg_dumpall
and better cross-version portability.
2002-12-21 22:45:09 +00:00
Tom Lane f1f5978603 Fix possible buffer overrun in \d command: substr(..., 128) produces
a result of at most 128 chars, but that could be more than 128 bytes.
Also ensure we don't try to pfree uninitialized pointers during error
cleanup.
2002-12-21 01:07:07 +00:00
Dave Cramer e2ad5816e2 mike beachy's patch for statement handling 2002-12-20 14:10:34 +00:00
Dave Cramer 83feff3ee7 patch for null table in getPrimaryKeys 2002-12-20 13:15:53 +00:00
Tom Lane 6d6c9fd9a4 Cause planner to include costs of InitPlans in startup cost of parent
plan node.  Not sure why this oversight has persisted so long ...
2002-12-19 23:25:01 +00:00
Bruce Momjian abf6f48319 pgindent fe-connect.c --- done to make IPv6 patch easier to apply. 2002-12-19 19:30:24 +00:00
Bruce Momjian 2d663bbf0e Update RELEASE checklist. 2002-12-18 20:07:32 +00:00
PostgreSQL Daemon 750a0e676e From the SSL_CTX_new man page:
"SSLv23_method(void), SSLv23_server_method(void), SSLv23_client_method(void)

 A TLS/SSL connection established with these methods will understand the SSLv2,
 SSLv3, and TLSv1 protocol. A client will send out SSLv2 client hello messages
 and will indicate that it also understands SSLv3 and TLSv1. A server will
 understand SSLv2, SSLv3, and TLSv1 client hello messages. This is the best
 choice when compatibility is a concern."

This will maintain backwards compatibility for those us that don't use
TLS connections ...
2002-12-18 13:15:15 +00:00
Tom Lane 350260795a Update EvalPlanQual() to work with new executor memory management method.
It doesn't leak memory anymore ...
2002-12-18 00:14:47 +00:00
Tom Lane 689659764f Prevent core dump when ExecMarkPos is called before any tuples have been
retrieved.  This cannot happen in ordinary execution, but it can happen
under EvalPlanQual().
2002-12-18 00:14:24 +00:00
Tom Lane e5bdd8d6f8 Skip unnecessary plan-copying now that plan trees are read-only in the
executor.
2002-12-17 15:51:59 +00:00
Tom Lane 81ca457da8 Fix typo. 2002-12-17 15:45:01 +00:00
Tom Lane e932a724a4 To suppress memory leakage in long-lived Lists, lremove() should pfree
the cons cell it's deleting from the list.  Do this, and fix a few callers
that were bogusly assuming it wouldn't free the cons cell.
2002-12-17 01:18:35 +00:00
Tom Lane 9f76d0d926 Fix GEQO to work again in CVS tip, by being more careful about memory
allocation in best_inner_indexscan().  While at it, simplify GEQO's
interface to the main planner --- make_join_rel() offers exactly the
API it really wants, whereas calling make_rels_by_clause_joins() and
make_rels_by_clauseless_joins() required jumping through hoops.
Rewrite gimme_tree for clarity (sometimes iteration is much better than
recursion), and approximately halve GEQO's runtime by recognizing that
tours of the forms (a,b,c,d,...) and (b,a,c,d,...) are equivalent
because of symmetry in make_join_rel().
2002-12-16 21:30:30 +00:00
Tom Lane 260faf0b63 Fix ALTER TABLE ADD COLUMN to disallow the same column types that are
disallowed by CREATE TABLE (eg, pseudo-types); also disallow these types
from being introduced by the range-function syntax.  While at it, allow
CREATE TABLE to create zero-column tables, per recent pghackers discussion.
I am back-patching this into 7.3 since failure to disallow pseudo-types
is arguably a security hole.
2002-12-16 18:39:22 +00:00
Tom Lane 88177f77b1 Code review for palloc0 patch --- avoid dangerous and unnecessary
practice of evaluating MemSet's arguments multiple times, except for
the special case of newNode(), where we can assume the argument is
a constant sizeof() operator.
Also, add GetMemoryChunkContext() to mcxt.c's API, in preparation for
fixing recent GEQO breakage.
2002-12-16 16:22:46 +00:00
Tom Lane e64c7feb2f Tweak default memory context allocation policy so that a context is not
given any malloc block until something is first allocated in it; but
thereafter, MemoryContextReset won't release that first malloc block.
This preserves the quick-reset property of the original policy, without
forcing 8K to be allocated to every context whether any of it is ever
used or not.  Also, remove some more no-longer-needed explicit freeing
during ExecEndPlan.
2002-12-15 21:01:34 +00:00
Tom Lane 5bab36e9f6 Revise executor APIs so that all per-query state structure is built in
a per-query memory context created by CreateExecutorState --- and destroyed
by FreeExecutorState.  This provides a final solution to the longstanding
problem of memory leaked by various ExecEndNode calls.
2002-12-15 16:17:59 +00:00
Bruce Momjian c465dcc1d0 Add major/minor release changes info to RELEASE_CHANGES file. 2002-12-14 19:45:46 +00:00
Bruce Momjian c78701697c The actual segfault was caused by a double pfree(), but ISTM that
failing to find pg_hba.conf should be a fatal error anyway, so I
increased the priority of the elog() from LOG to FATAL and refactored
the code a little bit.

Neil Conway
2002-12-14 18:49:37 +00:00
Bruce Momjian fb2d7a24f9 Ok, I think I've gotten this figured out now. I saw this comment in
pqcomm.c, switched the ERROR logs to COMMERROR logs and it all works.
I've attached a patch to be-secure.c that fixes all my problems.

Nathan Mueller
2002-12-14 18:39:14 +00:00
Peter Eisentraut 1b42ad7e59 Initial version of the SQL information schema 2002-12-14 00:24:35 +00:00
Tom Lane 2d8d66628a Clean up plantree representation of SubPlan-s --- SubLink does not appear
in the planned representation of a subplan at all any more, only SubPlan.
This means subselect.c doesn't scribble on its input anymore, which seems
like a good thing; and there are no longer three different possible
interpretations of a SubLink.  Simplify node naming and improve comments
in primnodes.h.  No change to stored rules, though.
2002-12-14 00:17:59 +00:00
Bruce Momjian 29cdab3d53 Increment libpq major number for 7.3.1 and minor for 7.4. 2002-12-13 22:17:57 +00:00
Tom Lane 3145cbc14f Admit defeat on the prospect of keeping straight exactly which platforms
produce which output in the geometry test, even with the problem narrowed
down to only whether they print minus zero or not.  Instead, use
pg_regress' locale-variant mechanism to automatically consider the test
to pass if it matches either supplied comparison file.  geometry_1.out
replaces the former geometry-positive-zeros.out.
2002-12-13 20:35:57 +00:00
Bruce Momjian 88d639e6e8 Protect from null param on ecpg disconnect, verified by Roland Karch 2002-12-13 20:29:07 +00:00
Tom Lane 0f8e9b4d74 Add a basic regression test for IS DISTINCT FROM, which has spent way too
much time in a broken state for lack of anyone noticing.
2002-12-13 20:16:11 +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
Tom Lane 77b7a740f9 Adjust costsize calculations to avoid introducing unnecessary roundoff
error.  This seems to explain the differing choice of plan that's been
causing geometry regress test to fail for the last few days.
2002-12-13 17:29:25 +00:00
Bruce Momjian 023ff17178 Remove strerror output for openssl SYSCALL error check. 2002-12-13 05:51:29 +00:00
Bruce Momjian 1b706651b6 Here's the patch I mentioned on HACKERS to fix up ALTER command tab
completion. Note that it's based on 7.3 tarball, not CVS HEAD, or 7.3rel
branch. Damn, looking at CVS, this will patch into 7.3rel (just tested,
it does) probably collide with Rod Taylor's patch adding ALTER TRIGGER
stuff. O.K, second patch attached against HEAD - not tested, hand
merged.

Ross Reedstrom
2002-12-13 05:36:24 +00:00
Bruce Momjian d274105942 > There is an ugly little problem with the DB wrapper class.
>
> In pg.py the attributes of DB are defined as being the same as
> the attributes of the corresponding pgobject "db", using the following

...

> The problem is that the attributes of db (which are read only)
> are not static (they are actually function calls to PostgreSQL),
> especially "status" and "error", but those attributes are copied
> and this is done only once when initializing the DB object.
>
> So, in effect, only the attribute "db.error" of a DB instance
> will be updated, but not the attribute "error". Same with "status".


> Don't copy the (read only) attributes of the pgobject to the
> DB object, but only the methods, and all of them, like this:
>
> --------------- change in pg.py ------------------
> # Create convience methods, in a way that is still overridable.
> for e in self.db.__methods__:
>  setattr(self, e, getattr(self.db, e))
> ----------------------------------------------------
>
> Furthermore, make an addition to the documentation of the
> DB wrapper class (i.e. in pygresql-pg-db.html):
> After the sentence "All pgobject methods are included in this class also."
> add the following sentence "The pgobject read-only attributes can be
> accessed py adding the prefix 'db.' to them."

Christoph Zwerschke
2002-12-12 22:49:27 +00:00
Bruce Momjian 482ed836f7 Check SSL_get_error() value SSL_ERROR_SYSCALL to see if SSL_read()
returned -1, per SSL_get_error() documentation.

Nathan Mueller
2002-12-12 22:42:39 +00:00
Bruce Momjian 5587f077ab While porting my TPC-C implementation from Oracle, I discovered the
attached problem with the EXEC SQL COMMIT RELEASE statement.

Roland Karch
2002-12-12 21:50:01 +00:00
Tom Lane b73251686f Don't produce bogus COPY command when there are no undropped columns
in a table.
2002-12-12 21:03:24 +00:00
Bruce Momjian 40c4472e22 TODO marked as done:
* Add schema, cast, and conversion backslash commands to psql

I had to create a new publically available function,
pg_conversion_is_visible, as it seemed to be missing from the catalogs.
This required me to do no small amount of hacking around in namespace.c

I have updated the \? help and sgml docs.

\dc - list conversions [PATTERN]
\dC - list casts
\dn list schemas

I didn't support patterns with casts as there's nothing obvious to match
against.

Catalog version incremented --- initdb required.

Christopher Kings-Lynne
2002-12-12 21:02:25 +00:00
Tom Lane 4ad0aa3efb Don't force rebuild of all of backend/parser when we only need
keywords.o.
2002-12-12 21:02:00 +00:00
Tom Lane b0422b215c Preliminary code review for domain CHECK constraints patch: add documentation,
make VALUE a non-reserved word again, use less invasive method of passing
ConstraintTestValue into transformExpr, fix problems with nested constraint
testing, do correct thing with NULL result from a constraint expression,
remove memory leak.  Domain checks still need much more work if we are going
to allow ALTER DOMAIN, however.
2002-12-12 20:35:16 +00:00
Tom Lane ff7349694f Guard against overrunning CTZName buffer when TZ is bogus. 2002-12-12 19:16:55 +00:00
Tom Lane a0bf885f9e Phase 2 of read-only-plans project: restructure expression-tree nodes
so that all executable expression nodes inherit from a common supertype
Expr.  This is somewhat of an exercise in code purity rather than any
real functional advance, but getting rid of the extra Oper or Func node
formerly used in each operator or function call should provide at least
a little space and speed improvement.
initdb forced by changes in stored-rules representation.
2002-12-12 15:49:42 +00:00
Bruce Momjian b7ebebea1e Move psql \? Formatting above Large Object/Copy. 2002-12-11 23:07:06 +00:00
Bruce Momjian c4a7e5dd9f psql \? rearrangement, suggested by Tom. 2002-12-11 23:03:45 +00:00
Bruce Momjian 721dd19212 Reorder psql \? help into groupings, idea from Harald Armin Massa. 2002-12-11 22:45:13 +00:00
Bruce Momjian dc8d322a8b Mark SCO Openserver 5.0.4. supported by 7.3.1 as per chat report from user.
template/sco updated.
2002-12-11 22:27:26 +00:00
Bruce Momjian 92d77c69e5 Fix line count error reporting in config files, like pg_hba.conf, per
report from Oliver Elphick.

Backpatch to 7.3.
2002-12-11 22:17:11 +00:00
Dave Cramer d9d59ca65e patch for getTables to fix problems with backends before 7.3 by Kris Jurka 2002-12-11 21:02:58 +00:00
Dave Cramer 58eeb82cf8 Mike Beachy's build patch to allow ant builds without make 2002-12-11 12:29:13 +00:00
Dave Cramer a905eaacf0 Aaron's patch for Pooled Connections 2002-12-11 11:42:14 +00:00
Bruce Momjian 0046d80b97 Back out psql help change. Not done yet. 2002-12-11 04:09:51 +00:00
Bruce Momjian 6ca16d7b80 Bump version for 7.3 and 7.4. 2002-12-11 04:07:39 +00:00
Tom Lane 5435944e23 Reverse out unintended resultmap change. 2002-12-10 18:23:12 +00:00
Tom Lane 53f275b9e5 If typecmds is going to have its own header file, said header file
should include what it needs.
2002-12-10 16:12:53 +00:00
D'Arcy J.M. Cain be134e9dc4 Add an unnecessary assignment to remove a bogus warning. I checked the
logic carefully and I am sure that the test against n happens after it
is assigned to.
2002-12-10 11:43:44 +00:00
Tom Lane 9ee4891570 Some quick fixes for ALTER DOMAIN patch. It still needs a lot of work,
but at least it doesn't generate gcc warnings.
2002-12-09 20:31:05 +00:00
Peter Eisentraut 4ed6be54e2 Fix Latin9/Unicode conversion by selecting the right table. 2002-12-09 19:47:21 +00:00
Tom Lane 780651d09c Update obsolete comment. 2002-12-09 18:21:43 +00:00
Tom Lane d6161ba7ec Explain's code for showing quals of SubqueryScan nodes has been broken
all along; not noticed till now.  It's a scan not an upper qual ...
2002-12-06 19:28:03 +00:00
Bruce Momjian e87e82d2b7 Attached are two small patches to expose md5 as a user function -- including
documentation and regression test mods. It seemed small and unobtrusive enough
to not require a specific proposal on the hackers list -- but if not, let me
know and I'll make a pitch. Otherwise, if there are no objections please apply.

Joe Conway
2002-12-06 05:20:28 +00:00
Bruce Momjian 05a6b37912 Re-addd Rod's ALTER DOMAIN patch. 2002-12-06 05:00:34 +00:00
Bruce Momjian 38ffbb95d5 Back out V6 code, caused postmaster startup failure. 2002-12-06 04:37:05 +00:00
Bruce Momjian 4bfd1ad9e0 Add missing v6utils file. 2002-12-06 04:18:11 +00:00
Bruce Momjian 3bf160131d Updated IPv6 patch to fix netmask. 2002-12-06 03:49:19 +00:00
Bruce Momjian 8fc86dd593 We have just finished porting the old KAME IPv6 patch over to
postgresql version 7.3, but yea... this patch adds full IPv6
support to postgres. I've tested it out on 7.2.3 and has
been running perfectly stable.

CREDITS:
 The KAME Project  (Initial patch)
 Nigel Kukard  <nkukard@lbsd.net>
 Johan Jordaan  <johanj@lando.co.za>
2002-12-06 03:46:37 +00:00
Bruce Momjian 5b4c16e099 Back out ALTER DOMAIN patch until missing file appears. 2002-12-06 03:43:35 +00:00
Bruce Momjian 853153ca6d ALTER DOMAIN .. SET / DROP NOT NULL
ALTER DOMAIN .. SET / DROP DEFAULT
ALTER DOMAIN .. ADD / DROP CONSTRAINT

New files:
- doc/src/sgml/ref/alter_domain.sgml

Rod Taylor
2002-12-06 03:28:34 +00:00
Bruce Momjian 36580c8e21 PyGreSQL inserttable patch
=====================

I suggested an improvement of the inserttable in the PyGreSQL interface
already in January, but seemingly it was never implemented. I was told this
is the right place to get patches in for PyGreSQL, so I'm reposting my patch
here.

I consider the inserttable methode essential in populating the database
because of its benefits in performance compared to insert, so I think this
patch is quite essential. The attachment is an improved version of the
corresponding pg_inserttable function in pgmodule.c, which fixes the
following problems:

* The function raised exceptions because PyList_GetItem was used beyond the
size of the list. This was checked by comparing the result with NULL, but
the exception was not cleaned up, which could result in mysterious errors in
the following Python code. Instead of clearing the exception using
PyErr_Clear or something like that, I avoided throwing the exception at all
by at first requesting the size of the list. Using this opportunity, I also
checked the uniformity of the size of the rows passed in the lists/tuples.
The function also accepts (and silently ignores) empty lists and sublists.
* Python "None" values are now accepted and properly converted to PostgreSQL
NULL values
* The function now generates an error message in case of a line buffer
overflow
* It copes with tabulators, newlines and backslashes in strings now
* Rewrote the buffer filling code which should now run faster by avoiding
unnecessary string copy operations forth and back

Christoph Zwerschke
2002-12-06 03:19:28 +00:00
Bruce Momjian ceab6f7283 As far as I figured from the source code this function only deals with
cleaning up locale names and nothing else. Since all the locale names
are in plain  ASCII I think it will be safe to use ASCII-only lower-case
conversion.

Nicolai Tufar
2002-12-05 23:21:07 +00:00
Tom Lane a2e8e15dd4 localbuf.c must be able to do blind writes. 2002-12-05 22:48:03 +00:00
Tom Lane 993b145d7f Avoid pulling up sublinks from a subselect's targetlist. Works around
problems that occur if sublink is referenced via a join alias variable.
Perhaps this can be improved later, but a simple and safe fix is needed
for 7.3.1.
2002-12-05 21:46:37 +00:00
Bruce Momjian f7a3d742df Clearify variables names so it is clear which variable is the
client-supplied password and which is from pg_shadow.
2002-12-05 18:52:43 +00:00
Bruce Momjian 44ab596b01 Allow 'password' encryption even when pg_shadow has MD5 passwords, per
report from Terry Yapt and Hiroshi.

Backpatch to 7.3.
2002-12-05 18:39:43 +00:00
Tom Lane 1fd0c59e25 Phase 1 of read-only-plans project: cause executor state nodes to point
to plan nodes, not vice-versa.  All executor state nodes now inherit from
struct PlanState.  Copying of plan trees has been simplified by not
storing a list of SubPlans in Plan nodes (eliminating duplicate links).
The executor still needs such a list, but it can build it during
ExecutorStart since it has to scan the plan tree anyway.
No initdb forced since no stored-on-disk structures changed, but you
will need a full recompile because of node-numbering changes.
2002-12-05 15:50:39 +00:00
Bruce Momjian 23e88e25d6 Document get/set bit/byte functions. 2002-12-05 04:38:30 +00:00
Bruce Momjian 7816c7cb94 More cleanup of userid to be AclId rather than Oid. 2002-12-05 04:04:51 +00:00
Dave Cramer caaf941070 changed sort of column names to sort by attnum, not attname 2002-12-05 01:11:43 +00:00
Tom Lane 53e2b794f9 Repair oversight in recent change of dependency extraction code: when
recursing to handle a join alias var, the context had better be set to
be appropriate to the join var's query level.  Per report from Hristo Neshev.
2002-12-04 20:00:37 +00:00
Bruce Momjian 5cdf45c6aa Stamp minor version numbers for 7.4 release. 2002-12-04 18:14:11 +00:00
D'Arcy J.M. Cain e3d7c9ba54 Remove typprtlen from getdescr() as it is not available in 7.3. Return -1 for
that field so that existing programs don't break.
2002-12-04 12:23:42 +00:00
Bruce Momjian 93902e9521 Make usesysid consistently int4, not oid.
Catalog patch from Alvaro Herrera for same.

catversion updated. initdb required.
2002-12-04 05:18:38 +00:00
Bruce Momjian 6f0ebe3fba Deal with cases where getpeereid _and_ another creditial method is
supported.
2002-12-03 22:09:20 +00:00
Bruce Momjian f988edb4e1 Add OpenBSD local indent credentials, from William Ahern. 2002-12-03 21:50:44 +00:00
Tom Lane 2802668159 Repair core dump when trying to delete an entry from an already-NULL
datconfig or useconfig field.  Per report from Dustin Sallings.
2002-12-02 05:20:47 +00:00
Tom Lane 8e3a87fbd4 Teach planner to expand sufficiently simple SQL-language functions
('SELECT expression') inline, like macros, during the constant-folding
phase of planning.  The actual expansion is not difficult, but checking
that we're not changing the semantics of the call turns out to be more
subtle than one might think; in particular must pay attention to
permissions issues, strictness, and volatility.
2002-12-01 21:05:14 +00:00
Tom Lane 02f8c9a382 Fix ExecMakeTableFunctionResult() to work with generic expressions as
well as function calls.  This is needed for cases where the planner has
constant-folded or inlined the original function call.  Possibly we should
back-patch this change into 7.3 branch as well.
2002-12-01 20:27:32 +00:00
Tom Lane 9ee7409ef7 Fix pg_dump failure against 7.1 or older servers, per
report from Philip Warner.
2002-12-01 18:44:00 +00:00
Tom Lane 3a18f01b7a Run COPY OUT in a temporary memory context that's reset once per row,
and eliminate its manual pfree() calls.  This solves the encoding-conversion
bug recently reported, and should be faster and more robust than the
original coding anyway.  For example, we are no longer at risk if
datatype output routines leak memory or choose to return a constant string.
2002-12-01 18:14:22 +00:00
Tom Lane 2b7ec402c4 Code review for IS DISTINCT FROM patch. Fix incorrect constant-folding
logic, dissuade planner from thinking that 'x IS DISTINCT FROM 42' may
be optimized into 'x = 42' (!!), cause dependency on = operator to be
recorded correctly, minor other improvements.
2002-11-30 21:25:08 +00:00
Tom Lane 36c356e799 Missed one place that can be simplified after recent Param/Const cleanup. 2002-11-30 18:28:49 +00:00
Tom Lane 935969415a Be more realistic about plans involving Materialize nodes: take their
cost into account while planning.
2002-11-30 05:21:03 +00:00
Tom Lane ddb2d78de0 Upgrade planner and executor to allow multiple hash keys for a hash join,
instead of only one.  This should speed up planning (only one hash path
to consider for a given pair of relations) as well as allow more effective
hashing, when there are multiple hashable joinclauses.
2002-11-30 00:08:22 +00:00
Tom Lane f68f11928d Tighten selection of equality and ordering operators for grouping
operations: make sure we use operators that are compatible, as determined
by a mergejoin link in pg_operator.  Also, add code to planner to ensure
we don't try to use hashed grouping when the grouping operators aren't
marked hashable.
2002-11-29 21:39:12 +00:00
Tom Lane 851a4c48fd Repair prehistoric logic error in lseg_eq and lseg_ne. 2002-11-29 19:25:33 +00:00
Tom Lane 0a013c843b Suppress compiler warning from newer gcc. 2002-11-29 19:03:01 +00:00
Bruce Momjian 3026493ff2 This patch fixes two tiny memory leaks in pg_dump and two in pg_dumpall.
Neil Conway
2002-11-29 16:38:42 +00:00
Tom Lane 73235a19cf Improve some comments. 2002-11-27 20:52:04 +00:00
Michael Meskes b4e334b6e6 Synced parser with backend 2002-11-27 08:30:27 +00:00
Bruce Momjian 80e6d99731 Add -cmdTuples to tcl interface. 2002-11-26 21:38:49 +00:00
Tom Lane ea0b5c8569 Use Params, rather than run-time-modified Const nodes, to handle
sublink results and COPY's domain constraint checking.  A Const that
isn't really constant is just a Bad Idea(tm).  Remove hacks in
parse_coerce and other places that were needed because of the former
klugery.
2002-11-26 03:01:59 +00:00
Tatsuo Ishii ac47950238 Guard against 0 length string encoding conversion case. 2002-11-26 02:22:29 +00:00
Bruce Momjian 9645fa8ccd Remove check for pg_group file as part of initdb -W password assignment
--- not needed.
2002-11-25 21:41:46 +00:00
Tom Lane f893ee271f Remove unused constisset and constiscast fields of Const nodes. Clean
up code and documentation associated with Param nodes.
2002-11-25 21:29:42 +00:00
Tom Lane dbe100c402 Restructure outfuncs and readfuncs to use macros in the same style as
just done for copyfuncs/equalfuncs.  Read functions in particular get
a lot shorter than before, and it's much easier to compare an out function
with the corresponding read function to make sure they agree.
initdb forced due to small changes in nodestring format (regularizing
a few cases that were formerly idiosyncratic).
2002-11-25 18:12:12 +00:00
Tom Lane 0aa5b6866e Un-break triggers declared for INSERT OR DELETE OR UPDATE. This worked
okay in 7.3, so I think it must have been busted in the recent triggers
patch.
2002-11-25 03:36:50 +00:00
Tom Lane 2eafcf68d5 Restructure the code in copyfuncs and equalfuncs to put much heavier
reliance on macros, in hopes of eliminating silly typos (like copying
to the wrong field) and just generally making it easier to see the forest
instead of the trees.  As an example, here is the new code for A_Indices:

static A_Indices *
_copyAIndices(A_Indices *from)
{
	A_Indices  *newnode = makeNode(A_Indices);

	COPY_NODE_FIELD(lidx);
	COPY_NODE_FIELD(uidx);

	return newnode;
}

static bool
_equalAIndices(A_Indices *a, A_Indices *b)
{
	COMPARE_NODE_FIELD(lidx);
	COMPARE_NODE_FIELD(uidx);

	return true;
}

I plan to redo outfuncs/readfuncs in a similar style, but am committing
what I've got.
2002-11-25 03:33:27 +00:00
D'Arcy J.M. Cain 200dd8e3f8 I'm sending you a small patch to pgdb.py module. This
raises pgdb.DatabaseError when any of the fetch*
methods was invoked but previous call to execute* did
not produce any result set or no call was issued yet.
Also, raises pgdb.NotSupportedError when .nextset() is
invoked, instead of NameError.

This behaviour complies with DB-API 2.0.

Thanks for your work!

Timur Irmatov.
2002-11-25 03:11:15 +00:00
D'Arcy J.M. Cain a4bc5eeef2 Change the pkey method so that the caller can optionally set the dictionary
used for the primary key lookup.  This will prevent a database lookup
for each connection object that gets created.  This could be a significant
optimization on a busy system.

Similarly, the get_attnames method allows for the attributes dictionary
to be installed directly.
2002-11-25 02:15:13 +00:00
D'Arcy J.M. Cain f393ee0680 Change the debug variable to allow better control by the caller over how
debug output is managed.  The user can continue to use the current method
of passing a formatting string to have a replacement done and output will
be sent to the standard output exactly as it did before.  In addition they
can set it to a file object, sys.stderr for example, and the query string
will be printed to it.  Thay can also set it to a method (function) and the
query string will be passed to that method giving them the maximum flexibility
to do whatever they want with the query string.

I will be working with the PyGreSQL documentation shortly and at that time
will properly document this feature.
2002-11-25 01:28:32 +00:00
Tom Lane 04c8785c7b Restructure planning of nestloop inner indexscans so that the set of usable
joinclauses is determined accurately for each join.  Formerly, the code only
considered joinclauses that used all of the rels from the outer side of the
join; thus for example
	FROM (a CROSS JOIN b) JOIN c ON (c.f1 = a.x AND c.f2 = b.y)
could not exploit a two-column index on c(f1,f2), since neither of the
qual clauses would be in the joininfo list it looked in.  The new code does
this correctly, and also is able to eliminate redundant clauses, thus fixing
the problem noted 24-Oct-02 by Hans-Jürgen Schönig.
2002-11-24 21:52:15 +00:00
Tom Lane c3637205b2 Fix regression test breakage from triggers patch. 2002-11-23 18:42:37 +00:00
Tom Lane 4c61c827d3 Fix compile warnings from truncate patch. 2002-11-23 18:26:45 +00:00
Bruce Momjian 17d938320d Update regression for new patches. Bump up catversion. 2002-11-23 18:13:22 +00:00
Bruce Momjian f9e23827b0 Heres a patch which will create the sql_help.h file on Win32 if it
doesn't already exist using an installed copy of perl. I've tested it
using perl v5.6.1 from ActiveState and all appears to work.

Al Sutton
2002-11-23 04:06:32 +00:00
Bruce Momjian d46f3de363 Transaction safe Truncate
Rod Taylor
2002-11-23 04:05:52 +00:00
Bruce Momjian 1b7f3cc02d This patch implements FOR EACH STATEMENT triggers, per my email to
-hackers a couple days ago.

Notes/caveats:

        - added regression tests for the new functionality, all
          regression tests pass on my machine

        - added pg_dump support

        - updated PL/PgSQL to support per-statement triggers; didn't
          look at the other procedural languages.

        - there's (even) more code duplication in trigger.c than there
          was previously. Any suggestions on how to refactor the
          ExecXXXTriggers() functions to reuse more code would be
          welcome -- I took a brief look at it, but couldn't see an
          easy way to do it (there are several subtly-different
          versions of the code in question)

        - updated the documentation. I also took the liberty of
          removing a big chunk of duplicated syntax documentation in
          the Programmer's Guide on triggers, and moving that
          information to the CREATE TRIGGER reference page.

        - I also included some spelling fixes and similar small
          cleanups I noticed while making the changes. If you'd like
          me to split those into a separate patch, let me know.

Neil Conway
2002-11-23 03:59:09 +00:00
Tom Lane e760d22391 Redesign internal logic of nodeLimit so that it does not need to fetch
one more row from the subplan than the COUNT would appear to require.
This costs a little more logic but a number of people have complained
about the old implementation.
2002-11-22 22:10:01 +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
Tom Lane 1f79360907 Quote database name properly when invoking pg_dump. Per report from
Christopher Kings-Lynne.
2002-11-22 03:09:43 +00:00
Tom Lane fadcb01177 TAS code originally written for s390 (32-bit) does not work for s390x
(64-bit).  Fix it.  Per report from Permaine Cheung.
2002-11-22 01:13:16 +00:00
Tom Lane 75394d3f5b Fix breakage in new-in-7.3 timetz_zone() function: was giving random
results due to doing arithmetic on uninitialized values.  Add some
documentation about the AT TIME ZONE construct.  Update some other
date/time documentation that seemed out of date for 7.3.
2002-11-21 23:31:20 +00:00
Tom Lane ca1d1b79ab Wups, stuck ORDER BY on wrong query while trying to eliminate random
ordering of GROUP BY output due to hash-based aggregation.
2002-11-21 22:26:02 +00:00