Commit Graph

365 Commits

Author SHA1 Message Date
Tom Lane 5bfb0540b0 Update docs for 7.4 array features and polymorphic functions.
This is Joe Conway's patch of 7-Aug plus further editorializing
of my own.
2003-08-09 22:50:22 +00:00
Peter Eisentraut 3766e99c41 Add a note that AND and OR are commutative. Apparently, they are not in
certain other products.
2003-08-04 14:00:14 +00:00
Tom Lane a063d4b3ec Very minor editing. 2003-07-31 22:17:11 +00:00
Tom Lane 52347b6637 Add pretty-printing variants of pg_get_viewdef and related functions.
Patch from Andreas Pflug.
2003-07-30 22:56:24 +00:00
Tom Lane 9c2a7c2269 Apply (a somewhat revised version of) Greg Mullane's patch to eliminate
heuristic determination of day vs month in date/time input.  Add the
ability to specify that input is interpreted as yy-mm-dd order (which
formerly worked, but only for yy greater than 31).  DateStyle's input
component now has the preferred spellings DMY, MDY, or YMD; the older
keywords European and US are now aliases for the first two of these.
Per recent discussions on pgsql-general.
2003-07-29 00:03:19 +00:00
Tom Lane 764f72dc82 Make EXTRACT(TIMEZONE) and SET/SHOW TIMEZONE follow the SQL convention
for the sign of timezone offsets, ie, positive is east from UTC.  These
were previously out of step with other operations that accept or show
timezones, such as I/O of timestamptz values.
2003-07-17 00:55:37 +00:00
Tom Lane cfa6999d3b Cause SHOW DATESTYLE to produce a string that will be accepted by SET
DATESTYLE, for instance 'SQL, European' instead of
'SQL with European conventions'.  Per gripe a month or two back from
Barry Lind.
2003-07-15 19:19:56 +00:00
Tom Lane bee217924d Support expressions of the form 'scalar op ANY (array)' and
'scalar op ALL (array)', where the operator is applied between the
lefthand scalar and each element of the array.  The operator must
yield boolean; the result of the construct is the OR or AND of the
per-element results, respectively.

Original coding by Joe Conway, after an idea of Peter's.  Rewritten
by Tom to keep the implementation strictly separate from subqueries.
2003-06-29 00:33:44 +00:00
Tom Lane b3c0551eda Create real array comparison functions (that use the element datatype's
comparison functions), replacing the highly bogus bitwise array_eq.  Create
a btree index opclass for ANYARRAY --- it is now possible to create indexes
on array columns.
Arrange to cache the results of catalog lookups across multiple array
operations, instead of repeating the lookups on every call.
Add string_to_array and array_to_string functions.
Remove singleton_array, array_accum, array_assign, and array_subscript
functions, since these were for proof-of-concept and not intended to become
supported functions.
Minor adjustments to behavior in some corner cases with empty or
zero-dimensional arrays.

Joe Conway (with some editorializing by Tom Lane).
2003-06-27 00:33:26 +00:00
Bruce Momjian 111d8e522b Back out array mega-patch.
Joe Conway
2003-06-25 21:30:34 +00:00
Bruce Momjian 46bf651480 Array mega-patch.
Joe Conway
2003-06-24 23:14:49 +00:00
Tom Lane ea7896bf58 Provide a real link to CREATE SEQUENCE's reference page in nextval/setval
discussion.
2003-05-05 15:08:49 +00:00
Tom Lane cffded96ea Documentation refers to box() function where it should say box_intersect().
Thanks to Wes Sheldah for finding this one.
2003-05-01 00:57:05 +00:00
Tom Lane 80597fd992 Fix broken markup. 2003-03-30 21:48:37 +00:00
Bruce Momjian c2d5abae9b Fix number of columns in SGML, from Weiping He 2003-03-28 00:23:29 +00:00
Bruce Momjian 64c1399dac * Make pg_get_triggerdef documentation consistent with other pg_get_
functions
* Document pg_conversion_is_visible() which was created in one of my
previous patches and didn't get documented for some reason

Christopher Kings-Lynne
2003-03-27 16:45:51 +00:00
Bruce Momjian 7a3e7b64ac to_char fixes, Karel Zak 2003-03-27 16:35:31 +00:00
Peter Eisentraut 5e5c5cd31a Merge documentation into one book. (Build with "make html".) Replace
vague cross-references with real links.
2003-03-25 16:15:44 +00:00
Peter Eisentraut d258ba01ec Another big editing pass for consistent content and presentation. 2003-03-24 14:32:51 +00:00
Bruce Momjian e02f818311 Add hostmask() function:
+       <entry><function>hostmask</function>(<type>inet</type>)</entry>
+       <entry><type>inet</type></entry>
+       <entry>construct hostmask for network</entry>
+       <entry><literal>hostmask('192.168.23.20/30')</literal></entry>
+       <entry><literal>0.0.0.3</literal></entry>

