Commit Graph

463 Commits

Author SHA1 Message Date
Peter Eisentraut cae565e503 SQL/MED catalog manipulation facilities
This doesn't do any remote or external things yet, but it gives modules
like plproxy and dblink a standardized and future-proof system for
managing their connection information.

Martin Pihlak and Peter Eisentraut
2008-12-19 16:25:19 +00:00
Tom Lane 517ae4039e Code review for function default parameters patch. Fix numerous problems as
per recent discussions.  In passing this also fixes a couple of bugs in
the previous variadic-parameters patch.
2008-12-18 18:20:35 +00:00
Peter Eisentraut 455dffbb73 Default values for function arguments
Pavel Stehule, with some tweaks by Peter Eisentraut
2008-12-04 17:51:28 +00:00
Tom Lane c889ebce0a Implement the basic form of UNNEST, ie unnest(anyarray) returns setof
anyelement.  This lacks the WITH ORDINALITY option, as well as the multiple
input arrays option added in the most recent SQL specs.  But it's still a
pretty useful subset of the spec's functionality, and it is enough to
allow obsoleting contrib/intagg.
2008-11-14 00:51:47 +00:00
Tom Lane c23b6fa7b5 Marginal editorial improvements for array_agg patch documentation. 2008-11-13 23:01:09 +00:00
Peter Eisentraut 3379fae6de array_agg aggregate function, as per SQL:2008, but without ORDER BY clause
Rearrange the documentation a bit now that array_agg and xmlagg have similar
semantics and issues.

best of Robert Haas, Jeff Davis, Peter Eisentraut
2008-11-13 15:59:51 +00:00
Peter Eisentraut f98f6ee064 array_length() function, and for SQL compatibility also cardinality()
function as a special case.

This version still has the suspicious behavior of returning null for an
empty array (rather than zero), but this may need a wholesale revision of
empty array behavior, currently under discussion.

Jim Nasby, Robert Haas, Peter Eisentraut
2008-11-12 13:09:28 +00:00
Tom Lane 399ad77c66 Improve documentation of pg_typeof, per gripe from David Wheeler. 2008-11-07 22:54:41 +00:00
Peter Eisentraut 254aecb704 ADD array_ndims function
Author: Robert Haas <robertmhaas@gmail.com>
2008-11-04 14:49:12 +00:00
Bruce Momjian ac3797a913 Remove tabs from SGML file. 2008-11-04 00:59:45 +00:00
Andrew Dunstan f0dae70431 suppress_redundant_updates_trigger function. 2008-11-03 20:17:21 +00:00
Tom Lane b8fab2411d Add pg_typeof() function.
Brendan Jurd
2008-11-03 17:51:13 +00:00
Peter Eisentraut 0fec77ae88 SQL:2008 syntax CURRENT_CATALOG, CURRENT_SCHEMA, SET CATALOG, SET SCHEMA. 2008-10-27 09:37:47 +00:00
Tom Lane a303e4dc43 Extend the date type to support infinity and -infinity, analogously to
the timestamp types.  Turns out this doesn't even reduce the available
range of dates, since the restriction to dates that work for Julian-date
arithmetic is much tighter than the int32 range anyway.  Per a longstanding
TODO item.
2008-10-14 17:12:33 +00:00
Tom Lane e3b0117459 Implement comparison of generic records (composite types), and invent a
pseudo-type record[] to represent arrays of possibly-anonymous composite
types.  Since composite datums carry their own type identification, no
extra knowledge is needed at the array level.

The main reason for doing this right now is that it is necessary to support
the general case of detection of cycles in recursive queries: if you need to
compare more than one column to detect a cycle, you need to compare a ROW()
to an array built from ROW()s, at least if you want to do it as the spec
suggests.  Add some documentation and regression tests concerning the cycle
detection issue.
2008-10-13 16:25:20 +00:00
Heikki Linnakangas 706a308806 Add relation fork support to pg_relation_size() function. You can now pass
name of a fork ('main' or 'fsm', at the moment) to pg_relation_size() to
get the size of a specific fork. Defaults to 'main', if none given.

