Commit Graph

10837 Commits

Author SHA1 Message Date
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
Tom Lane 8362be35e8 Code review for superuser_reserved_connections patch. Don't try to do
database access outside a transaction; revert bogus performance improvement
in SIBackendInit(); improve comments; add documentation (this part courtesy
Neil Conway).
2002-11-21 06:36:08 +00:00
Tom Lane 02d83d7565 NetBSD versions 1.6 and (we hope) later can use the standard geometry
comparison file, instead of geometry-positive-zeros.  Per report from
Patrick Welche.
2002-11-21 04:40:26 +00:00
Tom Lane 6c1d4662af Finish implementation of hashed aggregation. Add enable_hashagg GUC
parameter to allow it to be forced off for comparison purposes.
Add ORDER BY clauses to a bunch of regression test queries that will
otherwise produce randomly-ordered output in the new regime.
2002-11-21 00:42:20 +00:00
Barry Lind 1b80e0122f Fix a dumb cut and paste error from my last commit and update some of the
jdbc3 metadata responses

 Modified Files:
 	jdbc/org/postgresql/jdbc2/AbstractJdbc2Statement.java
 	jdbc/org/postgresql/jdbc3/AbstractJdbc3DatabaseMetaData.java
2002-11-20 20:37:53 +00:00
Barry Lind 54bc3b6b8b Fixed bug reported by Marko Strukelj and Keith Wannamaker. Using executeBatch
on a preparedStatement would reset the prepared statment causing subsequent
uses of the preparedStatement to fail (i.e. the following series of calls
would fail: addBatch() executeBatch() addBatch() executBatch()).  This is
a regression from 7.2 where this worked correctly.  The regression test has
also been modified to explicitly test for this case.

 Modified Files:
 	jdbc/org/postgresql/jdbc1/AbstractJdbc1Statement.java
 	jdbc/org/postgresql/jdbc2/AbstractJdbc2Statement.java
 	jdbc/org/postgresql/test/jdbc2/BatchExecuteTest.java
2002-11-20 07:34:32 +00:00
Tom Lane b60be3f2f8 Add an at-least-marginally-plausible method of estimating the number
of groups produced by GROUP BY.  This improves the accuracy of planning
estimates for grouped subselects, and is needed to check whether a
hashed aggregation plan risks memory overflow.
2002-11-19 23:22:00 +00:00
Bruce Momjian 988dbc58a2 Update regression for ALL missing from CLUSTER. 2002-11-19 17:39:00 +00:00
Bruce Momjian af26857a27 Most of the code follows the American spelling of the word, which is
"canceled", so I changed the one remaining usage of the British
spelling ("cancelled") over to the former, and updated the translation
files appropriately.

Neil Conway
2002-11-19 17:21:40 +00:00
Bruce Momjian c4501ec551 Remove ALL from CLUSTER ALL. Use just CLUSTER. 2002-11-18 17:12:07 +00:00
Tom Lane 17ac74797a Put back error test for DECLARE CURSOR outside a transaction block ...
but do it correctly now.
2002-11-18 01:17:39 +00:00
Tom Lane 810f2cfa32 Suppress compile warning, avoid possible problems with signed vs. unsigned
comparisons in recently-added CheckPointWarning code.
2002-11-18 00:40:46 +00:00
Tom Lane 8fbef3b55d Reduce need for palloc/pfree overhead in varstr_cmp() by using fixed-size
buffers on stack for short strings.
2002-11-17 23:01:30 +00:00
Bruce Momjian 00e59b5ec2 Fix CLUSTER regression failure caused by new patch, from Neil Conway 2002-11-16 03:25:22 +00:00
Tom Lane 24b130cb89 Add relcache support for system catalogs with attnotnull columns.
The code was not making TupleConstr structs for such catalogs in
several places; with the consequence that the not-null constraint
wasn't actually enforced.  With this change,
INSERT INTO pg_proc VALUES('sdf');
generates a 'Fail to add null value' error instead of a core dump.
2002-11-15 17:18:49 +00:00
Michael Meskes 4bc3598aa4 Synced parser. 2002-11-15 15:47:44 +00:00
Bruce Momjian 8bc717cb88 New version attached. The following is implemented:
- CLUSTER ALL clusters all the tables that have some index with
  indisclustered set and the calling user owns.
- CLUSTER tablename clusters the named table, using the index with
  indisclustered set.  If no index has the bit set, throws elog(ERROR).
- The multi-relation version (CLUSTER ALL) uses a multitransaction
  approach, similar to what VACUUM does.

Alvaro Herrera
2002-11-15 03:09:39 +00:00
Bruce Momjian 5b7eb4dd45 Clean up psql:
Add simple ALTER DATABASE, ALTER TRIGGER, CHECK POINT, CREATE
CONVERSION, CREATE DOMAIN, CREATE LANGUAGE, DEALLOCATE, DROP CONVERSION,
DROP DOMAIN, DROP LANGUAGE, EXECUTE, PREPARE

Complete CAST in CREATE CAST and DROP CAST but doesn't suggest what
should follow.

Add many more SET / SHOW variables to the list.  Taken from SHOW ALL
output.

Complete a case sensitive search to allow \dD, \dd, \dS, \ds, \h, \H to
complete properly.  But there are no matches, then try a case
insensitive search to allow case conversion.  Add all missing help
options.

\Q<tab>    -> \q
\dD<tab>   -> \dD
\dd<tab>   -> \dd
\D<tab><tab><tab> -> \d (with listing of \d? commands)
sel<tab>   -> SELECT

Rod Taylor
2002-11-15 03:07:52 +00:00
Bruce Momjian 93e54678a3 pg_dump for domain constraints.
Rod Taylor
2002-11-15 02:52:18 +00:00
Bruce Momjian 6b603e67dc Add DOMAIN check constraints.
Rod Taylor
2002-11-15 02:50:21 +00:00
Bruce Momjian 2986aa6a66 Add checkpoint_warning to warn of excessive checkpoints caused by too
few WAL files.
2002-11-15 02:44:57 +00:00
Tom Lane 3779f7fd9f Push qual clauses containing subplans to the back of the qual list
at each plan node.  Per gripe from Ross Reedstrom.
2002-11-15 02:36:53 +00:00
Bruce Momjian c948a3f4b8 Rename hostname_lookup to log_hostname. 2002-11-15 01:57:28 +00:00
Bruce Momjian aead49667b Rename show_source_port to log_source_port. 2002-11-15 01:40:20 +00:00
Bruce Momjian 559b6c7ced Rename show_btree_build_stats to log_btree_build_stats 2002-11-15 01:26:09 +00:00
Bruce Momjian d36aa2e885 Rename:
! #show_parser_stats = false
! #show_planner_stats = false
! #show_executor_stats = false
! #show_statement_stats = false

TO:

! #log_parser_stats = false
! #log_planner_stats = false
! #log_executor_stats = false
! #log_statement_stats = false
2002-11-15 00:47:22 +00:00
Bruce Momjian 001d5a7aa5 Rename server_min_messages to log_min_messages. Part of consolidation
of log_ settings.
2002-11-14 23:53:27 +00:00
Tom Lane 89caf56b86 Fix planning bug introduced in recent code reorganization for hashed
aggregates: tuple_fraction has to be adjusted before passing it to
compare_fractional_path_costs().
2002-11-14 19:00:36 +00:00
Barry Lind cfae07331c Applied patch submitted by Mats Lofkvist fixing serious threading problem introduced in beta3.
Fixed bug with using setNull()(or setXXX(x, null))  and serverside prepare statements.
Improved error message when using a connection object that has already been closed.


 Modified Files:
 	jdbc/org/postgresql/errors.properties
 	jdbc/org/postgresql/core/Encoding.java
 	jdbc/org/postgresql/core/QueryExecutor.java
 	jdbc/org/postgresql/jdbc1/AbstractJdbc1Connection.java
 	jdbc/org/postgresql/jdbc1/AbstractJdbc1Statement.java
2002-11-14 05:35:45 +00:00
Bruce Momjian 0326dd76aa There was an error in the gcc portion of the patch I sent you. Here is
the  fix.