Greg Wickham
2003-03-21 21:54:29 +00:00
Bruce Momjian 3be6367b9f This patch creates a function named pg_get_triggerdef that takes the oid of
a trigger as its parameter.  It is basically copied from the pg_dump
code.

Christopher Kings-Lynne
2003-03-20 18:58:02 +00:00
Bruce Momjian a18331004a Add start time to pg_stat_activity
Neil Conway
2003-03-20 03:34:57 +00:00
Peter Eisentraut 706a32cdf6 Big editing for consistent content and presentation. 2003-03-13 01:30:29 +00:00
Tom Lane d28cd2273b Improve description of geometric operators. 2003-03-03 03:31:23 +00:00
Bruce Momjian aca86479fd This patch adds a note to the documentation describing why the
performance of min() and max() is slow when applied to the entire table,
and suggesting the simple workaround most experienced Pg users
eventually learn about (SELECT xyz ... ORDER BY xyz LIMIT 1).

Neil Conway
2003-02-19 03:12:22 +00:00
Tom Lane 51972a9d5d COALESCE() and NULLIF() are now first-class expressions, not macros
that turn into CASE expressions.  They evaluate their arguments at most
once.  Patch by Kris Jurka, review and (very light) editorializing by me.
2003-02-16 02:30:39 +00:00
Bruce Momjian 6cb1f4fe44 The "random" regression test uses a function called oidrand(), which
takes two parameters, an OID x and an integer y, and returns "true" with
probability 1/y (the OID argument is ignored). This can be useful -- for
example, it can be used to select a random sampling of the rows in a
table (which is what the "random" regression test uses it for).

This patch removes that function, because it was old and messy. The old
function had the following problems:

- it was undocumented

- it was poorly named

- it was designed to workaround an optimizer bug that no longer exists
(the OID argument is to ensure that the optimizer won't optimize away
calls to the function; AFAIK marking the function as 'volatile' suffices
nowadays)

- it used a different random-number generation technique than the other
PSRNG-related functions in the backend do (it called random() like they
do, but it had its own logic for setting a set and deciding when to
reseed the RNG).

Ok, this patch removes oidrand(), oidsrand(), and userfntest(), and
improves the SGML docs a little bit (un-commenting the setseed()
documentation).

Neil Conway
2003-02-13 05:24:04 +00:00
Tom Lane 77ede8900d Create a GUC variable REGEX_FLAVOR to control the type of regular
expression accepted by the regex operators, per discussion yesterday.

Along the way, reduce deadlock_timeout from PGC_POSTMASTER to PGC_SIGHUP
category.  It is probably best to insist that all backends share the same
setting, but that doesn't mean it has to be frozen at startup.
2003-02-06 20:25:33 +00:00
Tom Lane 7bcc6d98fb Replace regular expression package with Henry Spencer's latest version
(extracted from Tcl 8.4.1 release, as Henry still hasn't got round to
making it a separate library).  This solves a performance problem for
multibyte, as well as upgrading our regexp support to match recent Tcl
and nearly match recent Perl.
2003-02-05 17:41:33 +00:00
Peter Eisentraut ef7422510e Grant options, and cascading revoke. Grant options are allowed only for
users right now, not groups.  Extension of has_foo_privileges functions to
query the grant options.  Extension of aclitem type to store grantor.
2003-01-23 23:39:07 +00:00
Tom Lane 742403bdad Update 'Mathematical Functions' table to reflect 7.3 addition of float8
forms of ceil(), floor(), sign().  Back-patch this and other recent
doc fixes in this file to the 7.3 branch.
2003-01-23 01:22:59 +00:00
Bruce Momjian e87e82d2b7 Attached are two small patches to expose md5 as a user function -- including
documentation and regression test mods. It seemed small and unobtrusive enough
to not require a specific proposal on the hackers list -- but if not, let me
know and I'll make a pitch. Otherwise, if there are no objections please apply.

Joe Conway
2002-12-06 05:20:28 +00:00
Bruce Momjian 23e88e25d6 Document get/set bit/byte functions. 2002-12-05 04:38:30 +00:00
Bruce Momjian a2b4a7071d This minor patch corrects an error in the function docs: it's
"version()", not "version".

Neil Conway
2002-11-23 04:04:43 +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
Peter Eisentraut 1b342df00a Merge documentation updates from 7.3 branch. 2002-11-11 20:14:04 +00:00
Tom Lane 3a0fde3b51 Make link to schema inspection functions more clear. 2002-10-24 21:10:58 +00:00
Bruce Momjian fb5e61fd2d Fix markup error. 2002-10-05 23:43:42 +00:00
Bruce Momjian 0c88e38eda Add more documentation about CURRENT_TIMESTAMP.
Also, code < and > as &lt;/&gt; for cleaner SGML.
2002-10-05 19:03:16 +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 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
Peter Eisentraut bc49968764 Add more appropriate markup. 2002-09-21 18:32:54 +00:00
Bruce Momjian 708a000efe Mention that pg_get_viewdef(name) is deprecated.
Rod Taylor
2002-09-20 03:44:06 +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
Bruce Momjian 6a5733a1ea Fix atan() description.
Bruno Wolff III
2002-09-11 02:56:46 +00:00
Bruce Momjian e82bcba5e0 Here's a doc patch for the new string functions recently committed --
replace, split, and to_hex. The patch also moves encode and decode into
alphabetical order (since everything else in the table was).

