postgresql/src/include/catalog
Peter Eisentraut a2da77cdb4 Change return type of EXTRACT to numeric
The previous implementation of EXTRACT mapped internally to
date_part(), which returned type double precision (since it was
implemented long before the numeric type existed).  This can lead to
imprecise output in some cases, so returning numeric would be
preferrable.  Changing the return type of an existing function is a
bit risky, so instead we do the following:  We implement a new set of
functions, which are now called "extract", in parallel to the existing
date_part functions.  They work the same way internally but use
numeric instead of float8.  The EXTRACT construct is now mapped by the
parser to these new extract functions.  That way, dumps of views
etc. from old versions (which would use date_part) continue to work
unchanged, but new uses will map to the new extract functions.

Additionally, the reverse compilation of EXTRACT now reproduces the
original syntax, using the new mechanism introduced in
40c24bfef9.

The following minor changes of behavior result from the new
implementation:

- The column name from an isolated EXTRACT call is now "extract"
  instead of "date_part".

- Extract from date now rejects inappropriate field names such as
  HOUR.  It was previously mapped internally to extract from
  timestamp, so it would silently accept everything appropriate for
  timestamp.

- Return values when extracting fields with possibly fractional
  values, such as second and epoch, now have the full scale that the
  value has internally (so, for example, '1.000000' instead of just
  '1').