Billy G. Allie
2002-11-14 04:07:27 +00:00
Tom Lane 6fbe58ce79 Allow +1300 as a numeric timezone specifier; we already accept FJST as meaning +1300. 2002-11-13 17:24:05 +00:00
Tom Lane d45cfb4b0b Use cat instead of echo or awk, to avoid portability problems with backslashes. 2002-11-13 16:40:23 +00:00
Bruce Momjian 63e9734542 Update xact.c comments for clarity. 2002-11-13 03:12:05 +00:00
Bruce Momjian 4e5a947d1c Make MOVE/FETCH 0 actually move/fetch 0. Add MOVE LAST to move to end
of cursor.
2002-11-13 00:44:09 +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 aaa3a0caa6 Split MemSet into three parts to constant comparisons can be optimized
away by the compiler;  used by palloc0.
2002-11-13 00:37:06 +00:00
Tom Lane 4ee5fa3c74 Update AIX resultmap for horology tests, per Andreas. 2002-11-12 20:02:32 +00:00
Tom Lane 6929a1e6ad Improve comment: add note that grotty special case in mdread() is
required by hash index implementation.
2002-11-12 15:26:30 +00:00
Tatsuo Ishii 90a06dba16 Fix broken GB18030 <--> UTF-8 conversion map 2002-11-12 11:33:40 +00:00
Tom Lane 5eb6de5991 Remove NO_MKTIME_BEFORE_1970. I had speculated that it was not needed
anymore given the mktime() workaround now done in DetermineLocalTimeZone.
This has now been confirmed by Robert Bruccoleri for Irix, and I'm going
to extrapolate to AIX as well.
2002-11-12 00:39:08 +00:00
Tom Lane f9b5b41ef9 Code review for ON COMMIT patch. Make the actual on-commit action happen
before commit, not after :-( --- the original coding is not only unsafe
if an error occurs while it's processing, but it generates an invalid
sequence of WAL entries.  Resurrect 7.2 logic for deleting items when
no longer needed.  Use an enum instead of random macros.  Editorialize
on names used for routines and constants.  Teach backend/nodes routines
about new field in CreateTable struct.  Add a regression test.
2002-11-11 22:19:25 +00:00
Barry Lind 5ec61f4d2b Fixes bug where join to pg_description was incorrect. Also modifies the
regression test to test for this case.  Patch submitted by Kris Jurka.

 Modified Files:
 	jdbc/org/postgresql/jdbc1/AbstractJdbc1DatabaseMetaData.java
 	jdbc/org/postgresql/test/jdbc2/DatabaseMetaDataTest.java
2002-11-11 07:11:12 +00:00
Tom Lane ad18b10181 Add cast to suppress compile warning on Alphas. 2002-11-11 03:33:38 +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 78822b328c Add palloc0 function to inline MemSet for newNode call. 2002-11-10 02:17:25 +00:00
Bruce Momjian 7aeab94adf This trivial patch removes 2 unused defines from pg_config.h.in:
FASTBUILD and DATEDEBUG weren't referenced by any other code.

Neil Conway
2002-11-10 00:38:21 +00:00
Bruce Momjian c600a6ac47 I am attaching a patch file that will replace the previous one. It only
contains the patches to Makefile.global.in and Makefile.unixware.  The
Makefile.unixware patch has been updated to include the contents of
LD_LIBRARY_PATH, if present, to the -rpath (-R) option.  This change
will  simplify configuring and building PostgreSQL on systems that
support  LD_LIBRARY_PATH.  You can set LD_LIBRARY_PATH to include all
the directorys  you want to have searched for additional libraries, run
configure, then run  make.  The paths in LD_LIBRARY_PATH will then be
embedded in the executables  via the -rpath (-R) option to the linker,
and so will not require  LD_LIBRARY_PATH in order to run.

Billy G. Allie
2002-11-10 00:37:28 +00:00
Bruce Momjian cfd2728100 This patch makes a minor cleanup to the implementation of PERFORM in
PL/PgSQL. Previously, it had been bundled together with the assign
statement implementation, for some reason that wasn't clear to me
(they certainly don't share any code with one another). So I separated
them and made PERFORM a statement like any other. No changes in
functionality.

Along the way, I added some regression tests for PERFORM, added a
bunch more SGML tags to the PL/PgSQL docs, and removed an obsolete
comment relating to the implementation of RETURN NEXT.

Neil Conway
2002-11-10 00:35:58 +00:00
Bruce Momjian ceb4f5ea9c > > I'll re-check that with the ppc architecture guy here.
>
> ... he is now about to write an inlined version that can go into
> s_lock.h . I'll send the new patch later on...

OK, here it comes:

An inlined version of tas(), that works for both, powerpc and
powerpc64. The patch is against 7.3b5 and passes the test suite on
both architectures.

Reinhard Max
2002-11-10 00:33:43 +00:00
Bruce Momjian 4ca28eb7c7 I just discovered, that there is missing a const when passing a buffer
to  PQescapeBytea and PQunescapeBytea. I fixed it and tried to create a
usable  diff (I'm not so familar to diff).

Tommi M?kitalo
2002-11-10 00:14:22 +00:00
Bruce Momjian 3eabc4490e Tweak CREATE SEQUENCE grammar to be more SQL1999 standards compliant.
Neil Conway
2002-11-10 00:10:20 +00:00
Bruce Momjian ebb531836a Add code to handle [ON COMMIT { PRESERVE ROWS | DELETE ROWS | DROP }]
for temp tables.

Gavin Sherry
2002-11-09 23:56:39 +00:00
Bruce Momjian bea4792125 This patch removes a bunch of superfluous #include directives: if
postgres.h or c.h includes a system header (such as stdio.h or
stdlib.h), there's no need to specifically include it in any of the .c
files in the backend.

Neil Conway
2002-11-08 20:23:57 +00:00
Tom Lane 337f73b1bb Revise geometry regression testing to eliminate most cross-platform
variation.  To do this, set extra_float_digits to -3 in the geometry
test, and tweak the CIRCLE_TBL dataset to avoid values that suffer
from severe cancellation error (eg, circles that just touch an axis).
We still need two geometry 'expected' files to account for the
difference between platforms that display minus zero as '-0' and those
that just say '0', but with luck that's all we'll need.
2002-11-08 20:09:55 +00:00
Bruce Momjian b26dfbb0e3 Here is a patch that does just that, while maintaining the
"traditional" behavior, so the change should be transparent. Use the
command "\pset pager always" to turn it on. Anything else does the
normal toggle between "on" and "off"

Greg Sabino Mullane
2002-11-08 19:12:21 +00:00
Tom Lane c2b716ab68 Replace imprecise value of PI with a better one, and tweak circle_poly
in hopes of reducing platform-to-platform variations in its results.
This will cause the geometry regression test to start failing on some
platforms.  I plan to update the test later today.
2002-11-08 18:32:47 +00:00
Tom Lane d2c744aa56 Add extra_float_digits GUC parameter to allow adjustment of displayed
precision for float4, float8, and geometric types.  Set it in pg_dump
so that float data can be dumped/reloaded exactly (at least on platforms
where the float I/O support is properly implemented).  Initial patch by
Pedro Ferreira, some additional work by Tom Lane.
2002-11-08 17:37:52 +00:00
Bruce Momjian fef731d1c4 The "Allow easy display of usernames in a group (pg_hba.conf uses groups
now)" item on the open items, and subsequent plpgsql function I sent in,
made me realize it was too hard to get the upper and lower bound of an
array. The attached creates two functions that I think will be very
useful when combined with the ability of plpgsql to return sets.

array_lower(array, dim_num)
- and -
array_upper(array, dim_num)

They return the value (as an int) of the upper and lower bound of the
requested dim in the provided array.

Joe Conway
2002-11-08 17:27:03 +00:00
Tom Lane 9a1ced2732 Add #define _GNU_SOURCE to work around what seems to be Perl 5.8.0's
problem.  Per recent discussions about plperl failing to build on Linux.
2002-11-07 22:09:51 +00:00
Tom Lane b02d3aaed7 Move substitute extern declarations to end of file, so that they are
not read until after we've read the port-specific header file.  In
particular this should make it safer to #include system headers for
inet_aton; in general it seems that the port header file ought to be
in a position to set definitions before we do stuff based on having
a definition or not.
2002-11-07 22:08:30 +00:00
Tom Lane 3a4b3ac3a5 Remove inappropriate inclusions of OpenSSL internal header e_os.h,
as well as unnecessary (and incorrect on Windows) assignments to
errno/SOCK_ERRNO.
2002-11-07 18:45:51 +00:00
Michael Meskes 11c4f2d97d Synced parser one more time. 2002-11-07 09:48:09 +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 2103b7baa2 Phase 2 of hashed-aggregation project. nodeAgg.c now knows how to do
hashed aggregation, but there's not yet planner support for it.
2002-11-06 22:31:24 +00:00
Tom Lane f6dba10e62 First phase of implementing hash-based grouping/aggregation. An AGG plan
node now does its own grouping of the input rows, and has no need for a
preceding GROUP node in the plan pipeline.  This allows elimination of
the misnamed tuplePerGroup option for GROUP, and actually saves more code
in nodeGroup.c than it costs in nodeAgg.c, as well as being presumably
faster.  Restructure the API of query_planner so that we do not commit to
using a sorted or unsorted plan in query_planner; instead grouping_planner
makes the decision.  (Right now it isn't any smarter than query_planner
was, but that will change as soon as it has the option to select a hash-
based aggregation step.)  Despite all the hackery, no initdb needed since
only in-memory node types changed.
2002-11-06 00:00:45 +00:00
Tom Lane 04eb419809 Fix inclusion order, per Andreas. 2002-11-04 14:27:21 +00:00
Tom Lane 7f660090e5 Remove unnecessary inclusion, per Andreas. 2002-11-04 14:25:42 +00:00
Tom Lane c14b72577c Remove no-longer-needed inclusion of bootstrap_tokens.h, per patch
from Andreas.
2002-11-04 14:22:32 +00:00
Barry Lind fdf6b4ff93 Applied two patches from Kris Jurka.
- First fixes a problem with a recent patch allowing setNull on updateable
    resultsets
  - Second removed toLower() calls on database object names.  Leave it to
    the caller to correctly pass lower, upper or mixed case.  The driver
    already has methods that the caller can use to determine that postgres
    stores identifiers in lowercase. (unless the identifier was quoted when
    created).

 Modified Files:
 	jdbc/org/postgresql/jdbc1/AbstractJdbc1DatabaseMetaData.java
 	jdbc/org/postgresql/jdbc2/AbstractJdbc2ResultSet.java
2002-11-04 06:42:33 +00:00
Tom Lane 2a01b05936 Code review for recent patch to allow ALTER TABLE ADD COLUMN when
a child table already has a matching column.  Acquire appropriate
lock on child table; do the right thing with any CHECK constraints
attached to the new parent column.
2002-11-02 22:02:08 +00:00
Tom Lane e02d1abee6 During swap_relfilenodes, swap relation size statistic fields along with
the relfilenode and toast fields.  This ensures that the newly-computed
statistics will be available on completion of CLUSTER.
2002-11-02 21:20:40 +00:00
Tom Lane 5123139210 Remove encoding lookups from grammar stage, push them back to places
where it's safe to do database access.  Along the way, fix core dump
for 'DEFAULT' parameters to CREATE DATABASE.  initdb forced due to
change in pg_proc entry.
2002-11-02 18:41:22 +00:00
Tom Lane f6e0130b5b Clean up a few fprintf(stderr)'s that should be elog's. 2002-11-02 15:54:13 +00:00
Tom Lane 6a7273e14c Fix permissions-checking bugs and namespace-search-path bugs in
CONVERSION code.  Still need to figure out what to do about inappropriate
coding in parsing.
2002-11-02 02:33:03 +00:00
Bruce Momjian 62636a3d4b Re-add Win32 missing files, I think. 2002-11-02 02:00:35 +00:00
Bruce Momjian a89660a1e6 Re-add Win32 files. 2002-11-02 01:58:27 +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 884cd4b6be Reduce a couple of debugging messages from LOG to DEBUG1 category. 2002-11-01 19:33:09 +00:00
Tom Lane 8d43947886 Reduce messages associated with shell-type function arguments/results
from WARNING to NOTICE, since they are expected messages in common cases.
2002-11-01 19:19:58 +00:00
Tom Lane 03a2371317 Update to match expected results on OS X 10.2. 2002-11-01 18:15:34 +00:00
Tom Lane 0d97eb6ac8 After elog(PANIC), exit with abort() not proc_exit(). This allows a
core file to be produced for debugging, and avoids trying to run the
normal proc-exit cleanup hooks, which are likely to cause additional
problems if the system is hosed.
2002-11-01 17:55:23 +00:00
Tom Lane 8631924e51 Correct ordering of geometry/freebsd entries, add one for freebsd5. 2002-11-01 16:32:32 +00:00
Tom Lane a4007c0d5f Update for test changes. 2002-11-01 15:20:09 +00:00
Tom Lane 16cc5372e4 Avoid malloc(0) when printing a table of no columns. On some platforms
this returns NULL, which confuses the code.
2002-11-01 15:12:19 +00:00
Tom Lane 643dfb783d Fix some bogus comments. 2002-11-01 00:40:23 +00:00
Tom Lane 966a4ca9b3 Add missing #include <errno.h>, per gripe from Alessio Bragadini. 2002-10-31 22:37:19 +00:00
Tom Lane 1ce069b067 Got tired of explaining why this Assert is not wrong. 2002-10-31 21:59:32 +00:00
Tom Lane 55e4ef138c Code review for statement_timeout patch. Fix some race conditions
between signal handler and enable/disable code, avoid accumulation of
timing error due to trying to maintain remaining-time instead of
absolute-end-time, disable timeout before commit not after.
2002-10-31 21:34:17 +00:00
Tom Lane 8a45a2e9b6 Fix miscalculation of remaining free space during tuple chain moving.
Only affects machines where MAXALIGN > 4, and is a boundary-condition
case even there, but still surprising that it's not been identified
before.  Also reduce tuple chain move give-up messages from WARNING
to DEBUG1, since they are not unexpected conditions.
2002-10-31 19:25:29 +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
Bruce Momjian 2982b97f71 Clean up gram.y trailing spaces. 2002-10-31 02:31:00 +00:00
Barry Lind a50d08f793 Return something meaningful for Statement.getFetchSize(). Previously we were
returning an exception when this method was called.

Modified Files:
	jdbc/org/postgresql/jdbc2/AbstractJdbc2Statement.java
2002-10-30 04:33:29 +00:00
Bruce Momjian b1039e93d8 Add additional ORDER BY to join regression test, per Tatsuo. 2002-10-30 01:28:12 +00:00
Bruce Momjian 9e90d11810 Remove /src/utils. Is final cleanup of getopt.c resurection. 2002-10-30 01:15:51 +00:00
Bruce Momjian 6d8c3d4eb3 Add popen/pclose -> _popen/_pclose() mapping for Win32. 2002-10-29 19:35:33 +00:00
Bruce Momjian 972c7b8690 Update comments. 2002-10-29 04:24:30 +00:00
Bruce Momjian b064206c09 getopt.c now in /port, for MS Win. 2002-10-29 04:23:30 +00:00
Bruce Momjian 87a3e39e7c Re-add getopt.c for MSWin psql. 2002-10-29 04:22:37 +00:00
Bruce Momjian 1068548726 Re-add getopt.c. 2002-10-29 04:20:15 +00:00
Bruce Momjian 579e5dcbaa Update regression for FreeBSD 4.7, for Larry Rosenman 2002-10-29 03:44:22 +00:00
Bruce Momjian 13d7a689ec Add ORDER BY to join regression test. 2002-10-28 22:54:45 +00:00
Bruce Momjian 323e03aed4 fseeko NetBSD fix. 2002-10-28 00:00:25 +00:00
Tom Lane 7a0671a37c Suppress compile warnings on OS X. 2002-10-27 02:52:10 +00:00
Tom Lane 3518fbe86f Add missing semicolons to a few PG_FUNCTION_INFO_V1 calls. 2002-10-26 15:01:01 +00:00
Tom Lane a77b862c09 Add dummy variable declaration to PG_FUNCTION_INFO_V1() to prevent
'empty declaration' warnings from compilers that care about such things.
Per discussion back before 7.2 release; we didn't do it then because
we'd already missed all the beta cycle ...
2002-10-25 22:17:32 +00:00
Tom Lane ba963c651b Remove #warning directive, which is nonstandard and isn't really
buying us anything to make it worth the porting risk.  Per discussion
quite some time ago.
2002-10-25 22:08:44 +00:00
Bruce Momjian 3fd6d3260f Change to fseeko(), per Philip. 2002-10-25 03:47:30 +00:00
Barry Lind 7ab25fffac Patch submitted by Kris Jurka to fix arrayindexoutofbounds exception caused
by improper array initialization.

 Modified Files:
 	jdbc/org/postgresql/jdbc1/AbstractJdbc1DatabaseMetaData.java
2002-10-25 02:54:37 +00:00
Bruce Momjian fc5c577e34 Allow fseeko in pg_dump only if fseeko() will work for all supported file
sizes.
2002-10-25 01:33:17 +00:00
Tom Lane 2908a838ac Code review for connection timeout patch. Avoid unportable assumption
that tv_sec is signed; return a useful error message on timeout failure;
honor PGCONNECT_TIMEOUT environment variable in PQsetdbLogin; make code
obey documentation statement that timeout=0 means no timeout.
2002-10-24 23:35:55 +00:00
Tom Lane bd19e8f604 Fix some places that were unportably assuming struct timeval's tv_sec
field is signed.  Clean up casting.
2002-10-24 23:19:13 +00:00
Tom Lane c3086c8f53 Function-call-style type coercions should be treated as explicit
coercions, not implicit ones.  For example, 'select abstime(1035497293)'
should succeed because there is an explicit binary coercion from int4
to abstime.
2002-10-24 22:09:00 +00:00
Bruce Momjian b171f5956e Fix include for NetBSD. 2002-10-24 04:48:08 +00:00
Bruce Momjian 68214218be Add prototype include to fseeko.c. 2002-10-24 04:33:46 +00:00
Bruce Momjian 4668d54f0b Add fseeko for NetBSD. 2002-10-24 03:11:05 +00:00
Bruce Momjian b093f8825d Fix include files for new PageOutput call. 2002-10-24 01:33:50 +00:00
Bruce Momjian f142b09151 Add fseeko/ftello prototypes for BSD/OS only to c.h. 2002-10-23 23:37:47 +00:00
Bruce Momjian 586510f774 Improve coding style of new function. 2002-10-23 21:39:27 +00:00
Bruce Momjian 6b9d496988 Make BSD/OS fseeko thread-safe. 2002-10-23 21:16:17 +00:00
Bruce Momjian dc4d18e056 Add fseeko/ftello using fsetpos/fgetpos for BSD/OS. 2002-10-23 20:56:24 +00:00
Bruce Momjian 641b658c26 Page \h output and centralize psql paging code in PageOutput(). 2002-10-23 19:23:57 +00:00
Tom Lane 30963fc200 Perform transaction cleanup operations in a less ad-hoc, more
principled order; in particular ensure that all shared resources
are released before we release transaction locks.  The code used
to release locks before buffer pins, which might explain an ancient
note I have about a bufmgr assertion failure I'd seen once several
years ago, and been unable to reproduce since.  (Theory: someone
trying to drop a relation might be able to reach FlushRelationBuffers
before the last user of the relation had gotten around to dropping
his buffer pins.)
2002-10-22 22:44:36 +00:00
Tom Lane 7305aa0171 create_index test must run after create_misc test. 2002-10-22 20:20:10 +00:00
Peter Eisentraut 1c23cf4371 Update for test changes. 2002-10-22 20:01:15 +00:00
Peter Eisentraut 7d970df60e Add DLLIMPORT declarations required by contrib with asserts enabled. 2002-10-22 20:00:48 +00:00
Bruce Momjian 2b287020f4 Allow 8-byte off_t to properly pg_dump, from Philip Warner with mods by Bruce. 2002-10-22 19:15:23 +00:00
Tom Lane 200b151615 Fix places that were using IsTransactionBlock() as an (inadequate) check
that they'd get to commit immediately on finishing.  There's now a
centralized routine PreventTransactionChain() that implements the
necessary tests.
2002-10-21 22:06:20 +00:00
Bruce Momjian 2110be0465 Cleanup for CLUSTERDB failure:
On Sat, Oct 19, 2002 at 12:11:32AM +0200, Peter Eisentraut wrote:
> $ ./clusterdb
> psql: could not connect to server: No such file or directory
>         Is the server running locally and accepting
>         connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
> psql: could not connect to server: No such file or directory
>         Is the server running locally and accepting
>         connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
> clusterdb: While clustering peter, the following failed:
> $
>
> This could probably handled a little more gracefully.

Yes, sorry.  A patch for this is attached.  Please apply.

Alvaro Herrera
2002-10-21 20:32:33 +00:00
Bruce Momjian e49c1a9234 Fix ALTER TABLE ... ADD COLUMN for inheritance cases.
Alvaro Herrera
2002-10-21 20:31:52 +00:00
Tom Lane b47c3598d4 Remove unnecessary (and inadequate) check of IsTransactionBlock() in
pgstat_vacuum_tabstat().  Assume that caller (namely, VACUUM) has done
the appropriate state checking beforehand.
2002-10-21 19:59:14 +00:00
Tom Lane a20e49bea8 Avoid using IsTransactionBlock() in DeferredTriggerSetState(); no real
need for this optimization, and it's too easily fooled anyway.
2002-10-21 19:55:49 +00:00
Tom Lane e16f04cf72 Make CREATE/ALTER/DROP USER/GROUP transaction-safe, or at least pretty
nearly so, by postponing write of flat password file until transaction
commit.
2002-10-21 19:46:45 +00:00
Peter Eisentraut de9d7f4bd5 Add DLLIMPORT declarations needed by contrib modules. 2002-10-21 18:57:35 +00:00
Peter Eisentraut b91f9042b0 Add guards against double inclusion. 2002-10-21 18:53:20 +00:00
Peter Eisentraut 20f77d79a2 Translation updates 2002-10-21 18:51:03 +00:00
Peter Eisentraut 7a35d304e9 Remove obsoleted stuff merged in from branch. 2002-10-21 18:05:24 +00:00
Michael Meskes cf8da4e9f0 Merged ecpg_big_bison back into HEAD 2002-10-21 13:09:31 +00:00
Tom Lane 13416a1f8f Fix potential problem with btbulkdelete deleting an indexscan's current
item, if the page containing the current item is split while the indexscan
is stopped and holds no read-lock on the page.  The current item might
move right onto a page that the indexscan holds no pin on.  In the prior
code this would allow btbulkdelete to reach and possibly delete the item,
causing 'my bits moved right off the end of the world!' when the indexscan
finally resumes.  Fix by chaining read-locks to the right during
_bt_restscan and requiring btbulkdelete to LockBufferForCleanup on every
page it scans, not only those with deletable items.  Per my pghackers
message of 25-May-02.  (Too bad no one could think of a better way.)
2002-10-20 20:47:31 +00:00
Tatsuo Ishii 29eabaa958 Returns exit status 1 if invalid encoding name or
encoding number is given.
2002-10-20 11:33:48 +00:00
Barry Lind 06b297938d Applied patch from Teofilis Martisius to improve performance.
Also removed some unused files and fixed the which needed a small change
after the previous patch to build.xml.

 Modified Files:
 	jdbc/Makefile jdbc/org/postgresql/core/Encoding.java
 	jdbc/org/postgresql/jdbc1/AbstractJdbc1Connection.java
 Removed Files:
 	jdbc/utils/CheckVersion.java jdbc/utils/buildDriver
 	jdbc/utils/changelog.pl
2002-10-20 02:55:50 +00:00
Tom Lane a044e2abdd Rule rewriter was doing the wrong thing with conditional INSTEAD rules
whose conditions might yield NULL.  The negated qual to attach to the
original query is properly 'x IS NOT TRUE', not 'NOT x'.  This fix
produces correct behavior, but we may be taking a performance hit because
the planner is much stupider about IS NOT TRUE than it is about NOT
clauses.  Future TODO: teach prepqual, other parts of planner how to
cope with BooleanTest clauses more effectively.
2002-10-20 00:58:55 +00:00
Tom Lane 6d6b582850 Disallow aggregate functions in rule WHERE clauses. Per gripe from
Fritz Lehmann-Grube back in January.
2002-10-20 00:31:53 +00:00
Barry Lind ea794574f1 Applied patch submitted by Mike Beachy to give a better error message if
configure hasn't been run before trying to build.
Also cleaned up the README file and removed some obsolete files.

 Modified Files:
 	jdbc/README jdbc/build.xml
 Removed Files:
 	jdbc/CHANGELOG jdbc/Implementation jdbc/jdbc.jpx
2002-10-20 00:10:55 +00:00
Tom Lane 4a67565b37 Fix within-function memory leaks in the various PLs' interfaces to
SPI_prepare: they all save the prepared plan into topCxt, and so the
procCxt copy that's actually returned by SPI_prepare ought to be freed.
Diagnosis and plpython fix by Nigel Andrews, followup for other PLs
by Tom Lane.
2002-10-19 22:10:58 +00:00
Barry Lind 30c2b5ec72 Applied patch submitted by Kris Jurka to result in a better error message
under some circumstances and handle negative money values better.

 Modified Files:
 	jdbc/org/postgresql/jdbc1/AbstractJdbc1ResultSet.java
2002-10-19 22:10:36 +00:00
Tom Lane 78b13fee45 Fix pltcl self-test for recent changes to elog. 2002-10-19 22:01:45 +00:00
Barry Lind ba7c2d2b00 Backed out part of the change from 1.6. The attempt to support int8 binds
in such a way that indexes on int8 columns would be used (by quoting the value)
caused other problems.  Will need to wait for the backend to properly fix
the root problem.

 Modified Files:
 	jdbc/org/postgresql/jdbc1/AbstractJdbc1Statement.java
2002-10-19 21:53:42 +00:00
Tom Lane 76d09f4610 Fix case where a function in FROM returns a scalar type, but is
referred to with whole-tuple syntax.
2002-10-19 21:23:20 +00:00
Tom Lane 0d93e385b0 Make psql's \df display functions that return sets as having return type
'setof something'; formerly you could not tell at all that the function
returns set.
2002-10-19 20:50:44 +00:00
Tom Lane 60992456ed Invert logic in pg_exec_query_string() so that we set a snapshot for
all utility statement types *except* a short list, per discussion a few
days ago.  Add missing SetQuerySnapshot calls in VACUUM and REINDEX,
and guard against calling REINDEX DATABASE from a function (has same
problem as VACUUM).
2002-10-19 20:15:09 +00:00
Tom Lane c1f91a38e2 Fix rewrite code so that rules are in fact executed in order by name,
rather than being reordered according to INSTEAD attribute for
implementation convenience.
Also, increase compiled-in recursion depth limit from 10 to 100 rewrite
cycles.  10 seems pretty marginal for situations where multiple rules
exist for the same query.  There was a complaint about this recently,
so I'm going to bump it up.  (Perhaps we should make the limit a GUC
parameter, but that's too close to being a new feature to do in beta.)
2002-10-19 19:00:47 +00:00
Bruce Momjian 757b98fda8 Back out Alvaro's patch until regression tests pass. 2002-10-19 03:01:09 +00:00
Tom Lane c0f7dcdac1 Fix range-query estimation to not double-exclude NULLs, per gripe from
Ray Ontko 28-June-02.  Also, fix prefix_selectivity for NAME lefthand
variables (it was bogusly assuming binary compatibility), and adjust
make_greater_string() to not call pg_mbcliplen() with invalid multibyte
data (this last per bug report that I can't find at the moment, but it
was in July '02).
2002-10-19 02:56:16 +00:00
Bruce Momjian 1a63cc5e90 Fix compile failure caused by new patch. 2002-10-19 02:25:51 +00:00
Bruce Momjian 64acc5e3f1 Remove mention of utils/getopt.c. Not used anymore. 2002-10-19 02:23:26 +00:00
Bruce Momjian cabad378fc > Huh, I don't know where I got the idea you were (or someone else was?)
> in the position that attislocal should be reset.  I'll clean everything
> up and submit the patch I had originally made.

All right, this is it.  This patch merely checks if child tables have
the column.  If atttypid and atttypmod are the same, the attributes'
attinhcount is incremented; else the operation is aborted.  If child
tables don't have the column, recursively add it.

attislocal is not touched in any case.

Alvaro Herrera
2002-10-19 02:09:45 +00:00
Bruce Momjian bab3d29fba This patch adds some missing functions for float8 math operations,
specifically ceil(), floor(), and sign(). There may be other functions
that need to be added, but this is a start. I've included some simple
regression tests.

Neil Conway
2002-10-19 02:08:19 +00:00
Bruce Momjian 5c6a5fe18b Make regression tests safe for autocommit = 'off'. 2002-10-19 01:35:43 +00:00
Tom Lane 5a0a79d694 Add missing #include <errno.h>. 2002-10-19 00:25:36 +00:00
Tom Lane 44dc9c1faa Fix psql's \copy to accept table names containing schemas, as well as
a column list.  Bring its parsing of quoted names and quoted strings
somewhat up to speed --- I believe it now handles all non-error cases
the same way the backend would, but weird boundary conditions are not
necessarily done the same way.
2002-10-19 00:22:14 +00:00
Peter Eisentraut 4cff161703 Improve formatting of --help output. 2002-10-18 22:05:36 +00:00
Tom Lane 0d17ce92ac Fix breakage that had crept into setlocale() usage: once again we've
been bit by the fact that the locale functions return pointers to
modifiable variables.  I added some comments that might help us avoid
the mistake in future.
2002-10-18 20:44:02 +00:00
Tom Lane 6c06bc2644 Make 'dummy' declarations in header files be 'extern int no_such_variable'
instead of 'extern int errno'; the latter is unsafe according to the
ANSI C standard, as well as in practice on some platforms.
2002-10-18 20:33:57 +00:00
Tom Lane dad34ba567 Un-break createlang build. 2002-10-18 19:35:28 +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
Barry Lind b0146a2407 Fix in updateable result sets to handle binding null values correctly
Patch submitted by Kris Jurka (applied with some modifications)

 Modified Files:
 	jdbc/org/postgresql/jdbc2/AbstractJdbc2ResultSet.java
2002-10-17 19:17:08 +00:00
Tom Lane 3e4978b72b Fix free-slot search in PgSetResultId so it actually works. 2002-10-17 14:53:32 +00:00
Tom Lane e313eb8098 Improve formatting of error message. 2002-10-17 14:51:50 +00:00
Barry Lind c3e7b3cc96 Fixed support in jdbc for 7.3 server autocommit. With these changes the
jdbc regression tests pass for both autocommit on and autocommit off

 Modified Files:
 	jdbc/org/postgresql/jdbc1/AbstractJdbc1Connection.java
 	jdbc/org/postgresql/test/jdbc2/ConnectionTest.java
2002-10-17 05:33:52 +00:00
Bruce Momjian cda776e613 Make pg_dump save for autocommit = off. 2002-10-16 05:46:54 +00:00
Bruce Momjian ec64390e91 Fix from Joe on timeout code. 2002-10-16 04:38:00 +00:00
Bruce Momjian 6b0e166644 Improve appearance of SET command. 2002-10-16 03:44:28 +00:00
Bruce Momjian 5d8c67462d Fix script to handle autocommit = 'off' by prepending autocommit 'on' to
the start of the psql commandline.  This is better than adding BEGIN/END
because it handles multiple queries well, and allows the return code for
psql to return the proper value.
2002-10-16 03:24:09 +00:00
Bruce Momjian facb720073 Fix connection_timeout to use time() and handle timeout == 1.
Code cleanup.
2002-10-16 02:55:30 +00:00
Tom Lane f4a7c257dc Fix unintentional breakage of COPY TO/FROM stdin. Mea culpa. 2002-10-15 16:44:21 +00:00
Tom Lane 3a2ef59116 Fix Linux dynloader code for pre-HAVE_DLOPEN systems, which evidently
are still in use out there.  Per report from Brendan LeFebvre.
2002-10-15 16:04:17 +00:00
Tom Lane 951ec872c7 Fix psql to cope with autocommit off, at least during startup.
Behavior of backslash commands (especially for large objects)
may still require some thought.
2002-10-15 02:24:16 +00:00
Tom Lane e258a2b436 Fix libpq startup code to work correctly in autocommit off mode.
In passing, fix breakage for case where PGCLIENTENCODING is set in
environment.
2002-10-15 01:48:25 +00:00
Tom Lane 9ff695c944 Make SPI's execution of querystrings follow the rules agreed to for
command status at the interactive level.  SPI_processed, etc are set
in the same way as the returned command status would have been set if
the same querystring were issued interactively.  Per gripe from
Michael Paesold 25-Sep-02.
2002-10-14 23:49:20 +00:00
Tom Lane d508b057ac Adjust handling of command status strings in the presence of rules,
as per recent pghackers discussions.  initdb forced due to change in
fields of stored Query nodes.
2002-10-14 22:14:35 +00:00
Tom Lane ea3728ee5b Add missing entries for bit<->int4 and bit<->int8 conversions. 2002-10-14 22:12:49 +00:00
Peter Eisentraut 50634c13e4 Translation updates 2002-10-14 19:04:28 +00:00
Bruce Momjian 4a513ab07f Mention that resetting the timeout may be wrong on select retry. 2002-10-14 18:11:17 +00:00
Bruce Momjian 6d9d97e8ab Restore ptmp_timeout for cases where no timeout is passed. 2002-10-14 17:33:08 +00:00
Bruce Momjian 9eada51012 libpq connection_timeout doesn't do subsecond timing, so make the code
clear on that point.
2002-10-14 17:15:11 +00:00
Tom Lane 8f2a289d78 Arrange to copy relcache's trigdesc structure at the start of any
query that uses it.  This ensures that triggers will be applied consistently
throughout a query even if someone commits changes to the relation's
pg_class.reltriggers field meanwhile.  Per crash report from Laurette Cisneros.
While at it, simplify memory management in relcache.c, which no longer
needs the old hack to try to keep trigger info in the same place over
a relcache entry rebuild.  (Should try to fix rd_att and rewrite-rule
access similarly, someday.)  And make RelationBuildTriggers simpler and
more robust by making it build the trigdesc in working memory and then
CopyTriggerDesc() into cache memory.
2002-10-14 16:51:30 +00:00
Bruce Momjian ac376a3eb9 As Niel so nicely pointed out this morning, the output of EXPLAIN
ANALYZE is not quite clear when branches of the query are never
executed. So this tiny patch fixes that.

The patch is attached and can also be found at:
http://svana.org/kleptog/pgsql/pgsql-explain.patch

Martijn van Oosterhout
2002-10-14 04:26:54 +00:00
Bruce Momjian 1f653ec31e I have attached two patches as per:
1) pltcl:
Add SPI_freetuptable() calls to avoid memory leaks (Me + Neil Conway)
Change sprintf()s to snprintf()s (Neil Conway)
Remove header files included elsewhere (Neil Conway)

2)plpython:
Add SPI_freetuptable() calls to avoid memory leaks
Cosemtic change to remove a compiler warning


Notes:

I have tested pltcl.c for
 a) the original leak problem reported for the repeated call of spi_exec
