Commit Graph

296 Commits

Author SHA1 Message Date
Bruce Momjian ee4aa3021e Improve documentation for COALESCE and NULLIF. Add references for NVL
and IFNULL.

Backpatch to 8.1.X.
2005-11-28 23:18:48 +00:00
Tom Lane 659f681638 Change array comparison rules to consider dimensionality information,
not only the array contents, before claiming two arrays are equal.
Per recent discussion.
2005-11-19 19:44:55 +00:00
Tom Lane 1e9a1a70ad Change array_push and array_cat so that they retain the lower bound of
the array (for array_push) or higher-dimensional array (for array_cat)
rather than decrementing it as before.  This avoids generating lower
bounds other than one for any array operation within the SQL spec.  Per
recent discussion.
Interestingly, this seems to have been the original behavior, because
while updating the docs I noticed that a large fraction of relevant
examples were *wrong* for the old behavior and are now right.  Is it
worth correcting this in the back-branch docs?
2005-11-19 01:50:08 +00:00
Tom Lane cecb607559 Make SQL arrays support null elements. This commit fixes the core array
functionality, but I still need to make another pass looking at places
that incidentally use arrays (such as ACL manipulation) to make sure they
are null-safe.  Contrib needs work too.
I have not changed the behaviors that are still under discussion about
array comparison and what to do with lower bounds.
2005-11-17 22:14:56 +00:00
Bruce Momjian 04ce3cb02d Properly document return value of strpos(). 2005-11-16 03:56:16 +00:00
Peter Eisentraut 39dfbe5791 Spellchecking run, final cleanups 2005-11-04 23:14:02 +00:00
Tom Lane 03381695c6 Avoid referring to a specific version of the SQL standard except where
necessary, and be careful to refer to the right version where it is
useful to do so.  This partially reverts an ill-considered search and
replace from a few months ago.
2005-11-04 02:56:31 +00:00
Tom Lane c78f3039f2 Small grammar correction. 2005-10-25 15:47:51 +00:00
Tom Lane 220f2a7d15 Code review for regexp_replace patch. Improve documentation and comments,
fix problems with replacement-string backslashes that aren't followed by
one of the expected characters, avoid giving the impression that
replace_text_regexp() is meant to be called directly as a SQL function,
etc.
2005-10-18 20:38:58 +00:00
Tom Lane aa731ed843 Change nextval and other sequence functions to specify their sequence
argument as a 'regclass' value instead of a text string.  The frontend
conversion of text string to pg_class OID is now encapsulated as an
implicitly-invocable coercion from text to regclass.  This provides
backwards compatibility to the old behavior when the sequence argument
is explicitly typed as 'text'.  When the argument is just an unadorned
literal string, it will be taken as 'regclass', which means that the
stored representation will be an OID.  This solves longstanding problems
with renaming sequences that are referenced in default expressions, as
well as new-in-8.1 problems with renaming such sequences' schemas or
moving them to another schema.  All per recent discussion.
Along the way, fix some rather serious problems in dbmirror's support
for mirroring sequence operations (int4 vs int8 confusion for instance).
2005-10-02 23:50:16 +00:00
Neil Conway e4d9b69779 Rename pg_complete_relation_size() to pg_total_relation_size(), for the
sake of brevity and clarity.

Make pg_reload_conf(), pg_rotate_logfile(), and pg_cancel_backend()
return a boolean rather than an integer to indicate success or failure.

Along the way, make some minor cleanups to dbsize.c -- in particular,
use elog() rather than ereport() for "shouldn't happen" error
conditions, and remove some of the more flagrant violations of the
Postgres indentation conventions.

