From 6cb1f4fe44a92aa97fbfd0c26ebbb8842349d90d Mon Sep 17 00:00:00 2001 From: Bruce Momjian Date: Thu, 13 Feb 2003 05:24:04 +0000 Subject: 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 --- doc/src/sgml/func.sgml | 60 +++++++++++++++++++++++++++----------------------- 1 file changed, 32 insertions(+), 28 deletions(-) (limited to 'doc/src') diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml index a3e66eabc34..f2d84a969aa 100644 --- a/doc/src/sgml/func.sgml +++ b/doc/src/sgml/func.sgml @@ -1,5 +1,5 @@ @@ -682,14 +682,15 @@ PostgreSQL documentation round(42.4382, 2) 42.44 - + + + setseed(dp) + int32 + set seed for subsequent random() calls + setseed(0.54823) + 1177314959 + + sign(dp or numeric) (same as input) @@ -955,7 +956,8 @@ PostgreSQL documentation substring(string from pattern for escape) text - Extract substring matching SQL regular expression + Extract substring matching SQL regular + expression substring @@ -1168,7 +1170,7 @@ PostgreSQL documentation text Return the given string suitably quoted to be used as an identifier - in an SQL query string. + in an SQL query string. Quotes are added only if necessary (i.e., if the string contains non-identifier characters or would be case-folded). Embedded quotes are properly doubled. @@ -1182,7 +1184,7 @@ PostgreSQL documentation text Return the given string suitably quoted to be used as a literal - in an SQL query string. + in an SQL query string. Embedded quotes and backslashes are properly doubled. quote_literal('O\'Reilly') @@ -2511,14 +2513,15 @@ PostgreSQL documentation SUBSTRING(string FROM pattern FOR escape), provides - extraction of a substring that matches a SQL99 regular expression - pattern. As with SIMILAR TO, the specified pattern - must match to the entire data string, else the function fails and - returns null. To indicate the part of the pattern that should be - returned on success, SQL99 specifies that the pattern must - contain two occurrences of the escape character followed by - double quote ("). The text matching the portion of - the pattern between these markers is returned. + extraction of a substring that matches a SQL99 + regular expression pattern. As with SIMILAR TO, the + specified pattern must match to the entire data string, else the + function fails and returns null. To indicate the part of the + pattern that should be returned on success, + SQL99 specifies that the pattern must contain + two occurrences of the escape character followed by double quote + ("). The text matching the portion of the pattern + between these markers is returned. @@ -6025,11 +6028,11 @@ SELECT TIMESTAMP 'now'; - For largely historical reasons, the sequence to be operated on by - a sequence-function call is specified by a text-string argument. - To achieve some compatibility with the handling of ordinary SQL - names, the sequence functions convert their argument to lower case - unless the string is double-quoted. Thus + For largely historical reasons, the sequence to be operated on by a + sequence-function call is specified by a text-string argument. To + achieve some compatibility with the handling of ordinary + SQL names, the sequence functions convert their + argument to lower case unless the string is double-quoted. Thus nextval('foo') operates on sequence foo nextval('FOO') operates on sequence foo @@ -6480,7 +6483,8 @@ SELECT NULLIF(value, '(none)') ... The current_setting is used to obtain the current value of the setting_name setting, as a query - result. It is the equivalent to the SQL SHOW command. + result. It is the equivalent to the SQL + SHOW command. For example: select current_setting('DateStyle'); @@ -6497,8 +6501,8 @@ select current_setting('DateStyle'); If is_local is set to true, the new value will only apply to the current transaction. If you want the new value to apply for the current session, use - false instead. It is the equivalent to the SQL - SET command. For example: + false instead. It is the equivalent to the + SQL SET command. For example: select set_config('show_statement_stats','off','f'); set_config -- cgit v1.2.3