Joe Conway
2002-09-02 05:53:23 +00:00
Bruce Momjian 548d646e65 Add log_duration to GUC/postgresql.conf.
Rename debug_print_query to log_statement and rename show_query_stats to
show_statement_stats.
2002-09-01 23:26:06 +00:00
Tom Lane bf59ccc7d8 A few more fixes for the <replaceable>able> fiasco. 2002-08-29 05:17:55 +00:00
Bruce Momjian 090884bed3 Fix for documention:
>>" It's also possible to select no escape character by writing ESCAPE ''.
>>In this case there is no way to turn off the special meaning of
>>underscore and percent signs in the pattern."

Joe Conway
2002-08-22 04:56:44 +00:00
Bruce Momjian c76f5aa530 > > I had great difficulty in finding how to change the search path, so here
> > is a patch to add some cross-referencing.

Oliver Elphick
2002-08-22 04:52:17 +00:00
Bruce Momjian 0f9f2feee4 Fix bad markup detected by Alvaro Herrera 2002-08-21 16:08:19 +00:00
Bruce Momjian cbe19208ee Fix markup, Alvaro Herrera. 2002-08-21 05:25:49 +00:00
Bruce Momjian de9801fc62 Add current_database().
> Quick system function to pull out the current database.
>
> I've used this a number of times to allow stored procedures to find out
> where they are.  Especially useful for those that do logging or hit a
> remote server.
>
> It's called current_database() to match with current_user().

It's also a necessity for an informational schema.  The catalog
(database) name is required in a number of places.

Rod Taylor
2002-08-20 04:46:00 +00:00
Tom Lane a208ea72bc Modify pg_dump to dump foreign-key constraints as constraints, not as
sets of triggers.  Also modify psql \d command to show foreign key
constraints as such and hide the triggers.  pg_get_constraintdef()
function added to backend to support these.  From Rod Taylor, code
review and some editorialization by Tom Lane.
2002-08-16 23:01:21 +00:00
Tatsuo Ishii 969e0246ed Add Cyrillic and other encodings for encoding conversion.
Patches submitted by Kaori Inaba (i-kaori@sra.co.jp).
2002-08-14 02:45:10 +00:00
Tom Lane 4ab8e69094 has_table_privilege spawns scions has_database_privilege, has_function_privilege,
has_language_privilege, has_schema_privilege to let SQL queries test
all the new privilege types in 7.3.  Also, add functions pg_table_is_visible,
pg_type_is_visible, pg_function_is_visible, pg_operator_is_visible,
pg_opclass_is_visible to test whether objects contained in schemas are
visible in the current search path.  Do some minor cleanup to centralize
accesses to pg_database, as well.
2002-08-09 16:45:16 +00:00
Tom Lane d176fad580 Some improvements in geometric-operators documentation. 2002-08-08 14:29:07 +00:00
Tatsuo Ishii 6206a880cf Add SQL99 CONVERT() function. 2002-08-06 05:40:47 +00:00
Bruce Momjian d7859a9570 Rename backend_pid to pg_backend_pid, move docs to monitoring section. 2002-08-04 19:51:30 +00:00
Bruce Momjian 7ef5634701 Here is a doc patch for the SHOW X changes and new config-settings
functions. If there are no objections, please apply.

Joe Conway
2002-08-04 03:53:11 +00:00
Bruce Momjian 52457ca6af Move backend_pid to functions/misc. 2002-07-31 02:27:29 +00:00
Tom Lane e11f167718 Document quote_ident and quote_literal in the main list of string functions,
as suggested by Josh Berkus.
2002-06-24 22:17:01 +00:00
Bruce Momjian eb1ad5b4b5 Patch for current_schemas to optionally include implicit ...
Second cut attached. This one just adds a boolean option to the existing
function to indicate that implicit schemas are to be included (or not).
I remembered the docs as well this time :-)

Dave Page
2002-06-15 20:03:51 +00:00
Thomas G. Lockhart 133df7ce70 Add LOCALTIME and LOCALTIMESTAMP functions per SQL99 standard.
Remove ODBC-compatible empty parentheses from calls to SQL99 functions
 for which these parentheses do not match the standard.
Update the ODBC driver to ensure compatibility with the ODBC standard
 for these functions (e.g. CURRENT_TIMESTAMP, CURRENT_USER, etc).