Catalog version bumped.
2005-09-16 05:35:41 +00:00
Neil Conway 3b0453b24f Various documentation improvements. Add a lot of index entries for
the builtin functions (although some more entries are still needed),
and remove the duplicate index entries that have been causing
collateindex.pl warnings. Consistently use "int" and "bigint", rather
than a mix of "int", "integer", "int4", "bigint", and "int8". Make
parenthesis style in syntax examples more consistent. Various
copy-editing for newly-added documentation and SGML markup fixes.
2005-09-14 21:14:26 +00:00
Tom Lane a239af02c3 Fix the various forms of AT TIME ZONE to accept either timezones found
in the zic database or zone names found in the date token table.  This
preserves the old ability to do AT TIME ZONE 'PST' along with the new
ability to do AT TIME ZONE 'PST8PDT'.  Per gripe from Bricklen Anderson.
Also, fix some inconsistencies in usage of TZ_STRLEN_MAX --- the old
code had the potential for one-byte buffer overruns, though given
alignment considerations it's unlikely there was any real risk.
2005-09-09 02:31:50 +00:00
Bruce Momjian 4ea18a11fa Fix memory leak when using justify_hours. 2005-08-25 01:30:06 +00:00
Tom Lane 009e8d44f8 Remove statement that to_char(interval) is deprecated; seems we are
going to keep it after all.
2005-08-24 20:49:35 +00:00
Bruce Momjian 070a3ad76b Rename pg_stat_file columns to be more consistent. Split apart change
and creation columns to behave for Unix or Win32.
2005-08-15 23:00:14 +00:00
Tom Lane 2af9a44fa9 Make pg_stat_file() use OUT parameters so that the user doesn't have to
remember the output parameter set for himself.  It's a bit of a kluge
but fixing array_in to work in bootstrap mode looks worse.
I removed the separate pg_file_length() function, as it no longer has any
real notational advantage --- you can write (pg_stat_file(...)).length.
2005-08-13 19:02:34 +00:00
Tom Lane a43ea120bf Code & docs review for server instrumentation patch. File timestamps
should surely be timestamptz not timestamp; fix some but not all of the
holes in check_and_make_absolute(); other minor cleanup.  Also put in
the missed catversion bump.
2005-08-12 18:23:56 +00:00
Bruce Momjian cb29f669b0 Add markup for GUC mention in docs. 2005-08-12 15:57:48 +00:00
Bruce Momjian b609695b7a Add files to do read I/O on the cluster directory:
pg_stat_file()
	pg_read_file()
	pg_ls_dir()
	pg_reload_conf()
	pg_rotate_logfile()

Dave Page
Andreas Pflug
2005-08-12 03:25:13 +00:00
Tom Lane 0001e98d54 Code and docs review for pg_column_size() patch. 2005-08-02 16:11:57 +00:00
Tom Lane ecf7fccebc Fix broken markup and spelling, put paragraph in a somewhat less random
place.
2005-07-30 22:53:15 +00:00
Bruce Momjian b2b6548c79 Please find attached diffs for documentation and simple regression
tests for the new interval->day changes. I added tests for
justify_hours() and justify_days() to interval.sql, as they take
interval input and produce interval output. If there's a more
appropriate place for them, please let me know.

Michael Glaesemann
2005-07-30 14:52:04 +00:00
Bruce Momjian 358a897fa1 Move dbsize functions into the backend. New functions:
pg_tablespace_size
	pg_database_size
	pg_relation_size
	pg_complete_relation_size
	pg_size_pretty

Remove /contrib/dbsize.