in a TCL fragment
and
 b) the subsequent report resulting from the use of spi_exec -array
in a TCL
fragment.

The plpython.c patch is exactly the same as that applied to make
revision 1.23,
the plpython_schema.sql and feature.expected sections of the patch are
also the
same as last submited, applied and subsequently reversed out. It remains
untested by me (other than via make check). However, this should be safe
provided PyString_FromString() _copies_ the given string to make a
PyObject.


Nigel J. Andrews
2002-10-14 04:20:52 +00:00
Tom Lane ad4ce7aa5b Make SET really not start a transaction. 2002-10-13 16:55:05 +00:00
Tom Lane 5261bf9733 Make macaddr_in reject trailing garbage (except whitespace).
Per gripe from Patrick Welche, 13-Oct-2002.
2002-10-13 15:39:17 +00:00
Tom Lane f94e5bde60 psql thought that backslash is an escape character inside double quotes.
It isn't.
2002-10-12 23:09:34 +00:00
Tom Lane 5bb46e7cd0 Fix for bug #795: two clauses that seem redundant are not really, if
one is pushed down into an outer join and the other is not.
2002-10-12 22:24:49 +00:00
Peter Eisentraut 0cd5ce6b11 Compute version number for docs on the fly. 2002-10-12 16:34:28 +00:00
Bruce Momjian 3258484d03 Add tv_sec change for connection timeout suggested by author. 2002-10-11 04:41:59 +00:00
Bruce Momjian 2177b6b635 Oops, back out newNode changes. We are not ready for that yet. 2002-10-11 04:16:44 +00:00
Bruce Momjian 6a7bb0afbc Prevent tv_sec from becoming negative in connection timeout code. 2002-10-11 04:12:14 +00:00
Bruce Momjian 8a7cfa3756 Lock on the rule relation wasn't removed after adding the comment.
Added Tom's patch fix for heap_close.

