1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-22 02:52:08 +03:00

Add missing operators of the form interval-plus-datetime, as required for

better SQL compliance in this area, per recent discussion.  Mark related
operators as commutators where possible.  (The system doesn't actually care
about commutator marking for operators not returning boolean, at the moment,
but this seems forward-thinking and besides it made it easier to verify
that we hadn't missed any.)
Also, remove interval-minus-time and interval-minus-timetz operators.
I'm not sure how these got in, but they are nonstandard and had very
obviously broken behavior.  (minus is not commutative in anyone's book.)
I doubt anyone had ever used 'em, because we'd surely have gotten a bug
report about it if so.
This commit is contained in:
Tom Lane
2004-07-02 22:50:23 +00:00
parent 0b89d261c7
commit e34082ee3b
8 changed files with 48 additions and 93 deletions

View File

@ -1,5 +1,5 @@
<!--
$PostgreSQL: pgsql/doc/src/sgml/func.sgml,v 1.212 2004/07/02 18:59:20 joe Exp $
$PostgreSQL: pgsql/doc/src/sgml/func.sgml,v 1.213 2004/07/02 22:49:45 tgl Exp $
PostgreSQL documentation
-->
@ -4689,7 +4689,10 @@ substring('foobar' from 'o(.)b') <lineannotation>o</lineannotation>
All the functions and operators described below that take <type>time</type> or <type>timestamp</type>
inputs actually come in two variants: one that takes <type>time with time zone</type> or <type>timestamp
with time zone</type>, and one that takes <type>time without time zone</type> or <type>timestamp without time zone</type>.
For brevity, these variants are not shown separately.
For brevity, these variants are not shown separately. Also, the
<literal>+</> and <literal>*</> operators come in commutative pairs (for
example both date + integer and integer + date); we show only one of each
such pair.
</para>
<table id="operators-datetime-table">
@ -4723,12 +4726,6 @@ substring('foobar' from 'o(.)b') <lineannotation>o</lineannotation>
<entry><literal>timestamp '2001-09-28 03:00'</literal></entry>
</row>
<row>
<entry> <literal>+</literal> </entry>
<entry><literal>time '03:00' + date '2001-09-28'</literal></entry>
<entry><literal>timestamp '2001-09-28 03:00'</literal></entry>
</row>
<row>
<entry> <literal>+</literal> </entry>
<entry><literal>interval '1 day' + interval '1 hour'</literal></entry>
@ -4747,12 +4744,6 @@ substring('foobar' from 'o(.)b') <lineannotation>o</lineannotation>
<entry><literal>time '04:00'</literal></entry>
</row>
<row>
<entry> <literal>+</literal> </entry>
<entry><literal>interval '3 hours' + time '01:00'</literal></entry>
<entry><literal>time '04:00'</literal></entry>
</row>
<row>
<entry> <literal>-</literal> </entry>
<entry><literal>- interval '23 hours'</literal></entry>
@ -4801,24 +4792,12 @@ substring('foobar' from 'o(.)b') <lineannotation>o</lineannotation>
<entry><literal>interval '23:00'</literal></entry>
</row>
<row>
<entry> <literal>-</literal> </entry>
<entry><literal>interval '2 hours' - time '05:00'</literal></entry>
<entry><literal>time '03:00'</literal></entry>
</row>
<row>
<entry> <literal>-</literal> </entry>
<entry><literal>timestamp '2001-09-29 03:00' - timestamp '2001-09-27 12:00'</literal></entry>
<entry><literal>interval '1 day 15:00'</literal></entry>
</row>
<row>
<entry> <literal>*</literal> </entry>
<entry><literal>double precision '3.5' * interval '1 hour'</literal></entry>
<entry><literal>interval '03:30'</literal></entry>
</row>
<row>
<entry> <literal>*</literal> </entry>
<entry><literal>interval '1 hour' * double precision '3.5'</literal></entry>
@ -7332,7 +7311,7 @@ SELECT pg_type_is_visible('myschema.widget'::regtype);
<row>
<entry><literal><function>pg_tablespace_databases</function>(<parameter>tablespace_oid</parameter>)</literal></entry>
<entry><type>setof oid</type></entry>
<entry>get set of database oids that have objects in the tablespace</entry>
<entry>get set of database OIDs that have objects in the tablespace</entry>
</row>
</tbody>
</tgroup>
@ -7373,12 +7352,13 @@ SELECT pg_type_is_visible('myschema.widget'::regtype);
<para>
<function>pg_tablespace_databases</function> allows usage examination of a
tablespace. It will return a set of database oids, that have objects
tablespace. It will return a set of OIDs of databases that have objects
stored in the tablespace. If this function returns any row, the
tablespace is assumed not to be empty and cannot be dropped. To
display the actual objects populating the tablespace, you will need
to connect to the databases returned by
<function>pg_tablespace_databases</function> to query pg_class.
tablespace is not empty and cannot be dropped. To
display the specific objects populating the tablespace, you will need
to connect to the databases identified by
<function>pg_tablespace_databases</function> and query their
<structname>pg_class</> catalogs.
</para>
<indexterm zone="functions-misc">