diff options
author | Neil Conway | 2004-05-14 21:42:30 +0000 |
---|---|---|
committer | Neil Conway | 2004-05-14 21:42:30 +0000 |
commit | 0079547bcbedff2a653204571c3cda22c35907d4 (patch) | |
tree | a39f767c36a3299c57c6a2638b419c15c42b12dd /doc/src | |
parent | 19a495caaa8a0b9b5a1ee9b1b487697cce7e99db (diff) |
Implement the width_bucket() function, per SQL2003. This commit only adds
a variant of the function for the 'numeric' datatype; it would be possible
to add additional variants for other datatypes, but I haven't done so yet.
This commit includes regression tests and minimal documentation; if we
want developers to actually use this function in applications, we'll
probably need to document what it does more fully.
Diffstat (limited to 'doc/src')
-rw-r--r-- | doc/src/sgml/errcodes.sgml | 7 | ||||
-rw-r--r-- | doc/src/sgml/func.sgml | 12 | ||||
-rw-r--r-- | doc/src/sgml/xfunc.sgml | 16 |
3 files changed, 25 insertions, 10 deletions
diff --git a/doc/src/sgml/errcodes.sgml b/doc/src/sgml/errcodes.sgml index 2f211f462e8..295c41ffad8 100644 --- a/doc/src/sgml/errcodes.sgml +++ b/doc/src/sgml/errcodes.sgml @@ -1,4 +1,4 @@ -<!-- $PostgreSQL: pgsql/doc/src/sgml/errcodes.sgml,v 1.4 2004/05/14 18:04:02 neilc Exp $ --> +<!-- $PostgreSQL: pgsql/doc/src/sgml/errcodes.sgml,v 1.5 2004/05/14 21:42:27 neilc Exp $ --> <appendix id="errcodes-appendix"> <title><productname>PostgreSQL</productname> Error Codes</title> @@ -311,6 +311,11 @@ </row> <row> +<entry><literal>2201G</literal></entry> +<entry>INVALID ARGUMENT FOR WIDTH BUCKET FUNCTION</entry> +</row> + +<row> <entry><literal>22018</literal></entry> <entry>INVALID CHARACTER VALUE FOR CAST</entry> </row> diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml index 1dde8b59a3c..6fd36fe77bc 100644 --- a/doc/src/sgml/func.sgml +++ b/doc/src/sgml/func.sgml @@ -1,5 +1,5 @@ <!-- -$PostgreSQL: pgsql/doc/src/sgml/func.sgml,v 1.201 2004/05/10 22:44:42 tgl Exp $ +$PostgreSQL: pgsql/doc/src/sgml/func.sgml,v 1.202 2004/05/14 21:42:27 neilc Exp $ PostgreSQL documentation --> @@ -751,6 +751,16 @@ PostgreSQL documentation <entry><literal>42.43</literal></entry> </row> + <row> + <entry><literal><function>width_bucket</function>(<parameter>op</parameter> <type>numeric</type>, <parameter>b1</parameter> <type>numeric</type>, <parameter>b2</parameter> <type>numeric</type>, <parameter>count</parameter> <type>integer</type>)</literal></entry> + <entry><type>integer</type></entry> + <entry>return the bucket to which <parameter>operand</> would + be assigned in an equidepth histogram with <parameter>count</> + buckets, an upper bound of <parameter>b1</>, and a lower bound + of <parameter>b2</></entry> + <entry><literal>width_bucket(5.35, 0.024, 10.06, 5)</literal></entry> + <entry><literal>3</literal></entry> + </row> </tbody> </tgroup> </table> diff --git a/doc/src/sgml/xfunc.sgml b/doc/src/sgml/xfunc.sgml index a3c24a1c4c1..ed2a502c69e 100644 --- a/doc/src/sgml/xfunc.sgml +++ b/doc/src/sgml/xfunc.sgml @@ -1,5 +1,5 @@ <!-- -$PostgreSQL: pgsql/doc/src/sgml/xfunc.sgml,v 1.82 2004/05/10 22:44:43 tgl Exp $ +$PostgreSQL: pgsql/doc/src/sgml/xfunc.sgml,v 1.83 2004/05/14 21:42:27 neilc Exp $ --> <sect1 id="xfunc"> @@ -56,7 +56,7 @@ $PostgreSQL: pgsql/doc/src/sgml/xfunc.sgml,v 1.82 2004/05/10 22:44:43 tgl Exp $ </para> <para> - It's easiest to define <acronym>SQL</acronym> + It's easiest to define <acronym>SQL</acronym> functions, so we'll start by discussing those. Most of the concepts presented for <acronym>SQL</acronym> functions will carry over to the other types of functions. @@ -64,12 +64,12 @@ $PostgreSQL: pgsql/doc/src/sgml/xfunc.sgml,v 1.82 2004/05/10 22:44:43 tgl Exp $ <para> Throughout this chapter, it can be useful to look at the reference - page of the <command>CREATE FUNCTION</command> command to - understand the examples better. - Some examples from this chapter - can be found in <filename>funcs.sql</filename> - and <filename>funcs.c</filename> in the <filename>src/tutorial</> - directory in the <productname>PostgreSQL</productname> source distribution. + page of the <xref linkend="sql-createfunction"> command to + understand the examples better. Some examples from this chapter + can be found in <filename>funcs.sql</filename> and + <filename>funcs.c</filename> in the <filename>src/tutorial</> + directory in the <productname>PostgreSQL</productname> source + distribution. </para> </sect1> |