Rod Taylor
2002-10-09 16:26:46 +00:00
Bruce Momjian 33a6b67b51 > > > > and mb conversions (pg_ascii2mic and pg_mic2ascii not
> > > > found in the postmaster and not included from elsewhere)
> >
> > shared libs on AIX need to be able to resolve all symbols at linkage time.
> > Those two symbols are in backend/utils/SUBSYS.o but not in the postgres
> > executable.
>
> They are defined in backend/utils/mb/conv.c and declared in
> include/mb/pg_wchar.h.  They're also linked into the
> postmaster.  I don't see anything unusual.

Attached is a patch to fix the mb linking problems on AIX. As a nice side effect

it reduces the duplicate symbol warnings to linking libpq.so and libecpg.so
(all shlibs that are not postmaster loadable modules).

Please apply to current (only affects AIX).

The _LARGE_FILES problem is unfortunately still open, unless Peter
has fixed it per his recent idea.

Zeugswetter Andreas SB SD
2002-10-09 16:21:54 +00:00
Bruce Momjian ba8e20a6dd > Alvaro Herrera <alvherre@atentus.com> writes:
> > I'm looking at pg_dump/common.c:flagInhAttrs() and suspect that it can
> > be more or less rewritten completely, and probably should to get rigth
> > all the cases mentioned in the past attisinherited discussion.  Is this
> > desirable for 7.3?  It can probably be hacked around and the rewrite
> > kept for 7.4, but I think it will be much simpler after the rewrite.
>
> If it's a bug then it's fair game to fix in 7.3.  But keep in mind that
> pg_dump has to behave at least somewhat sanely when called against older
> servers ... will your rewrite behave reasonably if the server does not
> offer attinhcount values?