While we're at it, modify pg_relation_size to take a regclass as argument,
instead of separate variants taking oid and name. This change is
transparent to typical use where the table name is passed as a string
literal, like pg_relation_size('table'), but will break queries like
pg_relation_size(namecol), where namecol is of type name. text-type input
still works, and using a non-schema-qualified table name is not very
reliable anyway, so this is unlikely to break anyone's queries in practice.
2008-10-03 07:33:10 +00:00
Tom Lane 06edce4c3f Tighten up to_date/to_timestamp so that they are more likely to reject
erroneous input, rather than silently producing bizarre results as formerly
happened.

Brendan Jurd
2008-09-11 17:32:34 +00:00
Tom Lane a0b76dc662 Create a separate grantable privilege for TRUNCATE, rather than having it be
always owner-only.  The TRUNCATE privilege works identically to the DELETE
privilege so far as interactions with the rest of the system go.

Robert Haas
2008-09-08 00:47:41 +00:00
Bruce Momjian 1cfd878643 Clarify documention workding for xip_list().
Simon Riggs
2008-09-07 01:29:36 +00:00
Tom Lane 2c863ca818 Implement a psql command "\ef" to edit the definition of a function.
In support of that, create a backend function pg_get_functiondef().
The psql command is functional but maybe a bit rough around the edges...

Abhijit Menon-Sen
2008-09-06 00:01:25 +00:00
Tom Lane 5618ece82b Code review for array_fill patch: fix inadequate check for array size overflow
and bogus documentation (dimension arrays are int[] not anyarray).  Also the
errhint() messages seem to be really errdetail(), since there is nothing
heuristic about them.  Some other trivial cosmetic improvements.
2008-07-21 04:47:00 +00:00
Tom Lane 69a785b8bf Implement SQL-spec RETURNS TABLE syntax for functions.
(Unlike the original submission, this patch treats TABLE output parameters
as being entirely equivalent to OUT parameters -- tgl)

Pavel Stehule
2008-07-18 03:32:53 +00:00
Bruce Momjian 2c773296f8 Add array_fill() to create arrays initialized with a value.
Pavel Stehule
2008-07-16 00:48:54 +00:00
Bruce Momjian 2fa42cc9ee Fix alignment of SGML array docs. 2008-07-15 18:24:59 +00:00
Peter Eisentraut 76c3c59bd1 Added documentation for function xmlagg. 2008-07-07 16:11:35 +00:00
Tom Lane c63147d6f0 Add a function pg_get_keywords() to let clients find out the set of keywords
known to the SQL parser.  Dave Page
2008-07-03 20:58:47 +00:00
Tom Lane 07a5606735 Make to_char()'s localized month/day names depend on LC_TIME, not LC_MESSAGES.
Euler Taveira de Oliveira
2008-05-19 18:08:16 +00:00
Tom Lane b6d15590f7 Add timestamp and timestamptz versions of generate_series().
Hitoshi Harada
2008-05-04 23:19:24 +00:00
Tom Lane 600da67fbe Add pg_conf_load_time() function to report when the Postgres configuration
files were last loaded.

George Gensure
2008-05-04 21:13:36 +00:00
Alvaro Herrera 1fcb977a13 Add generate_subscripts, a series-generation function which generates an
array's subscripts.

Pavel Stehule, some editorialization by me.
2008-04-28 14:48:58 +00:00
Bruce Momjian c4fd93b3f3 Re-enable pg_terminate_backend() using SIGTERM. SIGTERM testing still
needed.
2008-04-17 20:56:41 +00:00
Bruce Momjian 76365960d2 Revert addition of pg_terminate_backend() because of race conditions. 2008-04-15 20:28:47 +00:00
Bruce Momjian 18b286f3e3 Add pg_terminate_backend() to allow terminating only a single session. 2008-04-15 13:55:12 +00:00
Tom Lane 9b5c8d45f6 Push index operator lossiness determination down to GIST/GIN opclass
"consistent" functions, and remove pg_amop.opreqcheck, as per recent
discussion.  The main immediate benefit of this is that we no longer need
8.3's ugly hack of requiring @@@ rather than @@ to test weight-using tsquery
searches on GIN indexes.  In future it should be possible to optimize some
other queries better than is done now, by detecting at runtime whether the
index match is exact or not.