Dave Page
2005-07-29 14:47:04 +00:00
Tom Lane af019fb9ae Add a role property 'rolinherit' which, when false, denotes that the role
doesn't automatically inherit the privileges of roles it is a member of;
for such a role, membership in another role can be exploited only by doing
explicit SET ROLE.  The default inherit setting is TRUE, so by default
the behavior doesn't change, but creating a user with NOINHERIT gives closer
adherence to our current reading of SQL99.  Documentation still lacking,
and I think the information schema needs another look.
2005-07-26 16:38:29 +00:00
Tom Lane f9fd176461 Add pg_has_role() family of privilege inquiry functions modeled after the
existing ones for object privileges.  Update the information_schema for
roles --- pg_has_role() makes this a whole lot easier, removing the need
for most of the explicit joins with pg_user.  The views should be a tad
faster now, too.  Stephen Frost and Tom Lane.
2005-07-26 00:04:19 +00:00
Tom Lane e5d6b91220 Add SET ROLE. This is a partial commit of Stephen Frost's recent patch;
I'm still working on the has_role function and information_schema changes.
2005-07-25 22:12:34 +00:00
Bruce Momjian 261026575d Fix AT TIME ZONE for timestamps without time zones:
test=> select ('2005-07-20 00:00:00'::timestamp without time zone) at
	time zone 'Europe/Paris';
	        timezone
	------------------------
	 2005-07-19 22:00:00-04

Udpate documentation.
2005-07-22 21:16:15 +00:00
Bruce Momjian db05f4a7eb Add 'day' field to INTERVAL so 1 day interval can be distinguished from
24 hours. This is very helpful for daylight savings time:

	select '2005-05-03 00:00:00 EST'::timestamp with time zone + '24 hours';
	      ?column?
	----------------------
	2005-05-04 01:00:00-04

	select '2005-05-03 00:00:00 EST'::timestamp with time zone + '1 day';
	      ?column?
	----------------------
	2005-05-04 01:00:00-04

Michael Glaesemann
2005-07-20 16:42:32 +00:00
Tom Lane 37464a0326 Fix some bogosities in geometric-function documentation: add an entry
for circle(polygon), which was missing; remove bogus entry for
point(lseg, lseg), which does not exist, and the documentation seemed to
describe lseg_interpt, which we already document as an operator not a
function.  Also remove entry for box_intersect, which likewise is
preferentially used via the operator #.
2005-07-18 22:34:14 +00:00
Bruce Momjian 5e544e4eb7 Fix SGML spacing. 2005-07-15 19:02:12 +00:00
Neil Conway c3f1b0f4dd This doc patch replaces all inappropriate references to SQL:1999 when it
is used as if it were the latest (and/or still valid) SQL standard.
SQL:2003 is used in its place. Patch from Simon Riggs.
2005-07-14 06:17:36 +00:00
Bruce Momjian 75a64eeb4b I made the patch that implements regexp_replace again.
The specification of this function is as follows.

regexp_replace(source text, pattern text, replacement text, [flags
text])
returns text

Replace string that matches to regular expression in source text to
replacement text.

 - pattern is regular expression pattern.
 - replacement is replace string that can use '\1'-'\9', and '\&'.
    '\1'-'\9': back reference to the n'th subexpression.
    '\&'     : entire matched string.
 - flags can use the following values:
    g: global (replace all)
    i: ignore case
    When the flags is not specified, case sensitive, replace the first
    instance only.

Atsushi Ogawa
2005-07-10 04:54:33 +00:00
Bruce Momjian a923602855 Add pg_column_size() to return storage size of a column, including
possible compression.