Nah.  I don't think it's worth it: I had forgotten that older versions
should be supported.  I just left the code as is and added a
version-specific test.

This patch allows pg_dump to dump correctly local definition of columns.
In particular,

CREATE TABLE p1 (f1 int, f2 int);
CREATE TABLE p2 (f1 int);
CREATE TABLE c () INHERITS (p1, p2);
ALTER TABLE ONLY p1 DROP COLUMN f1;
CREATE TABLE p3 (f1 int);
CREATE TABLE c2 (f1 int) INHERITS (p3);

Will be dumped as
CREATE TABLE p1 (f2 int);
CREATE TABLE p2 (f1 int);
CREATE TABLE c (f1 int) INHERITS (p1, p2);
CREATE TABLE c2 (f1 int) INHERITS (p3);

(Previous version will dump
CREATE TABLE c () INHERITS (p1, p2)
CREATE TABLE c2 () INHERITS (p3) )

Alvaro Herrera
2002-10-09 16:20:25 +00:00
Bruce Momjian d015dcbe4e Have SET not start transaction when autocommit off, with doc updates. 2002-10-09 04:59:38 +00:00
Bruce Momjian baaf8d7186 Again improve MemSet comments. 2002-10-08 23:12:22 +00:00
Bruce Momjian 59da96b8ce Update MemSet comments. 2002-10-08 19:17:58 +00:00
Tom Lane 56ece37384 Move responsibility for setting QuerySnapshot for utility statements
into postgres.c; make sure it happens for all cases that seem to need it.
Perhaps it would be better to explicitly exclude just a few utility
statement types from setting a snapshot?
2002-10-08 17:17:19 +00:00
Dave Cramer 5fc32fbf87 fixed missing apostrophe 2002-10-08 01:47:55 +00:00
Tom Lane 4e9b159484 Change order of operations during XLogFlush so that we try to include
in our write/flush operation any WAL entries that got queued while we
were waiting to get the WALWriteLock.  This improves throughput when
transactions are small enough that several can be committed per WAL
write (ie, per disk revolution).
2002-10-07 17:04:30 +00:00
Bruce Momjian e4c2967edb Clarify comment. 2002-10-06 03:56:03 +00:00
Tom Lane 916d8164df Restrict CREATE OPERATOR CLASS to superusers, per discussion some weeks
ago.
2002-10-04 22:19:29 +00:00
Tom Lane d2db166c75 Require superuser privilege to create a binary-compatible cast, per
discussion some weeks ago.  Also, add a check that two types to be
binary-equivalenced match as to typlen, typbyval, and typalign; if
they don't then it's surely a mistake to equivalence them.
2002-10-04 22:08:44 +00:00
Tom Lane b8dcb505ec Fix a couple of grammatical errors in error messages. 2002-10-04 17:34:01 +00:00
Tom Lane 3b8ba163d0 Tweak a few of the most heavily used function call points to zero out
just the significant fields of FunctionCallInfoData, rather than MemSet'ing
the whole struct to zero.  Unused positions in the arg[] array will
thereby contain garbage rather than zeroes.  This buys back some of the
performance hit from increasing FUNC_MAX_ARGS.  Also tweak tuplesort.c
code for more speed by marking some routines 'inline'.  All together
these changes speed up simple sorts, like count(distinct int4column),
by about 25% on a P4 running RH Linux 7.2.
2002-10-04 17:19:55 +00:00
Tom Lane aab47baf6c Hack to make it possible to load CREATE CONSTRAINT TRIGGER commands that
are missing the FROM clause (due to a long-ago pg_dump bug).  Patch by
Stephan Szabo, minor tweaking by Tom Lane.
2002-10-03 21:06:23 +00:00
Tom Lane 565c97bea5 In a bootstrap process or standalone backend, set MaxBackends = 1
to avoid unnecessary consumption of semaphores.
2002-10-03 19:19:09 +00:00
Tom Lane edf497dec9 Avoid palloc(0) when MaxBackends = 1. 2002-10-03 19:17:55 +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 793a4ba35e Add SSL documentation info to README.SSL 2002-10-03 17:26:14 +00:00
Bruce Momjian a0bf2503ea The attached patch fixes a number of issues related to compiling the
client
utilities (libpq.dll and psql.exe) for win32 (missing defines,
adjustments to
includes, pedantic casting, non-existent functions) per:
   http://developer.postgresql.org/docs/postgres/install-win32.html.

