Commit Graph

6226 Commits

Author SHA1 Message Date
Bruce Momjian 54c8e821b8 In my mind there were two categories of open issues
a) ones that are 100% backward (such as the comment about
     outputting this format)
and
  b) ones that aren't (such as deprecating the current
     postgresql shorthand of
         '1Y1M'::interval = 1 year 1 minute
     in favor of the ISO-8601
         'P1Y1M'::interval = 1 year 1 month.

Attached is a patch that addressed all the discussed issues that
did not break backward compatability, including the ability to
output ISO-8601 compliant intervals by setting datestyle to
iso8601basic.

Interval values can now be written as  ISO 8601 time intervals, using
the "Format with time-unit designators". This format always starts with
the character 'P', followed  by a string of values followed
by single character time-unit designators. A 'T' separates the date and
time parts of the interval.

Ron Mayer
2003-12-20 15:32:55 +00:00
Peter Eisentraut f39748a70f Forbid REVOKE on untrusted languages, and don't dump privileges of
untrusted languages (in case they sneak in).
2003-12-19 14:21:56 +00:00
Tom Lane 7fc2d50877 Make to_hex() behave portably on negative input values (treat them as
unsigned integers).  Per report from Jim Crate.
2003-12-19 04:56:41 +00:00
Joe Conway edc7f146e3 Use a shutdown callback to ensure proper clean up when rescanning
partially-evaluated SRFs. Per report found here:
http://archives.postgresql.org/pgsql-general/2003-12/msg00851.php
2003-12-19 00:02:11 +00:00
Tom Lane e0cd175212 Fix memory leak with SSL connections due to missing X509_free() calls.
Per Neil Conway.
2003-12-18 22:49:26 +00:00
Tom Lane 54840eca2e Use a shutdown callback to clear setArgsValid in a FuncExprState that is
evaluating a set-valued function.  This fixes some additional problems
with rescanning partially-evaluated SRFs.
2003-12-18 22:23:42 +00:00
Tom Lane 38423232a5 Ensure set-returning functions in the targetlist of a plan node will be
shut down cleanly if the plan node is ReScanned before the SRFs are run
to completion.  This fixes the problem for SQL-language functions, but
still need work on functions using the SRF_XXX() macros.
2003-12-18 20:21:37 +00:00
Bruce Momjian ed96bfde18 Here is the definition of relation_byte_size() in optimizer/path/costsize.c:
----------------------------------------------------------------------
/*
 * relation_byte_size
 *        Estimate the storage space in bytes for a given number of tuples
 *        of a given width (size in bytes).
 */
static double
relation_byte_size(double tuples, int width)
{
        return tuples * (MAXALIGN(width) + MAXALIGN(sizeof(HeapTupleData)));
}

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

Shouldn't this be HeapTupleHeaderData and not HeapTupleData ?