Include a new appendix in the User's Guide which lists the labeled features
 for SQL99 (the labeled features replaced the "basic", "intermediate",
 and "advanced" categories from SQL92). features.sgml does not yet split
 this list into "supported" and "unsupported" lists.
2002-06-15 03:00:09 +00:00
Thomas G. Lockhart 062d8b9ebd Fix markup typo. 2002-06-11 16:00:17 +00:00
Thomas G. Lockhart 090dd22de6 Implement SQL99 OVERLAY(). Allows substitution of a substring in a string.
Implement SQL99 SIMILAR TO as a synonym for our existing operator "~".
Implement SQL99 regular expression SUBSTRING(string FROM pat FOR escape).
 Extend the definition to make the FOR clause optional.
 Define textregexsubstr() to actually implement this feature.
Update the regression test to include these new string features.
 All tests pass.
Rename the regular expression support routines from "pg95_xxx" to "pg_xxx".
Define CREATE CHARACTER SET in the parser per SQL99. No implementation yet.
2002-06-11 15:32:33 +00:00
Bruce Momjian 85af3be5e2 Remove mention of timestamp() in SGML docs; doesn't exist anymore. 2002-06-02 21:56:09 +00:00
Peter Eisentraut e8ac187c68 Allow functions to be executed with the privileges of the function owner.
I took the opportunity to remove the pg_proc.proistrusted field.
2002-05-18 13:48:01 +00:00
Tom Lane c5741a448e AVG probably shouldn't be upper case here, considering
that we don't upcase the others.
2002-05-13 19:22:06 +00:00
Tom Lane a309032d2f Add current_schema() and current_schemas() inquiry functions.
Update has_table_privilege functions to cope with schema-qualified
names in the same way as nextval() and others.
2002-04-26 01:24:08 +00:00
Tom Lane b3120804ad Rule names are now unique per-relation, rather than unique globally.
DROP RULE and COMMENT ON RULE syntax adds an 'ON tablename' clause,
similar to TRIGGER syntaxes.  To allow loading of existing pg_dump
files containing COMMENT ON RULE, the COMMENT code will still accept
the old syntax --- but only if the target rulename is unique across
the whole database.
2002-04-18 20:01:11 +00:00
Peter Eisentraut b6ea172ace Spell checking and markup additions 2002-03-22 19:20:45 +00:00
Peter Eisentraut 14d3c645b3 Don't put empty paragraphs around tables. This messed up JadeTeX somehow,
and doesn't make sense strictly speaking.
2002-01-30 21:55:33 +00:00
Bruce Momjian 38c971f496 Fix +/- mixup pointed out by Rod Taylor. 2002-01-25 02:39:28 +00:00
Peter Eisentraut bf43bed848 Spell-check and markup police 2002-01-20 22:19:57 +00:00
Peter Eisentraut 731204e090 Editorial review 2002-01-07 02:29:15 +00:00
Tom Lane 9935a85fa4 Document obj_description and col_description functions; expand
description of COMMENT command.
2001-12-27 21:36:57 +00:00
Tom Lane ce4d01d96b Update description of CURRENT_TIMESTAMP and friends. 2001-12-23 20:22:49 +00:00
Tom Lane 53f1173388 Provide some documentation for EXISTS, IN, NOT IN, ANY/SOME/ALL,
and row comparisons.  How'd this manage to slip through the cracks?
2001-12-01 04:19:20 +00:00
Peter Eisentraut 651a639b8b proof-reading 2001-11-28 20:49:10 +00:00
Tom Lane cf3b164aac Add documentation for pg_get_ruledef and friends. 2001-11-21 22:33:14 +00:00
Thomas G. Lockhart 2475e87481 Deprecate 'current' for date/time input.
Fix up references to "PostgreSQL" rather than "Postgres". Was roughly
 evenly split between the two before. ref/ files not yet done.
2001-11-21 05:53:41 +00:00
Bruce Momjian 01e0dae689 I've created a new section to func.sgml, "Binary String Functions and
Operators", plagiarized shamelessly from the "String Functions and
Operators" section. There were enough differences that it made sense (at
least to me) to give this its own section instead of cramming it in with
normal string functions. This way I could also make the examples
relevant, which is particularly important for bytea.

One thing I think worth mentioning: while documenting the trim()
function I realized that I never implemented the bytea equivalent of
rtrim and ltrim. Therefore, the 'leading' and 'trailing' forms of trim,
available with text, are not available with bytea (I'd be happy to
correct this, but since it would require an initdb, I guess not until
7.3) -- the submitted doc accurately reflects this.

I will look for other areas of the docs that need mention of bytea, but
any guidance would be much appreciated.

--

Here's a second bytea documentation patch. This one significantly
expands the "Binary Data" section added by Bruce recently.