It compiles cleanly under Windows 2000 using Visual Studio .net. Also
compiles clean and passes all regression tests (regular and contrib)
under Linux.

In addition to a review by the usual suspects, it would be very
desirable for  someone well versed in the peculiarities of win32 to take
a look.

Joe Conway
2002-10-03 17:09:42 +00:00
Bruce Momjian d4eae72513 This patch removes two unused global variables from globals.c
Neil Conway
2002-10-03 17:07:53 +00:00
Tom Lane 71e74a2f58 Re-enable pg_resetxlog to accept -l values in hexadecimal (it used to
be able to do that, but the ability seems to have got lost in the
shuffle).  Add a -o nextOID switch for completeness.  Improve the
documentation to explain how and why to use these switches.
2002-10-02 21:30:13 +00:00
Tom Lane 388ad64dc7 pg_resetxlog was missing support for the pg_control fields added in 7.3. 2002-10-02 19:45:47 +00:00
Tom Lane b813d143ae Alter scale selection for NUMERIC division and transcendental functions
so that precision of result is always at least as good as you'd get from
float8 arithmetic (ie, always at least 16 digits of accuracy).  Per
pg_hackers discussion a few days ago.
2002-10-02 19:21:26 +00:00
Bruce Momjian c74c7e604c Turn GUC log_min_error_statement off by default by setting it to PANIC. 2002-10-02 16:27:57 +00:00
Dave Cramer fd972e7f7e test files added by Kris Jurka 2002-10-01 16:11:30 +00:00
Tom Lane 361f1e1656 Pass less-unsafe parameters to Darwin's NSLinkModule. While this change prevents a backend coredump when loading a broken shlib, it also seems to suppress the error messages that might help debug the problem :-(. Perhaps someone would like to supply a 'linkEdit' hook to get the best of both worlds. But in the meantime, backend crash trumps error reporting. 2002-10-01 05:06:44 +00:00
Barry Lind 1a4431777b Fixed test suite to call PoolingDataSourceTest which was missed
Modified Files:
 	OptionalTestSuite.java
2002-10-01 04:36:00 +00:00
Dave Cramer 7c553901d7 schema awareness patch provided by Kris Jurka 2002-10-01 00:39:02 +00:00
Bruce Momjian 2a1e4a9006 Add Bear's SSL comments. 2002-09-29 04:06:54 +00:00
Tom Lane 6d0d15c451 Make the world at least somewhat safe for zero-column tables, and
remove the special case in ALTER DROP COLUMN to prohibit dropping a
table's last column.
2002-09-28 20:00:19 +00:00
Tom Lane 23616b47d5 ARGH!
Vacuum must not advance pg_database.datvacuumxid nor truncate CLOG
unless it's processed *all* tables in the database.  Vacuums run by
unprivileged users don't count.

(Beats head against nearest convenient wall...)
2002-09-27 20:57:08 +00:00
Bruce Momjian 3468ed586a > Fix clusterdb to be schema-aware
Please apply the patch attached and this should be solved.

Alvaro Herrera
2002-09-27 17:51:10 +00:00
Tom Lane d2d0f42040 Use heap_formtuple not heap_addheader to construct pg_index tuples.
heap_addheader is wrong because it doesn't cope with varlena fields,
notably indpred.
2002-09-27 15:05:23 +00:00
Tom Lane cb253de21a Don't mess with HEAP_XMAX_INVALID in heaptuple.c routines; there is
no reason to worry about the tuple commit status bits until the tuple
is inserted in a relation by heapam.c.  Also, improve comments for
heap_addheader().
2002-09-27 15:04:08 +00:00
Bruce Momjian 0b1b377569 Have -d5 -d0 not affect the extra variables set with -d5. 2002-09-27 03:59:00 +00:00
Bruce Momjian 1fe4cbb9db Make postgres -d0 set server_min_messages to notice. Reset doesn't work
at this area in the code.
2002-09-27 03:34:15 +00:00
Tom Lane b2ab1e6bc9 Ensure that before truncating CLOG, we force a checkpoint even if no
recent WAL activity has occurred.  Without this, it's possible that a
later crash might leave tuples on disk with un-updated commit status
bits.
2002-09-26 22:58:34 +00:00
Tom Lane c87469e64a Fix problems with loss of tuple commit status bits during WAL redo of
VACUUM FULL tuple moves.  Store full-width t_infomask in WAL, rather
than storing low 8 bits and expecting to be able to reconstruct upper
bits.  While at it, remove redundant t_oid field from WAL headers
(the OID, if present, is now recorded in the data portion of the tuple).
WAL version number bumped --- this does not force an initdb, you can
instead run pg_resetxlog after a clean shutdown of the old postmaster.
2002-09-26 22:46:29 +00:00
Bruce Momjian 72f8efdc98 Back out /pl memory leak patch. Wait for new version. 2002-09-26 05:39:03 +00:00
Bruce Momjian ff5d4cbfca Clean up SSL compiler warnings. 2002-09-26 05:37:58 +00:00
Bruce Momjian b2c34e2bd1 I have attached the pltcl patch again, just in case. For the sake of clarity
let's say this patch superscedes the previous one.

I have also attached a patch addressing the similar memory leak problem in
plpython. This includes a slight adjustment of the tests in the source
directory. The patch also includes a cosmetic change to remove a compiler
warning although I think the change makes the code look worse though.

BTW, by my reckoning the memory leak would occur with prepared plans and
without. If that is not the case then I've been barking up the wrong tree.

Nigel J. Andrews
2002-09-26 05:23:26 +00:00
Bruce Momjian 5ad4faf13a This patch removes a use of uninitialized memory in lmgr/lock.c, by
adding a missing sprintf().