(Of course, from a costing perspective these shouldn't be very different but ...)

Sailesh Krishnamurthy
2003-12-18 03:46:45 +00:00
Tom Lane 109a4a603f Be a little smarter in group_clauses_by_indexkey_for_join: detect cases
where a joinclause is redundant with a restriction clause.  Original coding
believed this was impossible and didn't need to be checked for, but that
was a thinko ...
2003-12-18 00:22:12 +00:00
Tom Lane 422249120d information_schema.constraint_column_usage and key_column_usage should
not discriminate against system columns, since we support constraints on
system columns, and in fact constraints on OID are moderately useful.
2003-12-17 22:11:30 +00:00
Tom Lane 78f637c6da Fix DecodeInterval to handle '-0.1' sanely, per gripe from Tilo Schwarz. 2003-12-17 21:45:44 +00:00
Tom Lane f758097c6d Reorder tests in parse_coerce so that ANY/ANYELEMENT/ANYARRAY coercion
does not affect UNKNOWN-type literals or Params.  This fixes the recent
complaint about count('x') being broken, and improves consistency in
a few other respects too.
2003-12-17 19:49:39 +00:00
Tom Lane 99e922a01d Repair planner failure when there are multiple IN clauses, each with
a join in its subselect.  In this situation we *must* build a bushy
plan because there are no valid left-sided or right-sided join trees.
Accordingly, hoary sanity check needs an update.  Per report from
Alessandro Depase.
2003-12-17 17:07:48 +00:00
Peter Eisentraut 0fb3ec1a58 Fix constraint_column_usage for foreign keys. 2003-12-16 14:57:20 +00:00
Bruce Momjian 19055b78ef Add mention with might need to use cp -R someday for portability. 2003-12-15 22:56:44 +00:00
Neil Conway fef0c8345a I posted some bufmgr cleanup a few weeks ago, but it conflicted with
some concurrent changes Jan was making to the bufmgr. Here's an
updated version of the patch -- it should apply cleanly to CVS
HEAD and passes the regression tests.

This patch makes the following changes:

     - remove the UnlockAndReleaseBuffer() and UnlockAndWriteBuffer()
       macros, and replace uses of them with calls to the appropriate
       functions.

     - remove a bunch of #ifdef BMTRACE code: it is ugly & broken
       (i.e. it doesn't compile)

     - make BufferReplace() return a bool, not an int

     - cleanup some logic in bufmgr.c; should be functionality
       equivalent to the previous code, just cleaner now

     - remove the BM_PRIVATE flag as it is unused

     - improve a few comments, etc.
2003-12-14 00:34:47 +00:00
Peter Eisentraut 2afacfc403 This patch properly sets the prototype for the on_shmem_exit and
on_proc_exit functions, and adjust all other related code to use
the proper types too.

by Kurt Roeckx
2003-12-12 18:45:10 +00:00
Tom Lane 2d83e7c73c query_tree_mutator should copy RangeTblEntry nodes even when it's not
planning to modify them itself.  Otherwise we end up with shared RTE
substructure, which breaks inheritance_planner because the rte->inh
flag needs to be independent in each copied subquery.  Per bug report
from Chris Piker.
2003-12-09 01:56:20 +00:00
Tom Lane b281ea8cf1 Whole-row references were broken for subqueries and functions, because
attr_needed/attr_widths optimization failed to allow for Vars with attno
zero in this case.  Per report from Tatsuo Ishii.
2003-12-08 18:19:58 +00:00
Tom Lane 80af69ceaa Remove test on c.relkind from check_constraints view; unnecessary and
prevents view from showing constraints on domains.  This addresses the
other half of Claus Colloseus' bug report.
2003-12-07 19:43:02 +00:00
Peter Eisentraut d9d72bcb91 Fix typmod interpretation for bit types. (It was erroneously assumed that
for bit(x), the typmod stores x+4, like for the character types.)
2003-12-07 10:21:58 +00:00
Joe Conway 53e7c1363a Repair indexed bytea like operations, and related selectivity
functionality. Per bug report by Alvar Freude:
http://archives.postgresql.org/pgsql-bugs/2003-12/msg00022.php
2003-12-07 04:14:10 +00:00
Tom Lane a5ffa8fea4 Guard against bug in Solaris' bsearch(), per Michael Wildpaner. 2003-12-05 15:50:31 +00:00
Joe Conway 66989aa2d6 Added new group of read-only GUC variables to allow simple access
to certain compile-time options (FUNC_MAX_ARGS, INDEX_MAX_KEYS,
NAMEDATALEN, BLCKSZ, HAVE_INT64_TIMESTAMP). Also added "category",
"short_desc", and "extra_desc" to the pg_settings view. Per recent
discussion here:
http://archives.postgresql.org/pgsql-patches/2003-11/msg00363.php
2003-12-03 18:52:00 +00:00
Tom Lane 7f8f7665fc Planner failed to be smart about binary-compatible expressions in pathkeys
and hash bucket-size estimation.  Issue has been there awhile but is more
critical in 7.4 because it affects varchar columns.  Per report from
Greg Stark.
2003-12-03 17:45:10 +00:00
Joe Conway e2605c8311 Add a warning to AtEOXact_SPI() to catch cases where the current
transaction has been committed without SPI_finish() being called
first. Per recent discussion here:
http://archives.postgresql.org/pgsql-patches/2003-11/msg00286.php
2003-12-02 19:26:47 +00:00
Tom Lane 145d9fa46c Code and docs review for numeric-factorial patch. 2003-12-02 00:26:59 +00:00
Bruce Momjian ffb087ced5 This patch refactors execTuples.c in two ways.
Neil Conway
2003-12-01 23:09:02 +00:00
Tom Lane 5e2b99db95 Avoid assuming that type key_t is 32 bits, since it reportedly isn't
on 64-bit Solaris.  Use a non-system-dependent datatype for UsedShmemSegID,
namely unsigned long (which we were already assuming could hold a shmem
key anyway, cf RecordSharedMemoryInLockFile).
2003-12-01 22:15:38 +00:00
Bruce Momjian 7ce9b7c0d8 This patch adds a new GUC var, "default_with_oids", which follows the
proposal for eventually deprecating OIDs on user tables that I posted
earlier to pgsql-hackers. pg_dump now always specifies WITH OIDS or
WITHOUT OIDS when dumping a table. The documentation has been updated.

Neil Conway
2003-12-01 22:08:02 +00:00
Bruce Momjian e7ca867485 Try to reduce confusion about what is a lock method identifier, a lock
method control structure, or a table of control structures.

. Use type LOCKMASK where an int is not a counter.

. Get rid of INVALID_TABLEID, use INVALID_LOCKMETHOD instead.

. Use INVALID_LOCKMETHOD instead of (LOCKMETHOD) NULL, because
  LOCKMETHOD is not a pointer.

. Define and use macro LockMethodIsValid.

. Rename LOCKMETHOD to LOCKMETHODID.

. Remove global variable LongTermTableId in lmgr.c, because it is
  never used.

. Make LockTableId static in lmgr.c, because it is used nowhere else.
  Why not remove it and use DEFAULT_LOCKMETHOD?

. Rename the lock method control structure from LOCKMETHODTABLE to
  LockMethodData.  Introduce a pointer type named LockMethod.

. Remove elog(FATAL) after InitLockTable() call in
  CreateSharedMemoryAndSemaphores(), because if something goes wrong,
  there is elog(FATAL) in LockMethodTableInit(), and if this doesn't
  help, an elog(ERROR) in InitLockTable() is promoted to FATAL.

. Make InitLockTable() void, because its only caller does not use its
  return value any more.

. Rename variables in lock.c to avoid statements like
        LockMethodTable[NumLockMethods] = lockMethodTable;
        lockMethodTable = LockMethodTable[lockmethod];

. Change LOCKMETHODID type to uint16 to fit into struct LOCKTAG.

. Remove static variables BITS_OFF and BITS_ON from lock.c, because
  I agree to this doubt:
 * XXX is a fetch from a static array really faster than a shift?

. Define and use macros LOCKBIT_ON/OFF.


Manfred Koizar
2003-12-01 21:59:25 +00:00
Bruce Momjian 04a4821ade Attached is a patch implementing factorial(), returning numeric. Points
to note:

1) arttype is numeric. I thought this was the best way of allowing
arbitarily large factorials, even though factorial(2^63) is a large
number. Happy to change to integers if this is overkill.
2) since we're accepting numeric arguments, the patch tests for floats.
If a numeric is passed with non-zero decimal portion, an error is raised
since (from memory) they are undefined.