Joe Conway
2001-11-20 15:42:44 +00:00
Tom Lane 5e86d226e4 Grammatical and spelling fixes. 2001-11-19 09:05:02 +00:00
Tom Lane 9b03776ff2 A bunch of small doco updates motivated by scanning the comments on
the interactive docs.
2001-11-19 03:58:25 +00:00
Tom Lane deab49566d Mention that LIKE ... ESCAPE '' is allowed to specify no
escape character.
2001-11-18 21:17:10 +00:00
Tom Lane 2043340b87 Expand documentation for sequence functions (nextval and friends).
Place it in the expected place in the User's Guide, rather than
hiding it in the command reference page for CREATE SEQUENCE.
2001-11-17 22:20:34 +00:00
Tatsuo Ishii f426465ba9 Add a new function "pg_client_encoding" which returns the current client
side encoding name. This is necessary for client API's such as JDBC
to perform correct encoding conversions. See my email "[HACKERS]
pg_client_encoding" 10 Sep 2001.
2001-10-12 02:08:34 +00:00
Peter Eisentraut 371f49bf9f Remove gratuitous discrepancy between extract() and date_part(),
regarding timezone_hour, timezone_minute vs. tz_hour, tz_minute.
Document the former.
2001-10-10 00:02:42 +00:00
Peter Eisentraut ffb8f73890 Bunch of copy fitting and style sheet tweakage to get decent looking print
output (from pdfjadetex).  Also updated instructions to install documentation
processing toolchain.
2001-10-09 18:46:00 +00:00
Thomas G. Lockhart 0b268e5d88 Fix markup to allow compilation. The chapters on failure and recovery
need more work, but at least they have something now.
2001-09-28 20:48:17 +00:00
Thomas G. Lockhart f9681968e0 Add information on new timestamp and timestamptz data types.
Start chapter on recovery techniques. Still needs work for release.
2001-09-28 08:15:35 +00:00
Peter Eisentraut 14ac04710a Document the sign() function. 2001-09-20 16:41:26 +00:00
Peter Eisentraut a1ee06625c Provide tunable knob for x = NULL -> x IS NULL transformation, default to off. 2001-09-20 14:20:28 +00:00
Tatsuo Ishii aa398e5034 Add missing ';' 2001-09-10 02:46:18 +00:00
Peter Eisentraut 84956e71a3 Markup additions and spell check. (covers User's Guide) 2001-09-09 17:21:59 +00:00
Bruce Momjian 2a34134b6c - new to_char(interval, text)
- new millisecond (ms) and microsecond (us) support
 - more robus parsing from string - used is separator checking for
   non-exact formats like to_date('2001-9-1', 'YYYY-MM-DD')
 - SGML docs are included

Karel Zak
2001-09-06 03:22:42 +00:00
Tatsuo Ishii 5608f13028 The actual execution results are different from examples. 2001-08-31 07:45:09 +00:00
Tatsuo Ishii a32624b45c Actual results are different from examples 2001-08-31 07:30:05 +00:00
Tatsuo Ishii 397f65d102 Add convert. 2001-08-15 07:10:12 +00:00
Tom Lane 5f7c2bdb53 sum() on int2 and int4 columns now uses an int8, not numeric, accumulator
for speed reasons; its result type also changes to int8.  avg() on these
datatypes now accumulates the running sum in int8 for speed; but we still
deliver the final result as numeric, so that fractional accuracy is
preserved.

count() now counts and returns in int8, not int4.  I am a little nervous
about this possibly breaking users' code, but there didn't seem to be
a strong sentiment for avoiding the problem.  If we get complaints during
beta, we can change count back to int4 and add a "count8" aggregate.
For that matter, users can do it for themselves with a simple CREATE
AGGREGATE command; the int4inc function is still present, so no C hacking
is needed.

Also added max() and min() aggregates for OID that do proper unsigned
comparison, instead of piggybacking on int4 aggregates.

initdb forced.
2001-08-14 22:21:59 +00:00
Bruce Momjian 7771436e18 > > Put encode() into base system. Used part of Alex' patch
> > for docs, hope he does not mind ;)

Marko Kreen
2001-07-11 22:14:03 +00:00
Bruce Momjian 86bc2d91c3 Correct substring() example, found by Thomas T. Thai. 2001-07-03 02:42:18 +00:00
Tom Lane 116d2bba7e Add IS UNKNOWN, IS NOT UNKNOWN boolean tests, fix the existing boolean
tests to return the correct results per SQL9x when given NULL inputs.
Reimplement these tests as well as IS [NOT] NULL to have their own
expression node types, instead of depending on special functions.
From Joe Conway, with a little help from Tom Lane.
2001-06-19 22:39:12 +00:00
Tom Lane 2adf1ce63c Oops, forgot to commit doco updates for has_table_privilege. 2001-06-15 21:03:07 +00:00
Bruce Momjian d7763c1f9c Docs for:
> >> inet(text), cidr(text): convert a text value into inet/cidr
> >> set_masklen(inet): set masklen on the inet value