Neil Conway
2002-09-26 05:18:30 +00:00
Bruce Momjian 3c104bc4ed Pass postmaster -d down to the postgres backend to trigger special -d
handling in the backend.
2002-09-26 05:17:00 +00:00
Bruce Momjian 15b95cf872 Allow SSL to work withouth client-side certificate infrastructure. 2002-09-26 04:41:55 +00:00
Tom Lane 8a6fab412e Remove ShutdownBufferPoolAccess exit callback, and do the work in
ProcKill instead, where we still have a PGPROC with which to wait on
LWLocks.  This fixes 'can't wait without a PROC structure' failures
occasionally seen during backend shutdown (I'm surprised they weren't
more frequent, actually).  Add an Assert() to LWLockAcquire to help
catch any similar mistakes in future.  Fix failure to update MyProcPid
for standalone backends and pgstat processes.
2002-09-25 20:31:40 +00:00
Barry Lind 7bf1c8b0ad Applied patch from Aaron Mulder (ammulder@alumni.princeton.edu) that fixes
jdbc datasource support for jdk1.4/jdbc3

 Modified Files:
 	jdbc/build.xml jdbc/org/postgresql/Driver.java.in
 	jdbc/org/postgresql/jdbc2/optional/BaseDataSource.java
 	jdbc/org/postgresql/jdbc2/optional/PGObjectFactory.java
 	jdbc/org/postgresql/jdbc2/optional/PooledConnectionImpl.java
 	jdbc/org/postgresql/jdbc2/optional/PoolingDataSource.java
 	jdbc/org/postgresql/test/jdbc2/optional/BaseDataSourceTest.java
 	jdbc/org/postgresql/test/jdbc2/optional/OptionalTestSuite.java
 	jdbc/org/postgresql/test/jdbc3/Jdbc3TestSuite.java
 Added Files:
 	jdbc/org/postgresql/jdbc3/Jdbc3ConnectionPool.java
 	jdbc/org/postgresql/jdbc3/Jdbc3ObjectFactory.java
 	jdbc/org/postgresql/jdbc3/Jdbc3PooledConnection.java
 	jdbc/org/postgresql/jdbc3/Jdbc3PoolingDataSource.java
 	jdbc/org/postgresql/jdbc3/Jdbc3SimpleDataSource.java
 	jdbc/org/postgresql/test/jdbc2/optional/PoolingDataSourceTest.java
 	jdbc/org/postgresql/test/jdbc3/Jdbc3ConnectionPoolTest.java
 	jdbc/org/postgresql/test/jdbc3/Jdbc3PoolingDataSourceTest.java
 	jdbc/org/postgresql/test/jdbc3/Jdbc3SimpleDataSourceTest.java
 	jdbc/org/postgresql/test/util/MiniJndiContext.java
 	jdbc/org/postgresql/test/util/MiniJndiContextFactory.java