Reported-by: Petr Fedorov <petr.fedorov@phystech.edu>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://www.postgresql.org/message-id/flat/42b73d2d-da12-ba9f-570a-420e0cce19d9@phystech.edu
2021-04-06 07:20:42 +02:00
..
.gitignore Build in some knowledge about foreign-key relationships in the catalogs. 2021-02-02 17:11:55 -05:00
binary_upgrade.h Update copyright for 2021 2021-01-02 13:06:25 -05:00
catalog.h Update copyright for 2021 2021-01-02 13:06:25 -05:00
catversion.h Change return type of EXTRACT to numeric 2021-04-06 07:20:42 +02:00
dependency.h Prevent drop of tablespaces used by partitioned relations 2021-01-14 15:32:14 -03:00
duplicate_oids Update copyright for 2021 2021-01-02 13:06:25 -05:00
genbki.h Build in some knowledge about foreign-key relationships in the catalogs. 2021-02-02 17:11:55 -05:00
heap.h Update copyright for 2021 2021-01-02 13:06:25 -05:00
index.h Add TABLESPACE option to REINDEX 2021-02-04 14:34:20 +09:00
indexing.h Update copyright for 2021 2021-01-02 13:06:25 -05:00
Makefile Update copyright for 2021 2021-01-02 13:06:25 -05:00
namespace.h Update copyright for 2021 2021-01-02 13:06:25 -05:00
objectaccess.h Update copyright for 2021 2021-01-02 13:06:25 -05:00
objectaddress.h Update copyright for 2021 2021-01-02 13:06:25 -05:00
partition.h ALTER TABLE ... DETACH PARTITION ... CONCURRENTLY 2021-03-25 18:00:28 -03:00
pg_aggregate.dat Add bit_xor aggregate function 2021-03-06 19:28:05 +01:00
pg_aggregate.h Build in some knowledge about foreign-key relationships in the catalogs. 2021-02-02 17:11:55 -05:00
pg_am.dat Update copyright for 2021 2021-01-02 13:06:25 -05:00
pg_am.h Add primary keys and unique constraints to system catalogs 2021-01-30 19:44:29 +01:00
pg_amop.dat BRIN minmax-multi indexes 2021-03-26 13:54:30 +01:00
pg_amop.h Build in some knowledge about foreign-key relationships in the catalogs. 2021-02-02 17:11:55 -05:00
pg_amproc.dat BRIN minmax-multi indexes 2021-03-26 13:54:30 +01:00
pg_amproc.h Add primary keys and unique constraints to system catalogs 2021-01-30 19:44:29 +01:00
pg_attrdef.h Build in some knowledge about foreign-key relationships in the catalogs. 2021-02-02 17:11:55 -05:00
pg_attribute.h Allow configurable LZ4 TOAST compression. 2021-03-19 15:10:38 -04:00
pg_auth_members.h Build in some knowledge about foreign-key relationships in the catalogs. 2021-02-02 17:11:55 -05:00
pg_authid.dat Add pg_read_all_data and pg_write_all_data roles 2021-04-05 13:42:52 -04:00
pg_authid.h Add primary keys and unique constraints to system catalogs 2021-01-30 19:44:29 +01:00
pg_cast.dat Run reformat-dat-files to declutter the catalog data files. 2021-01-13 16:14:38 -05:00
pg_cast.h Build in some knowledge about foreign-key relationships in the catalogs. 2021-02-02 17:11:55 -05:00
pg_class.dat Update copyright for 2021 2021-01-02 13:06:25 -05:00
pg_class.h Remove special BKI_LOOKUP magic for namespace and role OIDs. 2021-02-03 12:01:48 -05:00
pg_collation.dat Build in some knowledge about foreign-key relationships in the catalogs. 2021-02-02 17:11:55 -05:00
pg_collation.h Remove special BKI_LOOKUP magic for namespace and role OIDs. 2021-02-03 12:01:48 -05:00
pg_constraint.h Build in some knowledge about foreign-key relationships in the catalogs. 2021-02-02 17:11:55 -05:00
pg_control.h Update copyright for 2021 2021-01-02 13:06:25 -05:00
pg_conversion.dat Update copyright for 2021 2021-01-02 13:06:25 -05:00
pg_conversion.h Remove special BKI_LOOKUP magic for namespace and role OIDs. 2021-02-03 12:01:48 -05:00
pg_database.dat Update copyright for 2021 2021-01-02 13:06:25 -05:00
pg_database.h Remove special BKI_LOOKUP magic for namespace and role OIDs. 2021-02-03 12:01:48 -05:00
pg_db_role_setting.h Build in some knowledge about foreign-key relationships in the catalogs. 2021-02-02 17:11:55 -05:00
pg_default_acl.h Build in some knowledge about foreign-key relationships in the catalogs. 2021-02-02 17:11:55 -05:00
pg_depend.h Build in some knowledge about foreign-key relationships in the catalogs. 2021-02-02 17:11:55 -05:00
pg_description.h Build in some knowledge about foreign-key relationships in the catalogs. 2021-02-02 17:11:55 -05:00
pg_enum.h Build in some knowledge about foreign-key relationships in the catalogs. 2021-02-02 17:11:55 -05:00
pg_event_trigger.h Build in some knowledge about foreign-key relationships in the catalogs. 2021-02-02 17:11:55 -05:00
pg_extension.h Build in some knowledge about foreign-key relationships in the catalogs. 2021-02-02 17:11:55 -05:00
pg_foreign_data_wrapper.h Build in some knowledge about foreign-key relationships in the catalogs. 2021-02-02 17:11:55 -05:00
pg_foreign_server.h Build in some knowledge about foreign-key relationships in the catalogs. 2021-02-02 17:11:55 -05:00
pg_foreign_table.h Build in some knowledge about foreign-key relationships in the catalogs. 2021-02-02 17:11:55 -05:00
pg_index.h Build in some knowledge about foreign-key relationships in the catalogs. 2021-02-02 17:11:55 -05:00
pg_inherits.h ALTER TABLE ... DETACH PARTITION ... CONCURRENTLY 2021-03-25 18:00:28 -03:00
pg_init_privs.h Build in some knowledge about foreign-key relationships in the catalogs. 2021-02-02 17:11:55 -05:00
pg_language.dat Update copyright for 2021 2021-01-02 13:06:25 -05:00
pg_language.h Remove special BKI_LOOKUP magic for namespace and role OIDs. 2021-02-03 12:01:48 -05:00
pg_largeobject_metadata.h Build in some knowledge about foreign-key relationships in the catalogs. 2021-02-02 17:11:55 -05:00
pg_largeobject.h Build in some knowledge about foreign-key relationships in the catalogs. 2021-02-02 17:11:55 -05:00
pg_namespace.dat Build in some knowledge about foreign-key relationships in the catalogs. 2021-02-02 17:11:55 -05:00
pg_namespace.h Remove special BKI_LOOKUP magic for namespace and role OIDs. 2021-02-03 12:01:48 -05:00
pg_opclass.dat BRIN minmax-multi indexes 2021-03-26 13:54:30 +01:00
pg_opclass.h Remove special BKI_LOOKUP magic for namespace and role OIDs. 2021-02-03 12:01:48 -05:00
pg_operator.dat Add TID Range Scans to support efficient scanning ranges of TIDs 2021-02-27 22:59:36 +13:00
pg_operator.h Remove special BKI_LOOKUP magic for namespace and role OIDs. 2021-02-03 12:01:48 -05:00
pg_opfamily.dat BRIN minmax-multi indexes 2021-03-26 13:54:30 +01:00
pg_opfamily.h Remove special BKI_LOOKUP magic for namespace and role OIDs. 2021-02-03 12:01:48 -05:00
pg_partitioned_table.h Build in some knowledge about foreign-key relationships in the catalogs. 2021-02-02 17:11:55 -05:00
pg_policy.h Build in some knowledge about foreign-key relationships in the catalogs. 2021-02-02 17:11:55 -05:00
pg_proc.dat Change return type of EXTRACT to numeric 2021-04-06 07:20:42 +02:00
pg_proc.h Remove special BKI_LOOKUP magic for namespace and role OIDs. 2021-02-03 12:01:48 -05:00
pg_publication_rel.h Build in some knowledge about foreign-key relationships in the catalogs. 2021-02-02 17:11:55 -05:00
pg_publication.h Build in some knowledge about foreign-key relationships in the catalogs. 2021-02-02 17:11:55 -05:00
pg_range.dat Run reformat-dat-files to declutter the catalog data files. 2021-01-13 16:14:38 -05:00
pg_range.h Build in some knowledge about foreign-key relationships in the catalogs. 2021-02-02 17:11:55 -05:00
pg_replication_origin.h Add primary keys and unique constraints to system catalogs 2021-01-30 19:44:29 +01:00
pg_rewrite.h Build in some knowledge about foreign-key relationships in the catalogs. 2021-02-02 17:11:55 -05:00
pg_seclabel.h Build in some knowledge about foreign-key relationships in the catalogs. 2021-02-02 17:11:55 -05:00
pg_sequence.h Build in some knowledge about foreign-key relationships in the catalogs. 2021-02-02 17:11:55 -05:00
pg_shdepend.h Build in some knowledge about foreign-key relationships in the catalogs. 2021-02-02 17:11:55 -05:00
pg_shdescription.h Build in some knowledge about foreign-key relationships in the catalogs. 2021-02-02 17:11:55 -05:00
pg_shseclabel.h Build in some knowledge about foreign-key relationships in the catalogs. 2021-02-02 17:11:55 -05:00
pg_statistic_ext_data.h Extended statistics on expressions 2021-03-27 00:01:11 +01:00
pg_statistic_ext.h Extended statistics on expressions 2021-03-27 00:01:11 +01:00
pg_statistic.h Build in some knowledge about foreign-key relationships in the catalogs. 2021-02-02 17:11:55 -05:00
pg_subscription_rel.h Allow multiple xacts during table sync in logical replication. 2021-02-12 07:41:51 +05:30
pg_subscription.h Build in some knowledge about foreign-key relationships in the catalogs. 2021-02-02 17:11:55 -05:00
pg_tablespace.dat Build in some knowledge about foreign-key relationships in the catalogs. 2021-02-02 17:11:55 -05:00
pg_tablespace.h Remove special BKI_LOOKUP magic for namespace and role OIDs. 2021-02-03 12:01:48 -05:00
pg_transform.h Build in some knowledge about foreign-key relationships in the catalogs. 2021-02-02 17:11:55 -05:00
pg_trigger.h Build in some knowledge about foreign-key relationships in the catalogs. 2021-02-02 17:11:55 -05:00
pg_ts_config_map.dat Update copyright for 2021 2021-01-02 13:06:25 -05:00
pg_ts_config_map.h Add primary keys and unique constraints to system catalogs 2021-01-30 19:44:29 +01:00
pg_ts_config.dat Update copyright for 2021 2021-01-02 13:06:25 -05:00
pg_ts_config.h Remove special BKI_LOOKUP magic for namespace and role OIDs. 2021-02-03 12:01:48 -05:00
pg_ts_dict.dat Update copyright for 2021 2021-01-02 13:06:25 -05:00
pg_ts_dict.h Remove special BKI_LOOKUP magic for namespace and role OIDs. 2021-02-03 12:01:48 -05:00
pg_ts_parser.dat Update copyright for 2021 2021-01-02 13:06:25 -05:00
pg_ts_parser.h Remove special BKI_LOOKUP magic for namespace and role OIDs. 2021-02-03 12:01:48 -05:00
pg_ts_template.dat Update copyright for 2021 2021-01-02 13:06:25 -05:00
pg_ts_template.h Remove special BKI_LOOKUP magic for namespace and role OIDs. 2021-02-03 12:01:48 -05:00
pg_type.dat BRIN minmax-multi indexes 2021-03-26 13:54:30 +01:00
pg_type.h Remove special BKI_LOOKUP magic for namespace and role OIDs. 2021-02-03 12:01:48 -05:00
pg_user_mapping.h Build in some knowledge about foreign-key relationships in the catalogs. 2021-02-02 17:11:55 -05:00
reformat_dat_file.pl Update copyright for 2021 2021-01-02 13:06:25 -05:00
renumber_oids.pl Update copyright for 2021 2021-01-02 13:06:25 -05:00
storage_xlog.h Update copyright for 2021 2021-01-02 13:06:25 -05:00
storage.h Update copyright for 2021 2021-01-02 13:06:25 -05:00
toasting.h Update copyright for 2021 2021-01-02 13:06:25 -05:00
unused_oids Update copyright for 2021 2021-01-02 13:06:25 -05:00