Tom Lane, after an idea of Heikki's, and with some help from Teodor.
2008-04-14 17:05:34 +00:00
Alvaro Herrera 66782364a1 Mention pg_backend_pid() in the system information section in addition
to the monitoring section.

Jim Nasby
2008-04-10 13:34:33 +00:00
Bruce Momjian a84171b078 Add documentation clarification for IS [NOT] NULL and row-valued
expressions.
2008-04-07 00:51:27 +00:00
Tom Lane a0fad9762a Re-implement division for numeric values using the traditional "schoolbook"
algorithm.  This is a good deal slower than our old roundoff-error-prone
code for long inputs, so we keep the old code for use in the transcendental
functions, where everything is approximate anyway.  Also create a
user-accessible function div(numeric, numeric) to provide access to the
exact result of trunc(x/y) --- since the regular numeric / operator will
round off its result, simply computing that expression in SQL doesn't
reliably give the desired answer.  This fixes bug #3387 and various related
corner cases, and improves the usefulness of PG for high-precision integer
arithmetic.
2008-04-04 18:45:36 +00:00
Bruce Momjian f96928fde9 Implement current_query(), that shows the currently executing query.
At the same time remove dblink/dblink_current_query() as it is no longer
necessary
*BACKWARD COMPATIBILITY ISSUE* for dblink

Tomas Doran
2008-04-04 16:57:21 +00:00
Tom Lane 7de81124d5 Create a function quote_nullable(), which works the same as quote_literal()
except that it returns the string 'NULL', rather than a SQL null, when called
with a null argument.  This is often a much more useful behavior for
constructing dynamic queries.  Add more discussion to the documentation
about how to use these functions.

Brendan Jurd
2008-03-23 00:24:20 +00:00
Tom Lane 23c356ccec Document and enforce that the usable range of setseed() arguments is
-1 to 1, not 0 to 1.  The actual behavior for values within this range
does not change.  Kris Jurka
2008-03-10 12:39:23 +00:00
Bruce Momjian 2b70548bd4 Document use of pg_locks.objid for advisory locks, suggestion from Marc Mamin 2008-03-06 18:49:32 +00:00
Bruce Momjian 37cb2b776a Remove "reliably" from chr(0) doc mention. 2008-03-03 18:09:02 +00:00
Bruce Momjian dc41fd8869 Document that chr(0) is not supported, and why. 2008-03-03 17:11:13 +00:00
Peter Eisentraut f26203ef32 Add information about format modifiers that apply to numeric formats.
These were previously only documented in the context of date/time formats.
2008-02-26 15:32:30 +00:00
Tom Lane 112c8555ad Fix a small typo, per Jan Urbanski 2007-12-21 03:37:18 +00:00
Tom Lane 164d255b49 Improve documentation about Julian dates; in particular, point out the
difference between Julian and Gregorian reckoning of when JD 0 was.
2007-12-15 01:18:34 +00:00
Alvaro Herrera 784365162c Correct result type of convert_to, per Pavel Stehule. 2007-12-13 13:22:05 +00:00
Tom Lane f039a8cf8e Add missing table entry for lastval(), per Jeff Davis. 2007-12-06 17:47:25 +00:00
Tom Lane 4c128303e0 Entity-ify a passel of & < > characters. Per gripe from Devrim. 2007-12-03 23:49:51 +00:00
Peter Eisentraut 9293425819 spell checker run 2007-11-28 15:42:31 +00:00