Alex Pilosov
2001-06-13 22:51:02 +00:00
Peter Eisentraut 444c5bf1b2 SQL function bit_length 2001-05-24 09:29:29 +00:00
Peter Eisentraut 01839df6dd Add index. Only some parts of the manual set have index entries so far... 2001-05-12 22:51:36 +00:00
Thomas G. Lockhart e6767a3205 Final markup for 7.1 hardcopy release. Mostly typo and table-fitting
adjustments. Note that many tables are being abused with *really* long
 description columns. Should probably shrink those columns to be more
 concise, and move some of the info to follow-on reference notes.
2001-04-20 15:52:33 +00:00
Tom Lane 39ceedf5e0 The regexp pattern characters ^ and $ should be explained as matching
at the beginning and end of the input string, not the beginning and end
of "a line", since Postgres does not allow them to match at newline
characters in the data.
2001-03-25 18:14:31 +00:00
Tom Lane d584bf4867 Improve description of to_char templates. 2001-03-15 01:07:51 +00:00
Tom Lane e14a9deb93 Document timeofday(), mention start-of-transaction vs. current-time
semantics, a few other small improvements.
2001-02-21 23:15:24 +00:00
Tom Lane fa0cd643d2 AND/OR truth table needs another row IMHO. 2001-02-19 00:01:18 +00:00
Peter Eisentraut 48d03278a2 Enhance documentation of date/time functions. Add extract, current_date,
current_time, current_timestamp.  Add more examples.  Remove age(), because
it doesn't work like it is documented, and no one could explain it to me.
2001-02-18 17:17:17 +00:00
Bruce Momjian 8824741f99 User Manual
Chapter 4
   String Operators
    Table 4.7: Other String Functions
      strpos is missing the result in the result column, it should be 2
      Also to_ascii might need a result but maybe not.

Appendix A
In the Time Zone Table
 Greenwich is spelled Greenwish

David Aldrich
2001-02-12 14:21:27 +00:00
Peter Eisentraut 192ce19d36 Document BETWEEN. 2001-02-05 19:21:45 +00:00
Peter Eisentraut 4f34f55d3d Description of table expressions, including join syntax, from Robert B.
Easter <reaster@comptechnews.com>, heavily massaged by me.  Also cleaned up
value expressions a bit.
2001-01-21 22:02:01 +00:00
Peter Eisentraut 74bbe8097d Replace some oldish, non-SQL'ish elements with more standard forms. (cast
syntax, type names, function names, etc.)
2001-01-20 20:59:29 +00:00
Peter Eisentraut 526427f6d3 Add information about bit types. Adjust some other things to promote
SQL type names over internal type names.
2001-01-13 18:34:51 +00:00
Tom Lane 61784c54b5 Change default output formatting for CIDR to be unabbreviated, per
recommendation from Paul Vixie.  Add a new abbrev() function to produce
abbreviated format as text.  No forced initdb, but new function is not
available unless you do an initdb or add the pg_proc row manually.
2000-12-22 18:00:24 +00:00
Peter Eisentraut f9698a938f Correct results of usage examples. 2000-12-19 17:35:46 +00:00
Tom Lane 7b9fe96812 Update type-coercion discussions to reflect current reality. 2000-12-17 05:55:26 +00:00
Tom Lane 6a0f486a25 A little wordsmithing in the pattern-matching section. 2000-12-16 19:33:23 +00:00
Tom Lane d316f22267 Add note that COALESCE and NULLIF are shorthand forms of CASE. 2000-12-16 18:33:13 +00:00
Peter Eisentraut c3641483c3 Merge functions and operators chapters. Lots of updates. 2000-12-14 22:30:56 +00:00
Tom Lane 796754778d Correct obsolete entry for strpos(). 2000-11-30 23:02:04 +00:00
Peter Eisentraut f4710020d6 Repair markup 2000-11-25 13:20:05 +00:00
Bruce Momjian 3f1998727d here is a patch for formatting.c (to_char/timestampt()), for 7.1
it fixing Y,YY,YYY,YYYY conversion, the docs and regress tests update
 are included too.

  During the patch testing I found small bug in miscadmin.h in
convertstr() declaration. Here it's fixed too.

 Thanks

        Karel
2000-11-25 05:00:33 +00:00
Tom Lane a210023008 Adjust INET/CIDR display conventions and reimplement some INET/CIDR
functions, per recent discussions on pghackers.  For now, I have called
the verbose-display formatting function text(), but will reconsider if
enough people object.
initdb forced.
2000-11-10 20:13:27 +00:00
Peter Eisentraut baa3a09b5f Convert macaddr documentation to DocBook, update outdated information. 2000-10-04 15:47:45 +00:00
Peter Eisentraut 72ad5fe15c Add `id' attributes to all `chapter' and `sect1' tags, to generate useful
names for the HTML files (e.g., not x4856.htm).
2000-09-29 20:21:34 +00:00
Bruce Momjian ebdfac3bb1 the patch include:
- rename ichar() to chr() (discussed with Tom)

        - add docs for oracle compatible routines:

                btrim()
                ascii()
                chr()
                repeat()

        - fix bug with timezone in to_char()

        - all to_char() variants return NULL instead textin("")
          if it's needful.

 The contrib/odbc is without changes and contains same routines as main