Gavin Sherry
2003-12-01 21:52:38 +00:00
Tom Lane c5336a892f netmask() and hostmask() functions should return maximum-length masklen,
per gripe from Joe Sunday.
2003-12-01 18:50:19 +00:00
Tom Lane 0902ece5b9 Force zero_damaged_pages to be effectively ON during recovery from WAL,
since there is no need to worry about damaged pages when we are going to
overwrite them anyway from the WAL.  Per recent discussion.
2003-12-01 16:53:19 +00:00
Bruce Momjian 64e5a85625 Seems there are three GUC variables that are defined as "Shows ..."
while you can actually set them with SET.

This applied patch changes the wording from "Show" to "Set".
2003-12-01 03:55:21 +00:00
Joe Conway b8f40ced2f Make PQescapeBytea and byteaout consistent with each other, and
octal escape all octets outside the range 0x20 to 0x7e. This fixes
the problem pointed out by Sergey Yatskevich here:
http://archives.postgresql.org/pgsql-bugs/2003-11/msg00140.php
2003-11-30 20:55:09 +00:00
PostgreSQL Daemon 55b113257c make sure the $Id tags are converted to $PostgreSQL as well ... 2003-11-29 22:41:33 +00:00
Tom Lane 4c274b4f8a Put out a more useful version indication in the welcome banner for a
standalone backend --- the CVS revision number of postgres.c is not real
useful to anyone.
2003-11-29 21:40:43 +00:00
PostgreSQL Daemon 969685ad44 $Header: -> $PostgreSQL Changes ... 2003-11-29 19:52:15 +00:00
Peter Eisentraut c9190ef074 Conditionalize variable that is only used conditionally, to avoid warning. 2003-11-27 18:12:50 +00:00
Tom Lane 9ea738827c Second try at fixing no-room-to-move-down PANIC in compact_fsm_storage.
Ward's report that it can still happen in RC2 forces me to realize that
this is not a can't-happen condition after all, and that the compaction
code had better cope rather than panicking.
2003-11-26 20:50:11 +00:00
Tom Lane e7a45c787e Repair subselect.c's occasional assignment of the wrong vartypmod to
Vars created to fill subplan args lists.  This is an ancient error, going
back at least to 7.0, but is more easily triggered in 7.4 than before
because we no longer compare varlevelsup when deciding whether a Param
slot can be re-used.  Fixes bug reported by Klint Gore.
2003-11-25 23:59:12 +00:00
Tom Lane a64846f3ad Get rid of hashkeys field of Hash plan node, since it's redundant with
the hashclauses field of the parent HashJoin.  This avoids problems with
duplicated links to SubPlans in hash clauses, as per report from
Andrew Holm-Hansen.
2003-11-25 21:00:54 +00:00
Tom Lane 1c5f223e25 Overdue code review for ALTER SEQUENCE patch. Don't generate illegal Node
tree for CYCLE option; don't assume zeros are invalid values for sequence
fields other than increment_by; don't reset cache_value when not told to;
simplify code for testing whether to apply defaults.
2003-11-24 16:54:07 +00:00
Tom Lane c52204b224 Repair missed renamings of show_statement_stats and show_executor_stats. 2003-11-24 14:49:51 +00:00
Tom Lane 42ce74bf17 COMMENT ON casts, conversions, languages, operator classes, and
large objects.  Dump all these in pg_dump; also add code to pg_dump
user-defined conversions.  Make psql's large object code rely on
the backend for inserting/deleting LOB comments, instead of trying to
hack pg_description directly.  Documentation and regression tests added.

Christopher Kings-Lynne, code reviewed by Tom
2003-11-21 22:32:49 +00:00
Tom Lane 0a97cb37fc Remove unused variable. 2003-11-21 17:41:31 +00:00
Jan Wieck cfeca62148 Background writer process
This first part of the background writer does no syncing at all.
It's only purpose is to keep the LRU heads clean so that regular
backends seldom to never have to call write().

Jan
2003-11-19 15:55:08 +00:00
Tom Lane 1a908a00b0 Fix datetime input parsing to accept YYYY-MONTHNAME-DD and related syntaxes,
which had been unintentionally broken by recent changes to tighten up the
DateStyle rules for all-numeric date input.  Add documentation and
regression tests for this, too.
2003-11-16 20:29:16 +00:00
Jan Wieck 1f45555892 Changed parameter name for shared cache status report interval to
debug_shared_buffers = <seconds>

as per previous discussion.


Jan
2003-11-16 16:41:01 +00:00