2002-09-25 07:01:31 +00:00
Tom Lane c6367df506 Change default privileges for languages and functions to be PUBLIC USAGE
and PUBLIC EXECUTE, respectively.  Per discussion about easing updates
from prior versions.
2002-09-24 23:14:25 +00:00
Tom Lane e92bec2844 Update some obsolete comments and column descriptions. 2002-09-24 21:26:44 +00:00
Peter Eisentraut 12bb3679db Remove useless O_DIROPEN stuff. 2002-09-24 20:20:10 +00:00
Peter Eisentraut 8c3ab663ab Tweak conversion names to follow the established naming scheme, and
document that scheme.
2002-09-24 20:14:59 +00:00
Tom Lane 83fd58dff0 Add missing correction of sublevelsup when pulling up a subquery.
Fixes problem with cases like
SELECT * FROM foo t WHERE NOT EXISTS (SELECT remoteid FROM
(SELECT f1 as remoteid FROM foo WHERE f1 = t.f1) AS t1)
2002-09-24 18:38:23 +00:00
Tom Lane 233ecca7c9 Further thinking about heap_mark4update: in HeapTupleSelfUpdated case,
executor should not return the tuple as successfully marked, because in
fact it's been deleted.  Not clear that this case has ever been seen
in practice (I think you'd have to write a SELECT FOR UPDATE that calls
a function that deletes some row the SELECT will visit later...) but we
should be consistent.  Also add comments to several other places that
got it right but didn't explain what they were doing.
2002-09-23 22:57:44 +00:00
Peter Eisentraut 0d3be98ae9 Move PyGreSQL usage documentation from README into DocBook. Some other
editing.
2002-09-23 21:10:13 +00:00
Tom Lane 5fa3418304 Disallow VACUUM, ANALYZE, TRUNCATE on temp tables belonging to other
backends.  Given that temp tables now store data locally in the local
buffer manager, these things are not going to work safely.
2002-09-23 20:43:41 +00:00
Bruce Momjian f9a1ea6fa7 Obviously noone has ever tested the doubling of availiable result ids
up to
reaching the hard limit. After opening 16(=current REST_START value)
results via pg_exec, the next pg_exec tries to find an empty slot
forever :-( . In PgSetResultId file pgtclId.c in the for loop there
has to be done a break, if res_max ist reached. The piece of code
should look like
        if (resid == connid->res_max)
        {
            resid = 0;
            break;   /* the break as to be added */
        }

now everything works (double available results after reaching
RES_START up to reaching RES_HARD_MAX)

Gerhard Hintermayer
2002-09-23 01:43:23 +00:00
Tom Lane bc1088c28a Get rid of bogus use of heap_mark4update in reindex operations (cf.
recent bug report).  Fix processing of nailed-in-cache indexes;
it appears that REINDEX DATABASE has been broken for months :-(.
2002-09-23 00:42:48 +00:00
Tom Lane df3e7b3a51 In UpdateStats(), don't bother to update the pg_class row if it already
contains the correct statistics.  This is a partial solution for the
problem of allowing concurrent CREATE INDEX commands: unless they commit
at nearly the same instant, the second one will see the first one's
pg_class updates as committed, and won't try to update again, thus
avoiding the 'tuple concurrently updated' failure.
2002-09-22 23:03:58 +00:00
Tom Lane 1d01d484c1 Remove commas for compatibility with newer releases of bison. 2002-09-22 21:56:47 +00:00
Tom Lane 67ddac35db Remove commas for compatibility with newer bisons. 2002-09-22 21:54:31 +00:00
Tom Lane 0582874506 Remove commas from %type and %token lists, for compatibility with newer
versions of bison.
2002-09-22 21:44:43 +00:00
Peter Eisentraut 2972fd5d83 Translation updates, some messages tweaked. 2002-09-22 20:57:21 +00:00
Tom Lane 3503f19eeb RelationClearRelation must reset rd_targblock and update rd_nblocks
even when dealing with a nailed-in-cache relation; otherwise, following
VACUUM truncation of a system catalog, other backends might have
unreasonably large values of these fields.
2002-09-22 20:56:28 +00:00
Tom Lane 286fb25243 Make \dS work more like it used to, viz, show only system objects. 2002-09-22 20:44:22 +00:00
Tom Lane 0b620e33db server_min_messages and friends should have valid values at bootup. 2002-09-22 19:52:38 +00:00
Tom Lane c328b6dd8b Replace pg_attribute.attisinherited with attislocal and attinhcount
columns, to allow more correct behavior in multiple-inheritance cases.
Patch by Alvaro Herrera, review by Tom Lane.
2002-09-22 19:42:52 +00:00
Tom Lane 9946b83ded Bring SIMILAR TO and SUBSTRING into some semblance of conformance with
the SQL99 standard.  (I'm not sure that the character-class features are
quite right, but that can be fixed later.)  Document SQL99 and POSIX
regexps as being different features; provide variants of SUBSTRING for
each.
2002-09-22 17:27:25 +00:00
Tom Lane ac355d558e Move most of the error checking for foreign-key constraints out of
parse analysis and into the execution code (in tablecmds.c).  This
eliminates a lot of unreasonably complex code that needed to have two
or more execution paths in case it was dealing with a not-yet-created
table column vs. an already-existing one.  The execution code is always
dealing with already-created tables and so needs only one case.  This
also eliminates some potential race conditions (the table wasn't locked
between parse analysis and execution), makes it easy to fix the gripe
about wrong referenced-column names generating a misleading error message,
and lets us easily add a dependency from the foreign-key constraint to
the unique index that it requires the referenced table to have.  (Cf.
complaint from Kris Jurka 12-Sep-2002 on pgsql-bugs.)

Also, third try at building a deletion mechanism that is not sensitive
to the order in which pg_depend entries are visited.  Adding the above-
mentioned dependency exposed the folly of what dependency.c had been
doing: it failed for cases where B depends on C while both auto-depend
on A.  Dropping A should succeed in this case, but was failing if C
happened to be visited before B.  It appears the only solution is two
separate walks over the dependency tree.
2002-09-22 00:37:09 +00:00
Tom Lane e303a2dbe8 Add last-ditch defense against attempts to compile datetime code with
-ffast-math.
2002-09-21 19:52:41 +00:00
Tom Lane eb3adab568 Provide an upgrade strategy for dump files containing functions declared
with OPAQUE.  CREATE LANGUAGE, CREATE TRIGGER, and CREATE TYPE will all
accept references to functions declared with OPAQUE --- but they will
issue a NOTICE, and will modify the function entries in pg_proc to have
the preferred type-safe argument or result types instead of OPAQUE.
Per recent pghackers discussions.
2002-09-21 18:39:26 +00:00
Tom Lane 7233aae50b Fix PPC s_lock operations to work correctly on multi-CPU machines.
Need 'isync' during TAS and 'sync' during S_UNLOCK.
2002-09-21 00:14:05 +00:00
Tom Lane b2735fcd52 Performance improvement for MultiRecordFreeSpace on large relations ---
avoid O(N^2) behavior.  Problem noted and fixed by Stephen Marshall <smarshall@wsicorp.com>,
with some help from Tom Lane.
2002-09-20 19:56:01 +00:00
Tom Lane 316d4e29b2 Code review for check-domain-constraints-in-COPY patch. Do correct thing
when default expression for a domain is being used.  Avoid repetitive
catalog lookups.
2002-09-20 16:56:02 +00:00
Tom Lane 4e5c2a8d52 Update regression expected results for to_char() change. 2002-09-20 16:44:55 +00:00
Bruce Momjian 5d115bb548 Change domain patch to COERCE_IMPLICIT_CAST, per Tom. 2002-09-20 15:43:03 +00:00
Bruce Momjian a1199e0c4c Fix compile error from Rod's patch. 2002-09-20 15:29:44 +00:00
Bruce Momjian c27d95e25d The patch fix bug described in TODO:
* to_char(0,'FM999.99') returns a period, to_char(1,'FM999.99') does not

Karel Zak
2002-09-20 03:57:09 +00:00
Bruce Momjian c51a049ef2 Tom Lane wrote:
> I see in your recent bytea-LIKE patch
>
>         if (datatype != BYTEAOID && pg_database_encoding_max_length()
> 1)
>             len = pg_mbcliplen((const unsigned char *) workstr, len,
len - 1);
>         else
>             len -= -1;
>
> Surely there's one too many minus signs in that last?

Joe Conway
2002-09-20 03:55:40 +00:00
Bruce Momjian 192b0c94f2 This patch cleans up some of the code in src/util/adt/formatting.c,
fixes a few minor bugs (typos, potential buffer overruns, etc.), and
fixes some spelling/grammar mistakes.

Neil Conway
2002-09-20 03:54:57 +00:00
Bruce Momjian 229eebd559 This patch fixes two typos in src/backend/storage/ipc/README.
Neil Conway
2002-09-20 03:53:55 +00:00
Bruce Momjian 07a6fa9df1 Fixed this problem and added regression tests in domain.sql.
Also:
- Changed header file order (alphabetical)
- Changed to m = attnum - 1 in binary copy code for consistency

Rod Taylor
2002-09-20 03:52:50 +00:00
Bruce Momjian a834cbe1e9 > I'm not sure why NDirectFileRead/NDirectFileWrite are unused at the
> moment, but they used to be used; I think the correct response is to
> put back the missing counter increments, not rip out the counters.

Ok, fair enough. It's worth noting that they've been broken for a
while -- for example, the HashJoin counter increments were broken when
you comitted r1.20 of executor/nodeHashJoin.c in May of '99.

I've attached a revised patch that doesn't remove the counters (but
doesn't increment them either: I'm not sure of all the places where
the counter should be incremented).

Neil Conway
2002-09-20 03:45:08 +00:00
Tom Lane da395b56cd Tweak heap.c to refuse attempts to create table columns of standalone
composite types.  Add a couple more lsyscache.c routines to support this,
and make use of them in some other places that were doing lookups the
hard way.
2002-09-19 23:40:56 +00:00
Tom Lane 4a0c3a6142 Department of second thoughts: suppressing implicit casts everywhere in
ruleutils display is not such a great idea.  For arguments of functions
and operators I think we'd better keep the historical behavior of showing
such casts explicitly, to ensure that the function/operator is reparsed
the same way when the rule is reloaded.  This also makes the output of
EXPLAIN less obscurantist about exactly what's happening.
2002-09-19 22:48:34 +00:00
Tom Lane b26dfb9522 Extend pg_cast castimplicit column to a three-way value; this allows us
to be flexible about assignment casts without introducing ambiguity in
operator/function resolution.  Introduce a well-defined promotion hierarchy
for numeric datatypes (int2->int4->int8->numeric->float4->float8).
Change make_const to initially label numeric literals as int4, int8, or
numeric (never float8 anymore).
Explicitly mark Func and RelabelType nodes to indicate whether they came
from a function call, explicit cast, or implicit cast; use this to do
reverse-listing more accurately and without so many heuristics.
Explicit casts to char, varchar, bit, varbit will truncate or pad without
raising an error (the pre-7.2 behavior), while assigning to a column without
any explicit cast will still raise an error for wrong-length data like 7.3.
This more nearly follows the SQL spec than 7.2 behavior (we should be
reporting a 'completion condition' in the explicit-cast cases, but we have
no mechanism for that, so just do silent truncation).
Fix some problems with enforcement of typmod for array elements;
it didn't work at all in 'UPDATE ... SET array[n] = foo', for example.
Provide a generalized array_length_coerce() function to replace the
specialized per-array-type functions that used to be needed (and were
missing for NUMERIC as well as all the datetime types).
Add missing conversions int8<->float4, text<->numeric, oid<->int8.
initdb forced.
2002-09-18 21:35:25 +00:00
Tatsuo Ishii 4b23f05c4f Fix bug in encoding conversion map. 2002-09-18 02:10:10 +00:00
Tatsuo Ishii 4c0bdd1ba8 Update Japanese README so that it reflects the changes made to the
conversion function interface.
2002-09-18 01:21:28 +00:00
Bruce Momjian ff9973a8f1 Remove src/test/regress/sql: plpgsql-nsp-testing.sql per Joe Conway. 2002-09-17 04:27:41 +00:00
Tom Lane c53bb2759f Un-break duplicate_oids script. 2002-09-17 01:28:36 +00:00
Bruce Momjian a2ba9a76b8 Remove retest Makefile entry because it does not compile. 2002-09-16 16:02:43 +00:00
Tom Lane 53e95eee84 Fix for rare race-condition-like failure: if a backend receives SIGUSR2
(notify/SI-overrun interrupt) while it is in process of doing proc_exit,
it is possible for Async_NotifyHandler() to try to start a transaction
when one is already running.  This leads to Asserts() or worse.  I think
it may only be possible to occur when frontend synchronization is lost
(ie, the elog(FATAL) in SocketBackend() fires), but that is a standard
occurrence after error during COPY.  In any case, I have seen this
failure occur during regression tests, so it is definitely possible.
2002-09-16 01:24:41 +00:00
Peter Eisentraut 5ea9322872 Cast functions can be immutable or stable. 2002-09-15 13:04:16 +00:00
Tom Lane db4f3c0334 Update obsolete comment. 2002-09-14 22:14:49 +00:00
Tom Lane c91b8bc537 Cosmetic fixes from Neil Conway. 2002-09-14 19:59:20 +00:00
Tom Lane f7978c6f1d Avoid overflow for large elapsed times in \timing output. Per
Kenji Sugita.
2002-09-14 19:46:01 +00:00
Peter Eisentraut 49c86099f3 Shrink the pg_hba.conf and pg_ident.conf default files and move most of the
inline documentation to the main docs.
2002-09-14 18:35:46 +00:00
Peter Eisentraut d73f8137d2 Translation updates 2002-09-14 13:46:24 +00:00
Barry Lind 7d6a055a7f Added regression test for using server side prepared statements in jdbc
and fixed a bug found by the regression test

 Modified Files:
 	jdbc/org/postgresql/jdbc1/AbstractJdbc1Statement.java
 	jdbc/org/postgresql/test/jdbc2/Jdbc2TestSuite.java
 Added Files:
 	jdbc/org/postgresql/test/jdbc2/ServerPreparedStmtTest.java
2002-09-14 03:52:56 +00:00
Tatsuo Ishii 3357577247 Change Assert(len > 0) to Assert(len >= 0)
Change PG_RETURN_INT32(0) to PG_RETURN_VOID()
2002-09-13 06:41:18 +00:00
Tom Lane feb202193d Fix likely cause of rare ALTER TABLE ADD FOREIGN KEY failures ---
don't assume relname field of a relcache entry will stay valid across
lots of operations.
2002-09-12 21:16:42 +00:00
Tom Lane 2b0319869a Avoid misleading error message when SET/RESET target variable name
doesn't match any known variable.
2002-09-12 14:03:45 +00:00
Bruce Momjian 7184a428a2 The small context diff below corrects what seems to be an oversight in
fmgr.h - it's discouraged to access fcinfo directly but there is no
macro to get the number of arguments passed to the function. Checking
the number of arguments is often useful when you have a function which
can be called like:

 func('arg');
 func(null);
 func();

all mapping to the same C function.

the macro has a function-like appearance to match the other PG_*
macros.

Lee Kindness.
2002-09-12 00:26:42 +00:00
Bruce Momjian b3f52320f6 > Sean Chittenden <sean@chittenden.org> writes:
>
>>::sigh:: Is it me or does it look like all
>>of pl/pgsql is schema un-aware (ie, all of the declarations).  -sc
>
>
> Yeah.  The group of routines parse_word, parse_dblword, etc that are
> called by the lexer certainly all need work.  There are some
> definitional issues to think about, too --- plpgsql presently relies on
> the number of names to give it some idea of what to look for, and those
> rules are probably all toast now.  Please come up with a sketch of what
> you think the behavior should be before you start hacking code.

Attached is a diff -c format proposal to fix this. I've also attached a short
test script. Seems to work OK and passes all regression tests.

Here's a breakdown of how I understand plpgsql's "Special word rules" -- I
think it illustrates the behavior reasonably well. New functions added by this
patch are plpgsql_parse_tripwordtype and plpgsql_parse_dblwordrowtype:

Joe Conway
2002-09-12 00:24:10 +00:00
Bruce Momjian 81186865fe Joe Conway wrote:
> Hannu Krosing wrote:
 >
 >> It seems that my last mail on this did not get through to the list
 >> ;(
 >>
 >> Please consider renaming the new builtin function
 >> split(text,text,int)
 >>
 >> to something else, perhaps
 >>
 >> split_part(text,text,int)
 >>
 >> (like date_part)
 >>
 >> The reason for this request is that 3 most popular scripting
 >> languages (perl, python, php) all have also a function with similar
 >> signature, but returning an array instead of single element and the
 >> (optional) third argument is limit (maximum number of splits to
 >> perform)
 >>
 >> I think that it would be good to have similar function in (some
 >> future release of) postgres, but if we now let in a function with
 >> same name and arguments but returning a single string instead an
 >> array of them, then we will need to invent a new and not so easy to
 >> recognise name for the "real" split function.
 >>
 >
 > This is a good point, and I'm not opposed to changing the name, but
 > it is too bad your original email didn't get through before beta1 was
 >  rolled. The change would now require an initdb, which I know we were
 >  trying to avoid once beta started (although we could change it
 > without *requiring* an initdb I suppose).
 >
 > I guess if we do end up needing an initdb for other reasons, we
 > should make this change too. Any other opinions? Is split_part an
 > acceptable name?
 >
 > Also, if we add a todo to produce a "real" split function that
 > returns an array, similar to those languages, I'll take it for 7.4.

No one commented on the choice of name, so the attached patch changes
the name of split(text,text,int) to split_part(text,text,int) per
Hannu's recommendation above. This can be applied without an initdb if
current beta testers are advised to run:

   update pg_proc set proname = 'split_part' where proname = 'split';

in the case they want to use this function. Regression and doc fix is
also included in the patch.

Joe Conway
2002-09-12 00:21:25 +00:00