tree ... because I not sure how plans are Thomas with this :-)

                                        Karel
---------------------------------------------------------------------------

This effectively one line patch should fix the fact that
foreign key definitions in create table were erroring if
a primary key was defined.  I was using the columns
list to get the columns of the table for comparison, but
it got reused as a temporary list inside the primary key
stuff.

Stephan Szabo
2000-09-25 12:58:47 +00:00
Peter Eisentraut 457ac0331c Implement differentiation between CURRENT_USER and SESSION_USER as per SQL.
There is still no effective difference but it will kick in once setuid
functions exist (not included here).  Make old getpgusername() alias for
current_user.
2000-09-19 18:18:04 +00:00
Bruce Momjian dffd8cac3d * to_char:
- full support for IW (ISO week) and vice versa conversion for IW too
    (the to_char 'week' support is now complete and I hope correct).

  Thomas, I use for IW code from timestamp.c, for this I create separate
  function date2isoweek() from original 'case DTK_WEEK:' code in the
  timestamp_part(). I mean will better use one code for same feature in
  date_part() and in to_char(). The isoweek2date() is added to timestamp.c
  too. Right?

  IMHO in 7.1 will all to_char's features complete. It is cca 41 templates
  for date/time and cca 21 for numbers.

 * to_ascii:

   - gcc, is it correct now? :-)


  In the patch is documentation for to_char's IW and for to_ascii().

                                                        Karel
2000-08-29 04:41:48 +00:00
Tom Lane 9426047021 Clean up bogosities in use of random(3) and srandom(3) --- do not assume
that RAND_MAX applies to them, since it doesn't.  Instead add a
config.h parameter MAX_RANDOM_VALUE.  This is currently set at 2^31-1
but could be auto-configured if that ever proves necessary.  Also fix
some outright bugs like calling srand() where srandom() is appropriate.
2000-08-07 00:51:42 +00:00
Tom Lane d70d46fd60 PATH and POLYGON datatypes are now TOASTable. Associated functions
updated to new fmgr style.  Deleted hoary old functions for compatibility
with pre-6.1 representations of these datatypes.
2000-07-29 18:46:12 +00:00
Tom Lane d06ebdb8d3 Update aggregate-function docs for STDDEV, VARIANCE. 2000-07-17 03:52:28 +00:00
Thomas G. Lockhart 4835f6a8bc Update docs for TIME WITHOUT TIME ZONE.
Add information on SET SESSION CHARACTERISTICS.
Fix references to pg_hba.conf(5) since that is no longer a man page.
2000-07-14 15:26:21 +00:00
Thomas G. Lockhart bebd62c19f Remove reference to tag which is not available to the User's Guide
when built on its own. UG now builds cleanly.
2000-07-08 16:00:15 +00:00
Bruce Momjian efcff3da16 In the attache is new (correct) version. I add TZ (timezone) support
for
to_char() too.

Karel
2000-07-03 16:01:33 +00:00
Bruce Momjian e225260440 Back out Karels to_char changes. 2000-07-01 21:27:14 +00:00
Bruce Momjian 99212a4847 In the attache is new to_date()/to_timestamp() version.
Now the to_timestamp() support WW,W,J,SSSS,DDD conversion from strings and
the am/pm bug is fixed, the to_char() use week-of-year (WW) full compatible
with Oracle.

 This patch update relevant regress-tests and docs too.

                                        Karel
~
~
2000-07-01 14:10:32 +00:00
Bruce Momjian b997a4b91f > Great! Please cc: the docs or hackers mailing lists to make sure the
> patches are not lost...

Aggregate doc patches:

The patches are attached. Be great if you could check them over to make
sure all relevant content (and markup) is there...

Isaac Wilcox
2000-06-20 18:04:18 +00:00
Bruce Momjian 1bea3c3c46 Fix atan3-> atan2. 2000-05-15 01:41:18 +00:00
Thomas G. Lockhart 45f79cae14 Fixups in content and markup for 7.0 release. 2000-05-02 20:02:03 +00:00
Thomas G. Lockhart b27cef2932 Mention support for date_part('week',timestamp).
Fix spelling of "millennium".
 Thanks to Mika Nystrom <mika@camembert.cs.caltech.edu>.