Mark Kirkwood
2005-07-06 19:02:54 +00:00
Bruce Momjian a29d815a7a Improve gettimeofday() documentation.
Karl O. Pinc
2005-06-29 01:52:56 +00:00
Tom Lane 7762619e95 Replace pg_shadow and pg_group by new role-capable catalogs pg_authid
and pg_auth_members.  There are still many loose ends to finish in this
patch (no documentation, no regression tests, no pg_dump support for
instance).  But I'm going to commit it now anyway so that Alvaro can
make some progress on shared dependencies.  The catalog changes should
be pretty much done.
2005-06-28 05:09:14 +00:00
Tom Lane 943b396245 Add Oracle-compatible GREATEST and LEAST functions. Pavel Stehule 2005-06-26 22:05:42 +00:00
Tom Lane b90f8f20f0 Extend r-tree operator classes to handle Y-direction tests equivalent
to the existing X-direction tests.  An rtree class now includes 4 actual
2-D tests, 4 1-D X-direction tests, and 4 1-D Y-direction tests.
This involved adding four new Y-direction test operators for each of
box and polygon; I followed the PostGIS project's lead as to the names
of these operators.
NON BACKWARDS COMPATIBLE CHANGE: the poly_overleft (&<) and poly_overright
(&>) operators now have semantics comparable to box_overleft and box_overright.
This is necessary to make r-tree indexes work correctly on polygons.
Also, I changed circle_left and circle_right to agree with box_left and
box_right --- formerly they allowed the boundaries to touch.  This isn't
actually essential given the lack of any r-tree opclass for circles, but
it seems best to sync all the definitions while we are at it.
2005-06-24 20:53:34 +00:00
Neil Conway 4aaff55359 Minor SGML markup cleanup. 2005-06-15 06:29:25 +00:00
Bruce Momjian 0851a6fbc7 This patch makes it possible to use the full set of timezones when doing
"AT TIME ZONE", and not just the shorlist previously available. For
example:

SELECT CURRENT_TIMESTAMP AT TIME ZONE 'Europe/London';

works fine now. It will also obey whatever DST rules were in effect at
just that date, which the previous implementation did not.

It also supports the AT TIME ZONE on the timetz datatype. The whole
handling of DST is a bit bogus there, so I chose to make it use whatever
DST rules are in effect at the time of executig the query. not sure if
anybody is actuallyi *using* timetz though, it seems pretty
unpredictable just because of this...

Magnus Hagander
2005-06-15 00:34:11 +00:00
Bruce Momjian 8b84aebddf Add BETWEEN SYMMETRIC.
Pavel Stehule
2005-06-14 23:47:39 +00:00
Bruce Momjian f5835b4b8d Add pg_postmaster_start_time() function.
Euler Taveira de Oliveira
Matthias Schmidt
2005-06-14 21:04:42 +00:00
Neil Conway 8c05ca7754 SGML cleanup: consistently use "endterm" in <xref>s that link to the
reference page for SQL commands, so that the link text is italicized.
2005-06-13 02:40:08 +00:00
Bruce Momjian 4d0e7b4aac Please find attached a patch (diff -c against cvs HEAD) to add a
function that accepts a double precision argument assumed to be a Unix
epoch timestamp and returns timestamp with time zone, and accompanying
documentation.

Usage:

test=# select to_timestamp(200120400);
       to_timestamp
------------------------
  1976-05-05 14:00:00+09
(1 row)

Michael Glaesemann
2005-06-09 16:35:09 +00:00
Neil Conway 657c098e41 Add a function lastval(), which returns the value returned by the
last nextval() or setval() performed by the current session. Update the
docs, add regression tests, and bump the catalog version. Patch from
Dennis Björklund, various improvements by Neil Conway.
2005-06-07 07:08:35 +00:00
Tom Lane 128c25b52f Trivial markup improvement. 2005-06-06 16:29:01 +00:00
Neil Conway 1b41965d5d Remove some verbiage describing how min() and max() are slow when applied
to the entire table: as of current sources, they are no longer slow
provided there is an index on the column.
2005-05-23 01:50:01 +00:00
Neil Conway dd2894dfd6 Consistently do not include a terminating period in single-sentence
function descriptions in func.sgml; other minor SGML tweaks.
2005-05-23 01:29:54 +00:00
Neil Conway f3567eeaf2 Implement md5(bytea), update regression tests and documentation. Patch
from Abhijit Menon-Sen, minor editorialization from Neil Conway. Also,
improve md5(text) to allocate a constant-sized buffer on the stack
rather than via palloc.

Catalog version bumped.
2005-05-20 01:29:56 +00:00
Neil Conway a535a1522f Fix newly introduced spelling error. 2005-05-11 13:58:50 +00:00