2000-04-14 15:08:56 +00:00
Tom Lane f0a2fc38ab Mention cube root. 2000-04-08 03:42:29 +00:00
Thomas G. Lockhart 9c075df519 Update some porting info.
Add mention of transcendental functions.
2000-04-08 02:16:08 +00:00
Bruce Momjian 28fb1c196b Update create_rule manual page. 2000-04-07 19:17:51 +00:00
Thomas G. Lockhart 30e355fc80 Fix path to initdb in installation instructions.
General cleanup for 7.0.
2000-04-07 13:30:58 +00:00
Thomas G. Lockhart f75bf1877a Accumulated fixups.
Add some chapters on new topics.
Change to referencing OASIS/Docbook v3.1 rather than Davenport/Docbook v3.0
Grepped for and fixed apparent tag mangling from emacs
 "Normalize" operation. Should be the last of those.
2000-03-30 22:22:41 +00:00
Thomas G. Lockhart 0b3214aca0 Add mention of join syntax to release notes, and reformat a few lines.
Update porting info. Still need a lot of platforms tested.
Fix small errors in markup.
2000-03-28 14:35:13 +00:00
Thomas G. Lockhart 39f69bc38f Start updating for the v7.0 release.
Use "generic functions" for math and other routines.
Use SQL92 "type 'literal'" syntax rather than Postgres "'literal'::type".
2000-03-27 17:14:43 +00:00
Tom Lane b9a990d8a8 Add exp(), ln(), and some other functions to numeric-functions table. 2000-03-20 04:20:52 +00:00
Bruce Momjian 394af52795 I'm sending patch with new version of to_char numbers formatting.
The PostgreSQL's to_char() is very compatible with Oracle's to_char
 now. I hope that to_char's 3000 rows of source is without bugs, but
 will good if anyone test it, for me it works very well :-)


                                                        Karel

----------------------------------------------------------------------
Karel Zak <zakkr@zf.jcu.cz>              http://home.zf.jcu.cz/~zakkr/
2000-02-08 15:57:01 +00:00
Bruce Momjian b866d2e2d7 as attache of this mail is patch (to the main tree) with to_char's
family functions. Contain:

  conversion from a datetype to formatted text:

	to_char( datetime, 	text)
	to_char( timestamp,	text)
	to_char( int4,		text)
	to_char( int8,		text)
	to_char( float4,	text)
	to_char( float8,	text)
	to_char( numeric,	text)

  vice versa:

	to_date		( text, text)
	to_datetime	( text, text)
	to_timestamp	( text, text)
	to_number	( text, text)	   (convert to numeric)


  PostgreSQL to_char is very compatible with Oracle's to_char(), but not
total exactly (now). Small differentions are in number formating. It will
fix in next to_char() version.


! If will this patch aplly to the main tree, must be delete the current
  to_char version in contrib (directory "dateformat" and note in contrib's
  README), this patch not erase it (sorry Bruce).



The patch patching files:

	doc/src/sgml/func.sgml
                     ^^^^^^^^
   Hmm, I'm not sure if my English... :( Check it anyone (volunteer)?

   Thomas, it is right? SGML is not my primary lang  and compile
   the current PG docs tree is very happy job (hard variables setting in
   docs/sgml/Makefile --> HSTYLE= /home/users/t/thomas/....  :-)

   What add any definition to global configure.in and set Makefiles in docs
   tree via ./configure?

	src/backend/utils/adt/Makefile
	src/backend/utils/adt/formatting.c
	src/include/catalog/pg_proc.h
	src/include/utils/formatting.h
Karel Zak <zakkr@zf.jcu.cz>              http://home.zf.jcu.cz/~zakkr/
2000-01-25 23:53:56 +00:00
Thomas G. Lockhart fe2f878173 Fix (mis)information about NULLIF() SQL function.
Thanks to Tom Lane for pointing it out.
1999-09-29 05:20:20 +00:00
Thomas G. Lockhart 5e84d58e70 Minor updates for release. 1999-06-14 07:36:12 +00:00
Thomas G. Lockhart 95e3cec621 Include mention of CASE, COALESCE, and IFNULL.
Add date/time parsing procedure (perhaps should be in appendix).
Add time zone information (ditto).
Update keyword list.
1999-05-12 07:32:47 +00:00
Thomas G. Lockhart f3fde99841 Augment info on string functions per Jose Soares' suggestions. 1999-01-19 16:11:18 +00:00
Thomas G. Lockhart a75f2d21a8 Clean up to ensure tag completion as required by the newest versions
of Norm's Modular Style Sheets and jade/docbook.
From Vince Vielhaber <vev@michvhf.com>.
1998-12-29 02:24:47 +00:00
Thomas G. Lockhart e9f10b22f4 Include new cidr and inet data types. 1998-10-27 06:14:41 +00:00
Thomas G. Lockhart ee92ab91ad Add some id tags to allow cross-references from the datatype chapter. 1998-10-14 16:28:31 +00:00
Thomas G. Lockhart bd6b6f40de Add missing information.
Fix examples for regex operators.
1998-07-29 06:32:47 +00:00
Thomas G. Lockhart ba3a99f193 Split function and operator User Guide info
from datatype.sgml into separate files.
Add type conversion information.
Format historical release notes.
1998-07-08 13:53:15 +00:00