1996-08-28 03:59:28 +02:00
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
*
|
1999-02-14 00:22:53 +01:00
|
|
|
* builtins.h
|
1997-09-07 07:04:48 +02:00
|
|
|
* Declarations for operations on built-in types.
|
1996-08-28 03:59:28 +02:00
|
|
|
*
|
|
|
|
*
|
2017-01-03 19:48:53 +01:00
|
|
|
* Portions Copyright (c) 1996-2017, PostgreSQL Global Development Group
|
2000-01-26 06:58:53 +01:00
|
|
|
* Portions Copyright (c) 1994, Regents of the University of California
|
1996-08-28 03:59:28 +02:00
|
|
|
*
|
2010-09-20 22:08:53 +02:00
|
|
|
* src/include/utils/builtins.h
|
1996-08-28 03:59:28 +02:00
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
#ifndef BUILTINS_H
|
|
|
|
#define BUILTINS_H
|
|
|
|
|
2000-08-24 05:29:15 +02:00
|
|
|
#include "fmgr.h"
|
2016-02-03 20:17:35 +01:00
|
|
|
#include "utils/sortsupport.h"
|
1996-08-28 03:59:28 +02:00
|
|
|
|
|
|
|
/*
|
1997-09-07 07:04:48 +02:00
|
|
|
* Defined in adt/
|
1996-08-28 03:59:28 +02:00
|
|
|
*/
|
2001-06-14 03:09:22 +02:00
|
|
|
|
|
|
|
/* acl.c */
|
2009-02-06 22:15:12 +01:00
|
|
|
extern Datum has_any_column_privilege_name_name(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum has_any_column_privilege_name_id(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum has_any_column_privilege_id_name(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum has_any_column_privilege_id_id(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum has_any_column_privilege_name(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum has_any_column_privilege_id(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum has_column_privilege_name_name_name(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum has_column_privilege_name_name_attnum(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum has_column_privilege_name_id_name(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum has_column_privilege_name_id_attnum(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum has_column_privilege_id_name_name(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum has_column_privilege_id_name_attnum(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum has_column_privilege_id_id_name(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum has_column_privilege_id_id_attnum(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum has_column_privilege_name_name(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum has_column_privilege_name_attnum(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum has_column_privilege_id_name(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum has_column_privilege_id_attnum(PG_FUNCTION_ARGS);
|
2001-06-14 03:09:22 +02:00
|
|
|
extern Datum has_table_privilege_name_name(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum has_table_privilege_name_id(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum has_table_privilege_id_name(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum has_table_privilege_id_id(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum has_table_privilege_name(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum has_table_privilege_id(PG_FUNCTION_ARGS);
|
2009-08-03 23:11:40 +02:00
|
|
|
extern Datum has_sequence_privilege_name_name(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum has_sequence_privilege_name_id(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum has_sequence_privilege_id_name(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum has_sequence_privilege_id_id(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum has_sequence_privilege_name(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum has_sequence_privilege_id(PG_FUNCTION_ARGS);
|
2002-08-09 18:45:16 +02:00
|
|
|
extern Datum has_database_privilege_name_name(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum has_database_privilege_name_id(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum has_database_privilege_id_name(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum has_database_privilege_id_id(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum has_database_privilege_name(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum has_database_privilege_id(PG_FUNCTION_ARGS);
|
2008-12-19 17:25:19 +01:00
|
|
|
extern Datum has_foreign_data_wrapper_privilege_name_name(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum has_foreign_data_wrapper_privilege_name_id(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum has_foreign_data_wrapper_privilege_id_name(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum has_foreign_data_wrapper_privilege_id_id(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum has_foreign_data_wrapper_privilege_name(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum has_foreign_data_wrapper_privilege_id(PG_FUNCTION_ARGS);
|
2002-08-09 18:45:16 +02:00
|
|
|
extern Datum has_function_privilege_name_name(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum has_function_privilege_name_id(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum has_function_privilege_id_name(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum has_function_privilege_id_id(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum has_function_privilege_name(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum has_function_privilege_id(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum has_language_privilege_name_name(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum has_language_privilege_name_id(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum has_language_privilege_id_name(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum has_language_privilege_id_id(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum has_language_privilege_name(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum has_language_privilege_id(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum has_schema_privilege_name_name(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum has_schema_privilege_name_id(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum has_schema_privilege_id_name(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum has_schema_privilege_id_id(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum has_schema_privilege_name(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum has_schema_privilege_id(PG_FUNCTION_ARGS);
|
2008-12-19 17:25:19 +01:00
|
|
|
extern Datum has_server_privilege_name_name(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum has_server_privilege_name_id(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum has_server_privilege_id_name(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum has_server_privilege_id_id(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum has_server_privilege_name(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum has_server_privilege_id(PG_FUNCTION_ARGS);
|
2004-07-12 22:23:59 +02:00
|
|
|
extern Datum has_tablespace_privilege_name_name(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum has_tablespace_privilege_name_id(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum has_tablespace_privilege_id_name(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum has_tablespace_privilege_id_id(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum has_tablespace_privilege_name(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum has_tablespace_privilege_id(PG_FUNCTION_ARGS);
|
2011-12-19 23:05:19 +01:00
|
|
|
extern Datum has_type_privilege_name_name(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum has_type_privilege_name_id(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum has_type_privilege_id_name(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum has_type_privilege_id_id(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum has_type_privilege_name(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum has_type_privilege_id(PG_FUNCTION_ARGS);
|
2005-07-26 02:04:19 +02:00
|
|
|
extern Datum pg_has_role_name_name(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum pg_has_role_name_id(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum pg_has_role_id_name(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum pg_has_role_id_id(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum pg_has_role_name(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum pg_has_role_id(PG_FUNCTION_ARGS);
|
2001-06-14 03:09:22 +02:00
|
|
|
|
2016-08-14 00:31:14 +02:00
|
|
|
/* amutils.c */
|
|
|
|
extern Datum pg_indexam_has_property(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum pg_index_has_property(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum pg_index_column_has_property(PG_FUNCTION_ARGS);
|
|
|
|
|
1996-08-28 03:59:28 +02:00
|
|
|
/* bool.c */
|
2000-06-05 09:29:25 +02:00
|
|
|
extern Datum boolin(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum boolout(PG_FUNCTION_ARGS);
|
2003-05-13 01:08:52 +02:00
|
|
|
extern Datum boolrecv(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum boolsend(PG_FUNCTION_ARGS);
|
2007-06-02 01:40:19 +02:00
|
|
|
extern Datum booltext(PG_FUNCTION_ARGS);
|
2000-06-05 09:29:25 +02:00
|
|
|
extern Datum booleq(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum boolne(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum boollt(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum boolgt(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum boolle(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum boolge(PG_FUNCTION_ARGS);
|
2004-05-26 17:26:28 +02:00
|
|
|
extern Datum booland_statefunc(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum boolor_statefunc(PG_FUNCTION_ARGS);
|
2014-04-13 06:01:46 +02:00
|
|
|
extern Datum bool_accum(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum bool_accum_inv(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum bool_alltrue(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum bool_anytrue(PG_FUNCTION_ARGS);
|
2009-03-09 15:34:35 +01:00
|
|
|
extern bool parse_bool(const char *value, bool *result);
|
|
|
|
extern bool parse_bool_with_len(const char *value, size_t len, bool *result);
|
1996-08-28 03:59:28 +02:00
|
|
|
|
|
|
|
/* char.c */
|
2000-06-05 09:29:25 +02:00
|
|
|
extern Datum charin(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum charout(PG_FUNCTION_ARGS);
|
2003-05-13 01:08:52 +02:00
|
|
|
extern Datum charrecv(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum charsend(PG_FUNCTION_ARGS);
|
2000-06-05 09:29:25 +02:00
|
|
|
extern Datum chareq(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum charne(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum charlt(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum charle(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum chargt(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum charge(PG_FUNCTION_ARGS);
|
2004-10-05 00:49:59 +02:00
|
|
|
extern Datum chartoi4(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum i4tochar(PG_FUNCTION_ARGS);
|
2000-06-05 09:29:25 +02:00
|
|
|
extern Datum text_char(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum char_text(PG_FUNCTION_ARGS);
|
1996-08-28 03:59:28 +02:00
|
|
|
|
2006-04-06 00:11:58 +02:00
|
|
|
/* domains.c */
|
|
|
|
extern Datum domain_in(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum domain_recv(PG_FUNCTION_ARGS);
|
Provide database object names as separate fields in error messages.
This patch addresses the problem that applications currently have to
extract object names from possibly-localized textual error messages,
if they want to know for example which index caused a UNIQUE_VIOLATION
failure. It adds new error message fields to the wire protocol, which
can carry the name of a table, table column, data type, or constraint
associated with the error. (Since the protocol spec has always instructed
clients to ignore unrecognized field types, this should not create any
compatibility problem.)
Support for providing these new fields has been added to just a limited set
of error reports (mainly, those in the "integrity constraint violation"
SQLSTATE class), but we will doubtless add them to more calls in future.
Pavel Stehule, reviewed and extensively revised by Peter Geoghegan, with
additional hacking by Tom Lane.
2013-01-29 23:06:26 +01:00
|
|
|
extern void domain_check(Datum value, bool isnull, Oid domainType,
|
|
|
|
void **extra, MemoryContext mcxt);
|
|
|
|
extern int errdatatype(Oid datatypeOid);
|
|
|
|
extern int errdomainconstraint(Oid datatypeOid, const char *conname);
|
2006-04-06 00:11:58 +02:00
|
|
|
|
2009-08-04 18:08:37 +02:00
|
|
|
/* encode.c */
|
|
|
|
extern Datum binary_encode(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum binary_decode(PG_FUNCTION_ARGS);
|
|
|
|
extern unsigned hex_encode(const char *src, unsigned len, char *dst);
|
|
|
|
extern unsigned hex_decode(const char *src, unsigned len, char *dst);
|
|
|
|
|
2007-04-02 05:49:42 +02:00
|
|
|
/* enum.c */
|
|
|
|
extern Datum enum_in(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum enum_out(PG_FUNCTION_ARGS);
|
2007-09-04 18:41:43 +02:00
|
|
|
extern Datum enum_recv(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum enum_send(PG_FUNCTION_ARGS);
|
2007-04-02 05:49:42 +02:00
|
|
|
extern Datum enum_lt(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum enum_le(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum enum_eq(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum enum_ne(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum enum_ge(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum enum_gt(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum enum_cmp(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum enum_smaller(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum enum_larger(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum enum_first(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum enum_last(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum enum_range_bounds(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum enum_range_all(PG_FUNCTION_ARGS);
|
|
|
|
|
1996-08-28 03:59:28 +02:00
|
|
|
/* int.c */
|
2000-06-05 09:29:25 +02:00
|
|
|
extern Datum int2in(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum int2out(PG_FUNCTION_ARGS);
|
2003-05-09 17:44:42 +02:00
|
|
|
extern Datum int2recv(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum int2send(PG_FUNCTION_ARGS);
|
2000-06-05 09:29:25 +02:00
|
|
|
extern Datum int2vectorin(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum int2vectorout(PG_FUNCTION_ARGS);
|
2003-05-09 17:44:42 +02:00
|
|
|
extern Datum int2vectorrecv(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum int2vectorsend(PG_FUNCTION_ARGS);
|
2000-06-05 09:29:25 +02:00
|
|
|
extern Datum int4in(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum int4out(PG_FUNCTION_ARGS);
|
2003-05-09 17:44:42 +02:00
|
|
|
extern Datum int4recv(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum int4send(PG_FUNCTION_ARGS);
|
2000-06-05 09:29:25 +02:00
|
|
|
extern Datum i2toi4(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum i4toi2(PG_FUNCTION_ARGS);
|
2005-02-27 09:31:30 +01:00
|
|
|
extern Datum int4_bool(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum bool_int4(PG_FUNCTION_ARGS);
|
2000-06-05 09:29:25 +02:00
|
|
|
extern Datum int4eq(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum int4ne(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum int4lt(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum int4le(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum int4gt(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum int4ge(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum int2eq(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum int2ne(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum int2lt(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum int2le(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum int2gt(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum int2ge(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum int24eq(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum int24ne(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum int24lt(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum int24le(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum int24gt(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum int24ge(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum int42eq(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum int42ne(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum int42lt(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum int42le(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum int42gt(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum int42ge(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum int4um(PG_FUNCTION_ARGS);
|
2001-06-07 02:09:32 +02:00
|
|
|
extern Datum int4up(PG_FUNCTION_ARGS);
|
2000-06-05 09:29:25 +02:00
|
|
|
extern Datum int4pl(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum int4mi(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum int4mul(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum int4div(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum int4abs(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum int4inc(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum int2um(PG_FUNCTION_ARGS);
|
2001-06-07 02:09:32 +02:00
|
|
|
extern Datum int2up(PG_FUNCTION_ARGS);
|
2000-06-05 09:29:25 +02:00
|
|
|
extern Datum int2pl(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum int2mi(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum int2mul(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum int2div(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum int2abs(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum int24pl(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum int24mi(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum int24mul(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum int24div(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum int42pl(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum int42mi(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum int42mul(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum int42div(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum int4mod(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum int2mod(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum int2larger(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum int2smaller(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum int4larger(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum int4smaller(PG_FUNCTION_ARGS);
|
1996-08-28 03:59:28 +02:00
|
|
|
|
2000-10-24 22:16:48 +02:00
|
|
|
extern Datum int4and(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum int4or(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum int4xor(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum int4not(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum int4shl(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum int4shr(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum int2and(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum int2or(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum int2xor(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum int2not(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum int2shl(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum int2shr(PG_FUNCTION_ARGS);
|
2004-02-03 09:29:57 +01:00
|
|
|
extern Datum generate_series_int4(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum generate_series_step_int4(PG_FUNCTION_ARGS);
|
2012-06-25 00:51:46 +02:00
|
|
|
extern int2vector *buildint2vector(const int16 *int2s, int n);
|
2000-10-24 22:16:48 +02:00
|
|
|
|
1996-08-28 03:59:28 +02:00
|
|
|
/* name.c */
|
2000-08-03 18:35:08 +02:00
|
|
|
extern Datum namein(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum nameout(PG_FUNCTION_ARGS);
|
2003-05-09 23:19:50 +02:00
|
|
|
extern Datum namerecv(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum namesend(PG_FUNCTION_ARGS);
|
2000-08-03 18:35:08 +02:00
|
|
|
extern Datum nameeq(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum namene(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum namelt(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum namele(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum namegt(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum namege(PG_FUNCTION_ARGS);
|
1997-09-08 04:41:22 +02:00
|
|
|
extern int namecpy(Name n1, Name n2);
|
2000-01-22 15:20:56 +01:00
|
|
|
extern int namestrcpy(Name name, const char *str);
|
|
|
|
extern int namestrcmp(Name name, const char *str);
|
2000-09-19 20:18:04 +02:00
|
|
|
extern Datum current_user(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum session_user(PG_FUNCTION_ARGS);
|
2002-04-26 03:24:08 +02:00
|
|
|
extern Datum current_schema(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum current_schemas(PG_FUNCTION_ARGS);
|
1996-08-28 03:59:28 +02:00
|
|
|
|
|
|
|
/* numutils.c */
|
2014-10-31 17:02:40 +01:00
|
|
|
extern int32 pg_atoi(const char *s, int size, int c);
|
2000-08-01 20:29:35 +02:00
|
|
|
extern void pg_itoa(int16 i, char *a);
|
|
|
|
extern void pg_ltoa(int32 l, char *a);
|
2010-11-20 04:13:11 +01:00
|
|
|
extern void pg_lltoa(int64 ll, char *a);
|
2016-02-07 05:11:28 +01:00
|
|
|
extern char *pg_ltostr_zeropad(char *str, int32 value, int32 minwidth);
|
|
|
|
extern char *pg_ltostr(char *str, int32 value);
|
Widen query numbers-of-tuples-processed counters to uint64.
This patch widens SPI_processed, EState's es_processed field, PortalData's
portalPos field, FuncCallContext's call_cntr and max_calls fields,
ExecutorRun's count argument, PortalRunFetch's result, and the max number
of rows in a SPITupleTable to uint64, and deals with (I hope) all the
ensuing fallout. Some of these values were declared uint32 before, and
others "long".
I also removed PortalData's posOverflow field, since that logic seems
pretty useless given that portalPos is now always 64 bits.
The user-visible results are that command tags for SELECT etc will
correctly report tuple counts larger than 4G, as will plpgsql's GET
GET DIAGNOSTICS ... ROW_COUNT command. Queries processing more tuples
than that are still not exactly the norm, but they're becoming more
common.
Most values associated with FETCH/MOVE distances, such as PortalRun's count
argument and the count argument of most SPI functions that have one, remain
declared as "long". It's not clear whether it would be worth promoting
those to int64; but it would definitely be a large dollop of additional
API churn on top of this, and it would only help 32-bit platforms which
seem relatively less likely to see any benefit.
Andreas Scherbaum, reviewed by Christian Ullrich, additional hacking by me
2016-03-12 22:05:10 +01:00
|
|
|
extern uint64 pg_strtouint64(const char *str, char **endptr, int base);
|
1996-08-28 03:59:28 +02:00
|
|
|
|
|
|
|
/*
|
1997-09-07 07:04:48 +02:00
|
|
|
* Per-opclass comparison functions for new btrees. These are
|
2011-12-07 06:18:38 +01:00
|
|
|
* stored in pg_amproc; most are defined in access/nbtree/nbtcompare.c
|
1996-08-28 03:59:28 +02:00
|
|
|
*/
|
2000-06-05 09:29:25 +02:00
|
|
|
extern Datum btboolcmp(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum btint2cmp(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum btint4cmp(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum btint8cmp(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum btfloat4cmp(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum btfloat8cmp(PG_FUNCTION_ARGS);
|
2003-11-12 22:15:59 +01:00
|
|
|
extern Datum btint48cmp(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum btint84cmp(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum btint24cmp(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum btint42cmp(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum btint28cmp(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum btint82cmp(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum btfloat48cmp(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum btfloat84cmp(PG_FUNCTION_ARGS);
|
2000-06-05 09:29:25 +02:00
|
|
|
extern Datum btoidcmp(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum btoidvectorcmp(PG_FUNCTION_ARGS);
|
2000-06-09 03:11:16 +02:00
|
|
|
extern Datum btabstimecmp(PG_FUNCTION_ARGS);
|
2003-08-17 21:58:06 +02:00
|
|
|
extern Datum btreltimecmp(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum bttintervalcmp(PG_FUNCTION_ARGS);
|
2000-06-05 09:29:25 +02:00
|
|
|
extern Datum btcharcmp(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum btnamecmp(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum bttextcmp(PG_FUNCTION_ARGS);
|
2014-08-14 18:09:52 +02:00
|
|
|
extern Datum bttextsortsupport(PG_FUNCTION_ARGS);
|
1996-08-28 03:59:28 +02:00
|
|
|
|
2011-12-07 06:18:38 +01:00
|
|
|
/*
|
2014-05-06 18:12:18 +02:00
|
|
|
* Per-opclass sort support functions for new btrees. Like the
|
2011-12-07 06:18:38 +01:00
|
|
|
* functions above, these are stored in pg_amproc; most are defined in
|
|
|
|
* access/nbtree/nbtcompare.c
|
|
|
|
*/
|
|
|
|
extern Datum btint2sortsupport(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum btint4sortsupport(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum btint8sortsupport(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum btfloat4sortsupport(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum btfloat8sortsupport(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum btoidsortsupport(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum btnamesortsupport(PG_FUNCTION_ARGS);
|
|
|
|
|
1996-08-28 03:59:28 +02:00
|
|
|
/* float.c */
|
2007-07-25 14:22:54 +02:00
|
|
|
extern PGDLLIMPORT int extra_float_digits;
|
2002-11-08 18:37:52 +01:00
|
|
|
|
2004-03-15 04:29:22 +01:00
|
|
|
extern double get_float8_infinity(void);
|
|
|
|
extern float get_float4_infinity(void);
|
|
|
|
extern double get_float8_nan(void);
|
|
|
|
extern float get_float4_nan(void);
|
|
|
|
extern int is_infinite(double val);
|
Improve portability of I/O behavior for the geometric types.
Formerly, the geometric I/O routines such as box_in and point_out relied
directly on strtod() and sprintf() for conversion of the float8 component
values of their data types. However, the behavior of those functions is
pretty platform-dependent, especially for edge-case values such as
infinities and NaNs. This was exposed by commit acdf2a8b372aec1d, which
added test cases involving boxes with infinity endpoints, and immediately
failed on Windows and AIX buildfarm members. We solved these problems
years ago in the main float8in and float8out functions, so let's fix it
by making the geometric types use that code instead of depending directly
on the platform-supplied functions.
To do this, refactor the float8in code so that it can be used to parse
just part of a string, and as a convenience make the guts of float8out
usable without going through DirectFunctionCall.
While at it, get rid of geo_ops.c's fairly shaky assumptions about the
maximum output string length for a double, by having it build results in
StringInfo buffers instead of fixed-length strings.
In passing, convert all the "invalid input syntax for type foo" messages
in this area of the code into "invalid input syntax for type %s" to reduce
the number of distinct translatable strings, per recent discussion.
We would have needed a fair number of the latter anyway for code-sharing
reasons, so we might as well just go whole hog.
Note: this patch is by no means intended to guarantee that the geometric
types uniformly behave sanely for infinity or NaN component values.
But any bugs we have in that line were there all along, they were just
harder to reach in a platform-independent way.
2016-03-30 23:25:03 +02:00
|
|
|
extern double float8in_internal(char *num, char **endptr_p,
|
|
|
|
const char *type_name, const char *orig_string);
|
|
|
|
extern char *float8out_internal(double num);
|
2016-07-15 00:45:59 +02:00
|
|
|
extern int float4_cmp_internal(float4 a, float4 b);
|
|
|
|
extern int float8_cmp_internal(float8 a, float8 b);
|
2004-03-15 04:29:22 +01:00
|
|
|
|
2000-08-01 20:29:35 +02:00
|
|
|
extern Datum float4in(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum float4out(PG_FUNCTION_ARGS);
|
2003-05-09 23:19:50 +02:00
|
|
|
extern Datum float4recv(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum float4send(PG_FUNCTION_ARGS);
|
2000-08-01 20:29:35 +02:00
|
|
|
extern Datum float8in(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum float8out(PG_FUNCTION_ARGS);
|
2003-05-09 23:19:50 +02:00
|
|
|
extern Datum float8recv(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum float8send(PG_FUNCTION_ARGS);
|
2000-08-01 20:29:35 +02:00
|
|
|
extern Datum float4abs(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum float4um(PG_FUNCTION_ARGS);
|
2001-06-07 02:09:32 +02:00
|
|
|
extern Datum float4up(PG_FUNCTION_ARGS);
|
2000-08-01 20:29:35 +02:00
|
|
|
extern Datum float4larger(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum float4smaller(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum float8abs(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum float8um(PG_FUNCTION_ARGS);
|
2001-06-07 02:09:32 +02:00
|
|
|
extern Datum float8up(PG_FUNCTION_ARGS);
|
2000-08-01 20:29:35 +02:00
|
|
|
extern Datum float8larger(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum float8smaller(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum float4pl(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum float4mi(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum float4mul(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum float4div(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum float8pl(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum float8mi(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum float8mul(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum float8div(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum float4eq(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum float4ne(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum float4lt(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum float4le(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum float4gt(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum float4ge(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum float8eq(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum float8ne(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum float8lt(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum float8le(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum float8gt(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum float8ge(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum ftod(PG_FUNCTION_ARGS);
|
2000-06-13 09:35:40 +02:00
|
|
|
extern Datum i4tod(PG_FUNCTION_ARGS);
|
2000-06-05 09:29:25 +02:00
|
|
|
extern Datum i2tod(PG_FUNCTION_ARGS);
|
2000-08-01 20:29:35 +02:00
|
|
|
extern Datum dtof(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum dtoi4(PG_FUNCTION_ARGS);
|
2000-06-05 09:29:25 +02:00
|
|
|
extern Datum dtoi2(PG_FUNCTION_ARGS);
|
2000-06-13 09:35:40 +02:00
|
|
|
extern Datum i4tof(PG_FUNCTION_ARGS);
|
2000-06-05 09:29:25 +02:00
|
|
|
extern Datum i2tof(PG_FUNCTION_ARGS);
|
2000-08-01 20:29:35 +02:00
|
|
|
extern Datum ftoi4(PG_FUNCTION_ARGS);
|
2000-06-05 09:29:25 +02:00
|
|
|
extern Datum ftoi2(PG_FUNCTION_ARGS);
|
2000-08-01 20:29:35 +02:00
|
|
|
extern Datum dround(PG_FUNCTION_ARGS);
|
2002-10-19 04:08:19 +02:00
|
|
|
extern Datum dceil(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum dfloor(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum dsign(PG_FUNCTION_ARGS);
|
2000-08-01 20:29:35 +02:00
|
|
|
extern Datum dtrunc(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum dsqrt(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum dcbrt(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum dpow(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum dexp(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum dlog1(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum dlog10(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum dacos(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum dasin(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum datan(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum datan2(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum dcos(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum dcot(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum dsin(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum dtan(PG_FUNCTION_ARGS);
|
2016-01-22 21:46:22 +01:00
|
|
|
extern Datum dacosd(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum dasind(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum datand(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum datan2d(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum dcosd(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum dcotd(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum dsind(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum dtand(PG_FUNCTION_ARGS);
|
2000-08-01 20:29:35 +02:00
|
|
|
extern Datum degrees(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum dpi(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum radians(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum drandom(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum setseed(PG_FUNCTION_ARGS);
|
2016-04-08 19:44:50 +02:00
|
|
|
extern Datum float8_combine(PG_FUNCTION_ARGS);
|
2000-07-17 05:05:41 +02:00
|
|
|
extern Datum float8_accum(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum float4_accum(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum float8_avg(PG_FUNCTION_ARGS);
|
2006-03-10 21:15:28 +01:00
|
|
|
extern Datum float8_var_pop(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum float8_var_samp(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum float8_stddev_pop(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum float8_stddev_samp(PG_FUNCTION_ARGS);
|
2006-07-28 20:33:04 +02:00
|
|
|
extern Datum float8_regr_accum(PG_FUNCTION_ARGS);
|
2016-04-08 19:44:50 +02:00
|
|
|
extern Datum float8_regr_combine(PG_FUNCTION_ARGS);
|
2006-07-28 20:33:04 +02:00
|
|
|
extern Datum float8_regr_sxx(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum float8_regr_syy(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum float8_regr_sxy(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum float8_regr_avgx(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum float8_regr_avgy(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum float8_covar_pop(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum float8_covar_samp(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum float8_corr(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum float8_regr_r2(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum float8_regr_slope(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum float8_regr_intercept(PG_FUNCTION_ARGS);
|
2000-08-01 20:29:35 +02:00
|
|
|
extern Datum float48pl(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum float48mi(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum float48mul(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum float48div(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum float84pl(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum float84mi(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum float84mul(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum float84div(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum float48eq(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum float48ne(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum float48lt(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum float48le(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum float48gt(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum float48ge(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum float84eq(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum float84ne(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum float84lt(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum float84le(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum float84gt(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum float84ge(PG_FUNCTION_ARGS);
|
2007-01-16 22:41:14 +01:00
|
|
|
extern Datum width_bucket_float8(PG_FUNCTION_ARGS);
|
1996-08-28 03:59:28 +02:00
|
|
|
|
2005-07-29 16:47:04 +02:00
|
|
|
/* dbsize.c */
|
|
|
|
extern Datum pg_tablespace_size_oid(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum pg_tablespace_size_name(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum pg_database_size_oid(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum pg_database_size_name(PG_FUNCTION_ARGS);
|
2008-10-03 09:33:10 +02:00
|
|
|
extern Datum pg_relation_size(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum pg_total_relation_size(PG_FUNCTION_ARGS);
|
2005-07-29 16:47:04 +02:00
|
|
|
extern Datum pg_size_pretty(PG_FUNCTION_ARGS);
|
2012-04-14 14:04:11 +02:00
|
|
|
extern Datum pg_size_pretty_numeric(PG_FUNCTION_ARGS);
|
2016-02-20 10:57:27 +01:00
|
|
|
extern Datum pg_size_bytes(PG_FUNCTION_ARGS);
|
2010-01-19 06:50:18 +01:00
|
|
|
extern Datum pg_table_size(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum pg_indexes_size(PG_FUNCTION_ARGS);
|
2010-02-07 21:48:13 +01:00
|
|
|
extern Datum pg_relation_filenode(PG_FUNCTION_ARGS);
|
2013-07-22 16:34:34 +02:00
|
|
|
extern Datum pg_filenode_relation(PG_FUNCTION_ARGS);
|
2010-02-07 21:48:13 +01:00
|
|
|
extern Datum pg_relation_filepath(PG_FUNCTION_ARGS);
|
2005-07-29 16:47:04 +02:00
|
|
|
|
2005-08-12 05:25:13 +02:00
|
|
|
/* genfile.c */
|
|
|
|
extern Datum pg_stat_file(PG_FUNCTION_ARGS);
|
2015-06-28 20:35:46 +02:00
|
|
|
extern Datum pg_stat_file_1arg(PG_FUNCTION_ARGS);
|
2005-08-12 05:25:13 +02:00
|
|
|
extern Datum pg_read_file(PG_FUNCTION_ARGS);
|
2015-06-28 20:35:46 +02:00
|
|
|
extern Datum pg_read_file_off_len(PG_FUNCTION_ARGS);
|
2010-12-15 22:56:28 +01:00
|
|
|
extern Datum pg_read_file_all(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum pg_read_binary_file(PG_FUNCTION_ARGS);
|
2015-06-28 20:35:46 +02:00
|
|
|
extern Datum pg_read_binary_file_off_len(PG_FUNCTION_ARGS);
|
2010-12-15 22:56:28 +01:00
|
|
|
extern Datum pg_read_binary_file_all(PG_FUNCTION_ARGS);
|
2005-08-12 05:25:13 +02:00
|
|
|
extern Datum pg_ls_dir(PG_FUNCTION_ARGS);
|
2015-06-28 20:35:46 +02:00
|
|
|
extern Datum pg_ls_dir_1arg(PG_FUNCTION_ARGS);
|
2005-08-12 05:25:13 +02:00
|
|
|
|
1996-08-28 03:59:28 +02:00
|
|
|
/* misc.c */
|
2016-02-05 05:03:10 +01:00
|
|
|
extern Datum pg_num_nulls(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum pg_num_nonnulls(PG_FUNCTION_ARGS);
|
2002-08-20 06:46:00 +02:00
|
|
|
extern Datum current_database(PG_FUNCTION_ARGS);
|
2008-04-04 18:57:21 +02:00
|
|
|
extern Datum current_query(PG_FUNCTION_ARGS);
|
2004-06-02 23:29:29 +02:00
|
|
|
extern Datum pg_cancel_backend(PG_FUNCTION_ARGS);
|
2008-04-17 22:56:41 +02:00
|
|
|
extern Datum pg_terminate_backend(PG_FUNCTION_ARGS);
|
2005-08-12 05:25:13 +02:00
|
|
|
extern Datum pg_reload_conf(PG_FUNCTION_ARGS);
|
2004-07-02 20:59:25 +02:00
|
|
|
extern Datum pg_tablespace_databases(PG_FUNCTION_ARGS);
|
2011-12-07 10:35:00 +01:00
|
|
|
extern Datum pg_tablespace_location(PG_FUNCTION_ARGS);
|
2005-08-12 05:25:13 +02:00
|
|
|
extern Datum pg_rotate_logfile(PG_FUNCTION_ARGS);
|
2006-01-11 21:12:43 +01:00
|
|
|
extern Datum pg_sleep(PG_FUNCTION_ARGS);
|
2008-07-03 22:58:47 +02:00
|
|
|
extern Datum pg_get_keywords(PG_FUNCTION_ARGS);
|
2008-11-03 18:51:13 +01:00
|
|
|
extern Datum pg_typeof(PG_FUNCTION_ARGS);
|
2012-03-02 20:12:16 +01:00
|
|
|
extern Datum pg_collation_for(PG_FUNCTION_ARGS);
|
2013-06-12 23:52:54 +02:00
|
|
|
extern Datum pg_relation_is_updatable(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum pg_column_is_updatable(PG_FUNCTION_ARGS);
|
2016-03-18 16:16:14 +01:00
|
|
|
extern Datum parse_ident(PG_FUNCTION_ARGS);
|
1997-04-27 21:24:16 +02:00
|
|
|
|
1996-08-28 03:59:28 +02:00
|
|
|
/* oid.c */
|
2000-06-05 09:29:25 +02:00
|
|
|
extern Datum oidin(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum oidout(PG_FUNCTION_ARGS);
|
2003-05-09 17:44:42 +02:00
|
|
|
extern Datum oidrecv(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum oidsend(PG_FUNCTION_ARGS);
|
2000-06-05 09:29:25 +02:00
|
|
|
extern Datum oideq(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum oidne(PG_FUNCTION_ARGS);
|
2000-11-21 04:23:21 +01:00
|
|
|
extern Datum oidlt(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum oidle(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum oidge(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum oidgt(PG_FUNCTION_ARGS);
|
2001-08-15 00:21:59 +02:00
|
|
|
extern Datum oidlarger(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum oidsmaller(PG_FUNCTION_ARGS);
|
2000-11-21 04:23:21 +01:00
|
|
|
extern Datum oidvectorin(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum oidvectorout(PG_FUNCTION_ARGS);
|
2003-05-09 17:44:42 +02:00
|
|
|
extern Datum oidvectorrecv(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum oidvectorsend(PG_FUNCTION_ARGS);
|
2000-06-05 09:29:25 +02:00
|
|
|
extern Datum oidvectoreq(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum oidvectorne(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum oidvectorlt(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum oidvectorle(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum oidvectorge(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum oidvectorgt(PG_FUNCTION_ARGS);
|
2005-03-29 02:17:27 +02:00
|
|
|
extern oidvector *buildoidvector(const Oid *oids, int n);
|
2010-07-06 21:19:02 +02:00
|
|
|
extern Oid oidparse(Node *node);
|
1996-08-28 03:59:28 +02:00
|
|
|
|
Support ordered-set (WITHIN GROUP) aggregates.
This patch introduces generic support for ordered-set and hypothetical-set
aggregate functions, as well as implementations of the instances defined in
SQL:2008 (percentile_cont(), percentile_disc(), rank(), dense_rank(),
percent_rank(), cume_dist()). We also added mode() though it is not in the
spec, as well as versions of percentile_cont() and percentile_disc() that
can compute multiple percentile values in one pass over the data.
Unlike the original submission, this patch puts full control of the sorting
process in the hands of the aggregate's support functions. To allow the
support functions to find out how they're supposed to sort, a new API
function AggGetAggref() is added to nodeAgg.c. This allows retrieval of
the aggregate call's Aggref node, which may have other uses beyond the
immediate need. There is also support for ordered-set aggregates to
install cleanup callback functions, so that they can be sure that
infrastructure such as tuplesort objects gets cleaned up.
In passing, make some fixes in the recently-added support for variadic
aggregates, and make some editorial adjustments in the recent FILTER
additions for aggregates. Also, simplify use of IsBinaryCoercible() by
allowing it to succeed whenever the target type is ANY or ANYELEMENT.
It was inconsistent that it dealt with other polymorphic target types
but not these.
Atri Sharma and Andrew Gierth; reviewed by Pavel Stehule and Vik Fearing,
and rather heavily editorialized upon by Tom Lane
2013-12-23 22:11:35 +01:00
|
|
|
/* orderedsetaggs.c */
|
|
|
|
extern Datum ordered_set_transition(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum ordered_set_transition_multi(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum percentile_disc_final(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum percentile_cont_float8_final(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum percentile_cont_interval_final(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum percentile_disc_multi_final(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum percentile_cont_float8_multi_final(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum percentile_cont_interval_multi_final(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum mode_final(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum hypothetical_rank_final(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum hypothetical_percent_rank_final(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum hypothetical_cume_dist_final(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum hypothetical_dense_rank_final(PG_FUNCTION_ARGS);
|
|
|
|
|
2002-08-22 02:01:51 +02:00
|
|
|
/* pseudotypes.c */
|
|
|
|
extern Datum cstring_in(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum cstring_out(PG_FUNCTION_ARGS);
|
2003-05-13 20:03:08 +02:00
|
|
|
extern Datum cstring_recv(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum cstring_send(PG_FUNCTION_ARGS);
|
2002-08-22 02:01:51 +02:00
|
|
|
extern Datum any_in(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum any_out(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum anyarray_in(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum anyarray_out(PG_FUNCTION_ARGS);
|
2003-05-13 20:03:08 +02:00
|
|
|
extern Datum anyarray_recv(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum anyarray_send(PG_FUNCTION_ARGS);
|
2007-06-07 01:00:50 +02:00
|
|
|
extern Datum anynonarray_in(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum anynonarray_out(PG_FUNCTION_ARGS);
|
2007-04-02 05:49:42 +02:00
|
|
|
extern Datum anyenum_in(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum anyenum_out(PG_FUNCTION_ARGS);
|
2011-11-21 05:50:27 +01:00
|
|
|
extern Datum anyrange_in(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum anyrange_out(PG_FUNCTION_ARGS);
|
2002-08-22 02:01:51 +02:00
|
|
|
extern Datum void_in(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum void_out(PG_FUNCTION_ARGS);
|
2011-02-22 19:08:22 +01:00
|
|
|
extern Datum void_recv(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum void_send(PG_FUNCTION_ARGS);
|
2002-08-22 02:01:51 +02:00
|
|
|
extern Datum trigger_in(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum trigger_out(PG_FUNCTION_ARGS);
|
2012-07-18 16:16:16 +02:00
|
|
|
extern Datum event_trigger_in(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum event_trigger_out(PG_FUNCTION_ARGS);
|
2002-08-22 02:01:51 +02:00
|
|
|
extern Datum language_handler_in(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum language_handler_out(PG_FUNCTION_ARGS);
|
2011-02-19 06:06:18 +01:00
|
|
|
extern Datum fdw_handler_in(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum fdw_handler_out(PG_FUNCTION_ARGS);
|
Restructure index access method API to hide most of it at the C level.
This patch reduces pg_am to just two columns, a name and a handler
function. All the data formerly obtained from pg_am is now provided
in a C struct returned by the handler function. This is similar to
the designs we've adopted for FDWs and tablesample methods. There
are multiple advantages. For one, the index AM's support functions
are now simple C functions, making them faster to call and much less
error-prone, since the C compiler can now check function signatures.
For another, this will make it far more practical to define index access
methods in installable extensions.
A disadvantage is that SQL-level code can no longer see attributes
of index AMs; in particular, some of the crosschecks in the opr_sanity
regression test are no longer possible from SQL. We've addressed that
by adding a facility for the index AM to perform such checks instead.
(Much more could be done in that line, but for now we're content if the
amvalidate functions more or less replace what opr_sanity used to do.)
We might also want to expose some sort of reporting functionality, but
this patch doesn't do that.
Alexander Korotkov, reviewed by Petr Jelínek, and rather heavily
editorialized on by me.
2016-01-18 01:36:59 +01:00
|
|
|
extern Datum index_am_handler_in(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum index_am_handler_out(PG_FUNCTION_ARGS);
|
Redesign tablesample method API, and do extensive code review.
The original implementation of TABLESAMPLE modeled the tablesample method
API on index access methods, which wasn't a good choice because, without
specialized DDL commands, there's no way to build an extension that can
implement a TSM. (Raw inserts into system catalogs are not an acceptable
thing to do, because we can't undo them during DROP EXTENSION, nor will
pg_upgrade behave sanely.) Instead adopt an API more like procedural
language handlers or foreign data wrappers, wherein the only SQL-level
support object needed is a single handler function identified by having
a special return type. This lets us get rid of the supporting catalog
altogether, so that no custom DDL support is needed for the feature.
Adjust the API so that it can support non-constant tablesample arguments
(the original coding assumed we could evaluate the argument expressions at
ExecInitSampleScan time, which is undesirable even if it weren't outright
unsafe), and discourage sampling methods from looking at invisible tuples.
Make sure that the BERNOULLI and SYSTEM methods are genuinely repeatable
within and across queries, as required by the SQL standard, and deal more
honestly with methods that can't support that requirement.
Make a full code-review pass over the tablesample additions, and fix
assorted bugs, omissions, infelicities, and cosmetic issues (such as
failure to put the added code stanzas in a consistent ordering).
Improve EXPLAIN's output of tablesample plans, too.
Back-patch to 9.5 so that we don't have to support the original API
in production.
2015-07-25 20:39:00 +02:00
|
|
|
extern Datum tsm_handler_in(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum tsm_handler_out(PG_FUNCTION_ARGS);
|
2002-08-22 02:01:51 +02:00
|
|
|
extern Datum internal_in(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum internal_out(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum opaque_in(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum opaque_out(PG_FUNCTION_ARGS);
|
2003-04-09 01:20:04 +02:00
|
|
|
extern Datum anyelement_in(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum anyelement_out(PG_FUNCTION_ARGS);
|
2006-02-28 23:37:27 +01:00
|
|
|
extern Datum shell_in(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum shell_out(PG_FUNCTION_ARGS);
|
2010-09-03 03:34:55 +02:00
|
|
|
extern Datum pg_node_tree_in(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum pg_node_tree_out(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum pg_node_tree_recv(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum pg_node_tree_send(PG_FUNCTION_ARGS);
|
Allow on-the-fly capture of DDL event details
This feature lets user code inspect and take action on DDL events.
Whenever a ddl_command_end event trigger is installed, DDL actions
executed are saved to a list which can be inspected during execution of
a function attached to ddl_command_end.
The set-returning function pg_event_trigger_ddl_commands can be used to
list actions so captured; it returns data about the type of command
executed, as well as the affected object. This is sufficient for many
uses of this feature. For the cases where it is not, we also provide a
"command" column of a new pseudo-type pg_ddl_command, which is a
pointer to a C structure that can be accessed by C code. The struct
contains all the info necessary to completely inspect and even
reconstruct the executed command.
There is no actual deparse code here; that's expected to come later.
What we have is enough infrastructure that the deparsing can be done in
an external extension. The intention is that we will add some deparsing
code in a later release, as an in-core extension.
A new test module is included. It's probably insufficient as is, but it
should be sufficient as a starting point for a more complete and
future-proof approach.
Authors: Álvaro Herrera, with some help from Andres Freund, Ian Barwick,
Abhijit Menon-Sen.
Reviews by Andres Freund, Robert Haas, Amit Kapila, Michael Paquier,
Craig Ringer, David Steele.
Additional input from Chris Browne, Dimitri Fontaine, Stephen Frost,
Petr Jelínek, Tom Lane, Jim Nasby, Steven Singer, Pavel Stěhule.
Based on original work by Dimitri Fontaine, though I didn't use his
code.
Discussion:
https://www.postgresql.org/message-id/m2txrsdzxa.fsf@2ndQuadrant.fr
https://www.postgresql.org/message-id/20131108153322.GU5809@eldon.alvh.no-ip.org
https://www.postgresql.org/message-id/20150215044814.GL3391@alvh.no-ip.org
2015-05-12 00:14:31 +02:00
|
|
|
extern Datum pg_ddl_command_in(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum pg_ddl_command_out(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum pg_ddl_command_recv(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum pg_ddl_command_send(PG_FUNCTION_ARGS);
|
2002-08-22 02:01:51 +02:00
|
|
|
|
1996-08-28 03:59:28 +02:00
|
|
|
/* regexp.c */
|
2000-07-06 07:48:31 +02:00
|
|
|
extern Datum nameregexeq(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum nameregexne(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum textregexeq(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum textregexne(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum nameicregexeq(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum nameicregexne(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum texticregexeq(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum texticregexne(PG_FUNCTION_ARGS);
|
2002-06-11 17:44:38 +02:00
|
|
|
extern Datum textregexsubstr(PG_FUNCTION_ARGS);
|
2005-07-10 06:54:33 +02:00
|
|
|
extern Datum textregexreplace_noopt(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum textregexreplace(PG_FUNCTION_ARGS);
|
2002-09-22 19:27:25 +02:00
|
|
|
extern Datum similar_escape(PG_FUNCTION_ARGS);
|
2016-08-18 00:32:56 +02:00
|
|
|
extern Datum regexp_match(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum regexp_match_no_flags(PG_FUNCTION_ARGS);
|
2007-03-20 06:45:00 +01:00
|
|
|
extern Datum regexp_matches(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum regexp_matches_no_flags(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum regexp_split_to_table(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum regexp_split_to_table_no_flags(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum regexp_split_to_array(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum regexp_split_to_array_no_flags(PG_FUNCTION_ARGS);
|
2012-07-10 20:54:37 +02:00
|
|
|
extern char *regexp_fixed_prefix(text *text_re, bool case_insensitive,
|
2013-05-29 22:58:43 +02:00
|
|
|
Oid collation, bool *exact);
|
1996-08-28 03:59:28 +02:00
|
|
|
|
|
|
|
/* regproc.c */
|
2000-06-05 09:29:25 +02:00
|
|
|
extern Datum regprocin(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum regprocout(PG_FUNCTION_ARGS);
|
2014-04-08 16:27:56 +02:00
|
|
|
extern Datum to_regproc(PG_FUNCTION_ARGS);
|
2014-04-16 18:21:43 +02:00
|
|
|
extern Datum to_regprocedure(PG_FUNCTION_ARGS);
|
2003-05-13 01:08:52 +02:00
|
|
|
extern Datum regprocrecv(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum regprocsend(PG_FUNCTION_ARGS);
|
2002-04-25 04:56:56 +02:00
|
|
|
extern Datum regprocedurein(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum regprocedureout(PG_FUNCTION_ARGS);
|
2003-05-13 01:08:52 +02:00
|
|
|
extern Datum regprocedurerecv(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum regproceduresend(PG_FUNCTION_ARGS);
|
2002-04-25 04:56:56 +02:00
|
|
|
extern Datum regoperin(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum regoperout(PG_FUNCTION_ARGS);
|
2003-05-13 01:08:52 +02:00
|
|
|
extern Datum regoperrecv(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum regopersend(PG_FUNCTION_ARGS);
|
2014-04-08 16:27:56 +02:00
|
|
|
extern Datum to_regoper(PG_FUNCTION_ARGS);
|
2014-04-16 18:21:43 +02:00
|
|
|
extern Datum to_regoperator(PG_FUNCTION_ARGS);
|
2002-04-25 04:56:56 +02:00
|
|
|
extern Datum regoperatorin(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum regoperatorout(PG_FUNCTION_ARGS);
|
2003-05-13 01:08:52 +02:00
|
|
|
extern Datum regoperatorrecv(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum regoperatorsend(PG_FUNCTION_ARGS);
|
2002-04-25 04:56:56 +02:00
|
|
|
extern Datum regclassin(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum regclassout(PG_FUNCTION_ARGS);
|
2003-05-13 01:08:52 +02:00
|
|
|
extern Datum regclassrecv(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum regclasssend(PG_FUNCTION_ARGS);
|
2014-04-08 16:27:56 +02:00
|
|
|
extern Datum to_regclass(PG_FUNCTION_ARGS);
|
2002-04-25 04:56:56 +02:00
|
|
|
extern Datum regtypein(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum regtypeout(PG_FUNCTION_ARGS);
|
2003-05-13 01:08:52 +02:00
|
|
|
extern Datum regtyperecv(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum regtypesend(PG_FUNCTION_ARGS);
|
2014-04-08 16:27:56 +02:00
|
|
|
extern Datum to_regtype(PG_FUNCTION_ARGS);
|
2015-05-09 19:06:49 +02:00
|
|
|
extern Datum regrolein(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum regroleout(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum regrolerecv(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum regrolesend(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum to_regrole(PG_FUNCTION_ARGS);
|
2015-05-09 19:36:52 +02:00
|
|
|
extern Datum regnamespacein(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum regnamespaceout(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum regnamespacerecv(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum regnamespacesend(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum to_regnamespace(PG_FUNCTION_ARGS);
|
2007-08-21 03:11:32 +02:00
|
|
|
extern Datum regconfigin(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum regconfigout(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum regconfigrecv(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum regconfigsend(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum regdictionaryin(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum regdictionaryout(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum regdictionaryrecv(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum regdictionarysend(PG_FUNCTION_ARGS);
|
2005-10-03 01:50:16 +02:00
|
|
|
extern Datum text_regclass(PG_FUNCTION_ARGS);
|
2007-06-26 18:48:09 +02:00
|
|
|
extern List *stringToQualifiedNameList(const char *string);
|
2002-07-30 00:14:11 +02:00
|
|
|
extern char *format_procedure(Oid procedure_oid);
|
2013-03-20 22:19:19 +01:00
|
|
|
extern char *format_procedure_qualified(Oid procedure_oid);
|
2014-12-30 19:41:50 +01:00
|
|
|
extern void format_procedure_parts(Oid operator_oid, List **objnames,
|
2015-05-24 03:35:49 +02:00
|
|
|
List **objargs);
|
2002-07-30 00:14:11 +02:00
|
|
|
extern char *format_operator(Oid operator_oid);
|
2013-03-20 22:19:19 +01:00
|
|
|
extern char *format_operator_qualified(Oid operator_oid);
|
2014-12-30 19:41:50 +01:00
|
|
|
extern void format_operator_parts(Oid operator_oid, List **objnames,
|
|
|
|
List **objargs);
|
1996-08-28 03:59:28 +02:00
|
|
|
|
2004-04-01 23:28:47 +02:00
|
|
|
/* rowtypes.c */
|
|
|
|
extern Datum record_in(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum record_out(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum record_recv(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum record_send(PG_FUNCTION_ARGS);
|
2008-10-13 18:25:20 +02:00
|
|
|
extern Datum record_eq(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum record_ne(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum record_lt(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum record_gt(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum record_le(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum record_ge(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum btrecordcmp(PG_FUNCTION_ARGS);
|
2013-10-09 21:26:09 +02:00
|
|
|
extern Datum record_image_eq(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum record_image_ne(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum record_image_lt(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum record_image_gt(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum record_image_le(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum record_image_ge(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum btrecordimagecmp(PG_FUNCTION_ARGS);
|
2004-04-01 23:28:47 +02:00
|
|
|
|
1999-10-04 01:55:40 +02:00
|
|
|
/* ruleutils.c */
|
2010-07-22 03:22:35 +02:00
|
|
|
extern bool quote_all_identifiers;
|
2000-07-06 07:48:31 +02:00
|
|
|
extern Datum pg_get_ruledef(PG_FUNCTION_ARGS);
|
2003-07-31 00:56:24 +02:00
|
|
|
extern Datum pg_get_ruledef_ext(PG_FUNCTION_ARGS);
|
2000-07-06 07:48:31 +02:00
|
|
|
extern Datum pg_get_viewdef(PG_FUNCTION_ARGS);
|
2003-07-31 00:56:24 +02:00
|
|
|
extern Datum pg_get_viewdef_ext(PG_FUNCTION_ARGS);
|
2012-02-19 17:43:46 +01:00
|
|
|
extern Datum pg_get_viewdef_wrap(PG_FUNCTION_ARGS);
|
2002-04-18 22:01:11 +02:00
|
|
|
extern Datum pg_get_viewdef_name(PG_FUNCTION_ARGS);
|
2003-07-31 00:56:24 +02:00
|
|
|
extern Datum pg_get_viewdef_name_ext(PG_FUNCTION_ARGS);
|
2000-06-09 03:11:16 +02:00
|
|
|
extern Datum pg_get_indexdef(PG_FUNCTION_ARGS);
|
Implement table partitioning.
Table partitioning is like table inheritance and reuses much of the
existing infrastructure, but there are some important differences.
The parent is called a partitioned table and is always empty; it may
not have indexes or non-inherited constraints, since those make no
sense for a relation with no data of its own. The children are called
partitions and contain all of the actual data. Each partition has an
implicit partitioning constraint. Multiple inheritance is not
allowed, and partitioning and inheritance can't be mixed. Partitions
can't have extra columns and may not allow nulls unless the parent
does. Tuples inserted into the parent are automatically routed to the
correct partition, so tuple-routing ON INSERT triggers are not needed.
Tuple routing isn't yet supported for partitions which are foreign
tables, and it doesn't handle updates that cross partition boundaries.
Currently, tables can be range-partitioned or list-partitioned. List
partitioning is limited to a single column, but range partitioning can
involve multiple columns. A partitioning "column" can be an
expression.
Because table partitioning is less general than table inheritance, it
is hoped that it will be easier to reason about properties of
partitions, and therefore that this will serve as a better foundation
for a variety of possible optimizations, including query planner
optimizations. The tuple routing based which this patch does based on
the implicit partitioning constraints is an example of this, but it
seems likely that many other useful optimizations are also possible.
Amit Langote, reviewed and tested by Robert Haas, Ashutosh Bapat,
Amit Kapila, Rajkumar Raghuwanshi, Corey Huinker, Jaime Casanova,
Rushabh Lathia, Erik Rijkers, among others. Minor revisions by me.
2016-12-07 19:17:43 +01:00
|
|
|
extern Datum pg_get_partkeydef(PG_FUNCTION_ARGS);
|
2003-07-31 00:56:24 +02:00
|
|
|
extern Datum pg_get_indexdef_ext(PG_FUNCTION_ARGS);
|
2003-03-20 19:58:02 +01:00
|
|
|
extern Datum pg_get_triggerdef(PG_FUNCTION_ARGS);
|
2009-10-09 23:02:56 +02:00
|
|
|
extern Datum pg_get_triggerdef_ext(PG_FUNCTION_ARGS);
|
2002-08-17 01:01:21 +02:00
|
|
|
extern Datum pg_get_constraintdef(PG_FUNCTION_ARGS);
|
2003-07-31 00:56:24 +02:00
|
|
|
extern Datum pg_get_constraintdef_ext(PG_FUNCTION_ARGS);
|
2001-07-16 07:07:00 +02:00
|
|
|
extern Datum pg_get_expr(PG_FUNCTION_ARGS);
|
2003-07-31 00:56:24 +02:00
|
|
|
extern Datum pg_get_expr_ext(PG_FUNCTION_ARGS);
|
2004-06-25 19:20:29 +02:00
|
|
|
extern Datum pg_get_userbyid(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum pg_get_serial_sequence(PG_FUNCTION_ARGS);
|
2008-09-06 02:01:25 +02:00
|
|
|
extern Datum pg_get_functiondef(PG_FUNCTION_ARGS);
|
2008-07-18 05:32:53 +02:00
|
|
|
extern Datum pg_get_function_arguments(PG_FUNCTION_ARGS);
|
2008-12-04 18:51:28 +01:00
|
|
|
extern Datum pg_get_function_identity_arguments(PG_FUNCTION_ARGS);
|
2008-07-18 05:32:53 +02:00
|
|
|
extern Datum pg_get_function_result(PG_FUNCTION_ARGS);
|
2013-11-27 05:18:58 +01:00
|
|
|
extern Datum pg_get_function_arg_default(PG_FUNCTION_ARGS);
|
2002-04-25 04:56:56 +02:00
|
|
|
extern const char *quote_identifier(const char *ident);
|
2009-07-16 08:33:46 +02:00
|
|
|
extern char *quote_qualified_identifier(const char *qualifier,
|
2002-09-04 22:31:48 +02:00
|
|
|
const char *ident);
|
2011-02-08 22:04:18 +01:00
|
|
|
|
1999-10-04 01:55:40 +02:00
|
|
|
|
1996-08-28 03:59:28 +02:00
|
|
|
/* tid.c */
|
2000-08-03 18:35:08 +02:00
|
|
|
extern Datum tidin(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum tidout(PG_FUNCTION_ARGS);
|
2003-05-13 01:08:52 +02:00
|
|
|
extern Datum tidrecv(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum tidsend(PG_FUNCTION_ARGS);
|
2000-08-03 18:35:08 +02:00
|
|
|
extern Datum tideq(PG_FUNCTION_ARGS);
|
2006-02-26 19:36:23 +01:00
|
|
|
extern Datum tidne(PG_FUNCTION_ARGS);
|
2006-07-21 22:51:33 +02:00
|
|
|
extern Datum tidlt(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum tidle(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum tidgt(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum tidge(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum bttidcmp(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum tidlarger(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum tidsmaller(PG_FUNCTION_ARGS);
|
2000-06-09 03:11:16 +02:00
|
|
|
extern Datum currtid_byreloid(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum currtid_byrelname(PG_FUNCTION_ARGS);
|
1997-03-12 22:28:14 +01:00
|
|
|
|
1996-11-10 04:06:38 +01:00
|
|
|
/* varchar.c */
|
2000-06-13 09:35:40 +02:00
|
|
|
extern Datum bpcharin(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum bpcharout(PG_FUNCTION_ARGS);
|
2003-05-13 01:08:52 +02:00
|
|
|
extern Datum bpcharrecv(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum bpcharsend(PG_FUNCTION_ARGS);
|
2006-12-30 22:21:56 +01:00
|
|
|
extern Datum bpchartypmodin(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum bpchartypmodout(PG_FUNCTION_ARGS);
|
2000-06-13 09:35:40 +02:00
|
|
|
extern Datum bpchar(PG_FUNCTION_ARGS);
|
2000-06-05 09:29:25 +02:00
|
|
|
extern Datum char_bpchar(PG_FUNCTION_ARGS);
|
2000-07-29 05:26:51 +02:00
|
|
|
extern Datum name_bpchar(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum bpchar_name(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum bpchareq(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum bpcharne(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum bpcharlt(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum bpcharle(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum bpchargt(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum bpcharge(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum bpcharcmp(PG_FUNCTION_ARGS);
|
2016-02-03 20:17:35 +01:00
|
|
|
extern Datum bpchar_sortsupport(PG_FUNCTION_ARGS);
|
2005-04-12 06:26:34 +02:00
|
|
|
extern Datum bpchar_larger(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum bpchar_smaller(PG_FUNCTION_ARGS);
|
2016-02-03 20:17:35 +01:00
|
|
|
extern int bpchartruelen(char *s, int len);
|
2000-07-29 05:26:51 +02:00
|
|
|
extern Datum bpcharlen(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum bpcharoctetlen(PG_FUNCTION_ARGS);
|
2000-06-19 05:55:01 +02:00
|
|
|
extern Datum hashbpchar(PG_FUNCTION_ARGS);
|
2008-05-27 02:13:09 +02:00
|
|
|
extern Datum bpchar_pattern_lt(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum bpchar_pattern_le(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum bpchar_pattern_gt(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum bpchar_pattern_ge(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum btbpchar_pattern_cmp(PG_FUNCTION_ARGS);
|
2016-02-03 20:17:35 +01:00
|
|
|
extern Datum btbpchar_pattern_sortsupport(PG_FUNCTION_ARGS);
|
1997-12-16 16:55:17 +01:00
|
|
|
|
2000-06-13 09:35:40 +02:00
|
|
|
extern Datum varcharin(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum varcharout(PG_FUNCTION_ARGS);
|
2003-05-13 01:08:52 +02:00
|
|
|
extern Datum varcharrecv(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum varcharsend(PG_FUNCTION_ARGS);
|
2006-12-30 22:21:56 +01:00
|
|
|
extern Datum varchartypmodin(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum varchartypmodout(PG_FUNCTION_ARGS);
|
2011-06-22 04:15:24 +02:00
|
|
|
extern Datum varchar_transform(PG_FUNCTION_ARGS);
|
2000-06-13 09:35:40 +02:00
|
|
|
extern Datum varchar(PG_FUNCTION_ARGS);
|
1996-08-28 03:59:28 +02:00
|
|
|
|
|
|
|
/* varlena.c */
|
2008-03-25 23:42:46 +01:00
|
|
|
extern text *cstring_to_text(const char *s);
|
|
|
|
extern text *cstring_to_text_with_len(const char *s, int len);
|
|
|
|
extern char *text_to_cstring(const text *t);
|
|
|
|
extern void text_to_cstring_buffer(const text *src, char *dst, size_t dst_len);
|
|
|
|
|
|
|
|
#define CStringGetTextDatum(s) PointerGetDatum(cstring_to_text(s))
|
|
|
|
#define TextDatumGetCString(d) text_to_cstring((text *) DatumGetPointer(d))
|
|
|
|
|
2000-07-06 01:12:09 +02:00
|
|
|
extern Datum textin(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum textout(PG_FUNCTION_ARGS);
|
2003-05-09 17:44:42 +02:00
|
|
|
extern Datum textrecv(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum textsend(PG_FUNCTION_ARGS);
|
2000-07-06 07:48:31 +02:00
|
|
|
extern Datum textcat(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum texteq(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum textne(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum text_lt(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum text_le(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum text_gt(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum text_ge(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum text_larger(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum text_smaller(PG_FUNCTION_ARGS);
|
2003-05-15 17:50:21 +02:00
|
|
|
extern Datum text_pattern_lt(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum text_pattern_le(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum text_pattern_gt(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum text_pattern_ge(PG_FUNCTION_ARGS);
|
2008-05-27 02:13:09 +02:00
|
|
|
extern Datum bttext_pattern_cmp(PG_FUNCTION_ARGS);
|
2016-02-03 20:17:35 +01:00
|
|
|
extern Datum bttext_pattern_sortsupport(PG_FUNCTION_ARGS);
|
2000-07-06 07:48:31 +02:00
|
|
|
extern Datum textlen(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum textoctetlen(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum textpos(PG_FUNCTION_ARGS);
|
2000-06-13 09:35:40 +02:00
|
|
|
extern Datum text_substr(PG_FUNCTION_ARGS);
|
2002-08-22 05:24:01 +02:00
|
|
|
extern Datum text_substr_no_len(PG_FUNCTION_ARGS);
|
2010-01-25 21:55:32 +01:00
|
|
|
extern Datum textoverlay(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum textoverlay_no_len(PG_FUNCTION_ARGS);
|
2000-07-06 07:48:31 +02:00
|
|
|
extern Datum name_text(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum text_name(PG_FUNCTION_ARGS);
|
2011-02-08 22:04:18 +01:00
|
|
|
extern int varstr_cmp(char *arg1, int len1, char *arg2, int len2, Oid collid);
|
2016-02-05 05:03:10 +01:00
|
|
|
extern void varstr_sortsupport(SortSupport ssup, Oid collid, bool bpchar);
|
2016-01-22 17:53:06 +01:00
|
|
|
extern int varstr_levenshtein(const char *source, int slen,
|
|
|
|
const char *target, int tlen,
|
|
|
|
int ins_c, int del_c, int sub_c,
|
|
|
|
bool trusted);
|
2015-05-24 03:35:49 +02:00
|
|
|
extern int varstr_levenshtein_less_equal(const char *source, int slen,
|
2016-01-22 17:53:06 +01:00
|
|
|
const char *target, int tlen,
|
|
|
|
int ins_c, int del_c, int sub_c,
|
|
|
|
int max_d, bool trusted);
|
2005-05-27 02:57:49 +02:00
|
|
|
extern List *textToQualifiedNameList(text *textval);
|
2002-04-01 05:34:27 +02:00
|
|
|
extern bool SplitIdentifierString(char *rawstring, char separator,
|
2002-09-04 22:31:48 +02:00
|
|
|
List **namelist);
|
2012-08-10 23:26:44 +02:00
|
|
|
extern bool SplitDirectoriesString(char *rawstring, char separator,
|
|
|
|
List **namelist);
|
2002-08-22 05:24:01 +02:00
|
|
|
extern Datum replace_text(PG_FUNCTION_ARGS);
|
2005-10-18 22:38:58 +02:00
|
|
|
extern text *replace_text_regexp(text *src_text, void *regexp,
|
2005-11-22 19:17:34 +01:00
|
|
|
text *replace_text, bool glob);
|
2002-08-22 05:24:01 +02:00
|
|
|
extern Datum split_text(PG_FUNCTION_ARGS);
|
2003-06-27 02:33:26 +02:00
|
|
|
extern Datum text_to_array(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum array_to_text(PG_FUNCTION_ARGS);
|
2010-08-10 23:51:00 +02:00
|
|
|
extern Datum text_to_array_null(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum array_to_text_null(PG_FUNCTION_ARGS);
|
2002-08-22 05:24:01 +02:00
|
|
|
extern Datum to_hex32(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum to_hex64(PG_FUNCTION_ARGS);
|
2002-12-06 06:20:28 +01:00
|
|
|
extern Datum md5_text(PG_FUNCTION_ARGS);
|
2005-05-20 03:29:56 +02:00
|
|
|
extern Datum md5_bytea(PG_FUNCTION_ARGS);
|
1997-12-16 16:55:17 +01:00
|
|
|
|
2002-04-24 04:12:53 +02:00
|
|
|
extern Datum unknownin(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum unknownout(PG_FUNCTION_ARGS);
|
2003-05-09 17:44:42 +02:00
|
|
|
extern Datum unknownrecv(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum unknownsend(PG_FUNCTION_ARGS);
|
2002-04-24 04:12:53 +02:00
|
|
|
|
2005-07-06 21:02:54 +02:00
|
|
|
extern Datum pg_column_size(PG_FUNCTION_ARGS);
|
1996-08-28 03:59:28 +02:00
|
|
|
|
2012-04-13 20:36:59 +02:00
|
|
|
extern Datum bytea_string_agg_transfn(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum bytea_string_agg_finalfn(PG_FUNCTION_ARGS);
|
2010-02-01 04:14:45 +01:00
|
|
|
extern Datum string_agg_transfn(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum string_agg_finalfn(PG_FUNCTION_ARGS);
|
|
|
|
|
2010-08-24 08:30:44 +02:00
|
|
|
extern Datum text_concat(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum text_concat_ws(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum text_left(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum text_right(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum text_reverse(PG_FUNCTION_ARGS);
|
2010-11-20 06:21:17 +01:00
|
|
|
extern Datum text_format(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum text_format_nv(PG_FUNCTION_ARGS);
|
2010-08-24 08:30:44 +02:00
|
|
|
|
2000-07-06 07:48:31 +02:00
|
|
|
/* version.c */
|
|
|
|
extern Datum pgsql_version(PG_FUNCTION_ARGS);
|
|
|
|
|
2003-05-13 01:08:52 +02:00
|
|
|
/* xid.c */
|
|
|
|
extern Datum xidin(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum xidout(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum xidrecv(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum xidsend(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum xideq(PG_FUNCTION_ARGS);
|
2015-11-07 22:40:15 +01:00
|
|
|
extern Datum xidneq(PG_FUNCTION_ARGS);
|
2003-05-13 01:08:52 +02:00
|
|
|
extern Datum xid_age(PG_FUNCTION_ARGS);
|
2014-09-10 23:13:04 +02:00
|
|
|
extern Datum mxid_age(PG_FUNCTION_ARGS);
|
2010-02-26 03:01:40 +01:00
|
|
|
extern int xidComparator(const void *arg1, const void *arg2);
|
2003-05-13 01:08:52 +02:00
|
|
|
extern Datum cidin(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum cidout(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum cidrecv(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum cidsend(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum cideq(PG_FUNCTION_ARGS);
|
|
|
|
|
1996-11-10 04:06:38 +01:00
|
|
|
/* like.c */
|
2000-07-06 07:48:31 +02:00
|
|
|
extern Datum namelike(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum namenlike(PG_FUNCTION_ARGS);
|
2000-09-15 20:45:31 +02:00
|
|
|
extern Datum nameiclike(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum nameicnlike(PG_FUNCTION_ARGS);
|
2000-07-06 07:48:31 +02:00
|
|
|
extern Datum textlike(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum textnlike(PG_FUNCTION_ARGS);
|
2000-09-15 20:45:31 +02:00
|
|
|
extern Datum texticlike(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum texticnlike(PG_FUNCTION_ARGS);
|
2001-09-14 19:46:40 +02:00
|
|
|
extern Datum bytealike(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum byteanlike(PG_FUNCTION_ARGS);
|
2000-09-15 20:45:31 +02:00
|
|
|
extern Datum like_escape(PG_FUNCTION_ARGS);
|
2001-09-14 19:46:40 +02:00
|
|
|
extern Datum like_escape_bytea(PG_FUNCTION_ARGS);
|
1996-11-10 04:06:38 +01:00
|
|
|
|
1997-03-09 21:41:02 +01:00
|
|
|
/* oracle_compat.c */
|
2000-07-06 07:48:31 +02:00
|
|
|
extern Datum lower(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum upper(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum initcap(PG_FUNCTION_ARGS);
|
2000-06-13 09:35:40 +02:00
|
|
|
extern Datum lpad(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum rpad(PG_FUNCTION_ARGS);
|
2000-07-06 07:48:31 +02:00
|
|
|
extern Datum btrim(PG_FUNCTION_ARGS);
|
2003-05-24 00:33:23 +02:00
|
|
|
extern Datum btrim1(PG_FUNCTION_ARGS);
|
2001-09-14 19:46:40 +02:00
|
|
|
extern Datum byteatrim(PG_FUNCTION_ARGS);
|
2000-07-06 07:48:31 +02:00
|
|
|
extern Datum ltrim(PG_FUNCTION_ARGS);
|
2003-05-24 00:33:23 +02:00
|
|
|
extern Datum ltrim1(PG_FUNCTION_ARGS);
|
2000-07-06 07:48:31 +02:00
|
|
|
extern Datum rtrim(PG_FUNCTION_ARGS);
|
2003-05-24 00:33:23 +02:00
|
|
|
extern Datum rtrim1(PG_FUNCTION_ARGS);
|
2000-07-06 07:48:31 +02:00
|
|
|
extern Datum translate(PG_FUNCTION_ARGS);
|
2003-08-08 23:42:59 +02:00
|
|
|
extern Datum chr (PG_FUNCTION_ARGS);
|
2000-06-13 09:35:40 +02:00
|
|
|
extern Datum repeat(PG_FUNCTION_ARGS);
|
2000-07-06 07:48:31 +02:00
|
|
|
extern Datum ascii(PG_FUNCTION_ARGS);
|
1997-03-09 21:41:02 +01:00
|
|
|
|
2010-11-24 23:04:19 +01:00
|
|
|
/* inet_cidr_ntop.c */
|
2000-08-04 01:07:51 +02:00
|
|
|
extern char *inet_cidr_ntop(int af, const void *src, int bits,
|
2001-03-22 05:01:46 +01:00
|
|
|
char *dst, size_t size);
|
1998-10-03 07:41:01 +02:00
|
|
|
|
|
|
|
/* inet_net_pton.c */
|
2001-03-22 05:01:46 +01:00
|
|
|
extern int inet_net_pton(int af, const char *src,
|
|
|
|
void *dst, size_t size);
|
1998-10-03 07:41:01 +02:00
|
|
|
|
1998-10-22 22:40:50 +02:00
|
|
|
/* network.c */
|
2000-08-04 01:07:51 +02:00
|
|
|
extern Datum inet_in(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum inet_out(PG_FUNCTION_ARGS);
|
2003-05-13 20:03:08 +02:00
|
|
|
extern Datum inet_recv(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum inet_send(PG_FUNCTION_ARGS);
|
2000-08-04 01:07:51 +02:00
|
|
|
extern Datum cidr_in(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum cidr_out(PG_FUNCTION_ARGS);
|
2003-05-13 20:03:08 +02:00
|
|
|
extern Datum cidr_recv(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum cidr_send(PG_FUNCTION_ARGS);
|
2000-08-04 01:07:51 +02:00
|
|
|
extern Datum network_cmp(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum network_lt(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum network_le(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum network_eq(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum network_ge(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum network_gt(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum network_ne(PG_FUNCTION_ARGS);
|
2014-08-29 04:37:58 +02:00
|
|
|
extern Datum network_smaller(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum network_larger(PG_FUNCTION_ARGS);
|
2004-06-13 23:57:28 +02:00
|
|
|
extern Datum hashinet(PG_FUNCTION_ARGS);
|
2000-08-04 01:07:51 +02:00
|
|
|
extern Datum network_sub(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum network_subeq(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum network_sup(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum network_supeq(PG_FUNCTION_ARGS);
|
Add an in-core GiST index opclass for inet/cidr types.
This operator class can accelerate subnet/supernet tests as well as
btree-equivalent ordered comparisons. It also handles a new network
operator inet && inet (overlaps, a/k/a "is supernet or subnet of"),
which is expected to be useful in exclusion constraints.
Ideally this opclass would be the default for GiST with inet/cidr data,
but we can't mark it that way until we figure out how to do a more or
less graceful transition from the current situation, in which the
really-completely-bogus inet/cidr opclasses in contrib/btree_gist are
marked as default. Having the opclass in core and not default is better
than not having it at all, though.
While at it, add new documentation sections to allow us to officially
document GiST/GIN/SP-GiST opclasses, something there was never a clear
place to do before. I filled these in with some simple tables listing
the existing opclasses and the operators they support, but there's
certainly scope to put more information there.
Emre Hasegeli, reviewed by Andreas Karlsson, further hacking by me
2014-04-08 21:46:14 +02:00
|
|
|
extern Datum network_overlap(PG_FUNCTION_ARGS);
|
2000-07-06 07:48:31 +02:00
|
|
|
extern Datum network_network(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum network_netmask(PG_FUNCTION_ARGS);
|
2003-03-22 00:18:52 +01:00
|
|
|
extern Datum network_hostmask(PG_FUNCTION_ARGS);
|
2000-08-04 01:07:51 +02:00
|
|
|
extern Datum network_masklen(PG_FUNCTION_ARGS);
|
2003-06-25 00:21:24 +02:00
|
|
|
extern Datum network_family(PG_FUNCTION_ARGS);
|
2000-07-06 07:48:31 +02:00
|
|
|
extern Datum network_broadcast(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum network_host(PG_FUNCTION_ARGS);
|
2000-11-10 21:13:27 +01:00
|
|
|
extern Datum network_show(PG_FUNCTION_ARGS);
|
2006-01-26 03:35:51 +01:00
|
|
|
extern Datum inet_abbrev(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum cidr_abbrev(PG_FUNCTION_ARGS);
|
2001-06-10 00:16:18 +02:00
|
|
|
extern double convert_network_to_scalar(Datum value, Oid typid);
|
2006-01-26 03:35:51 +01:00
|
|
|
extern Datum inet_to_cidr(PG_FUNCTION_ARGS);
|
2001-06-13 23:09:00 +02:00
|
|
|
extern Datum inet_set_masklen(PG_FUNCTION_ARGS);
|
2006-01-26 03:35:51 +01:00
|
|
|
extern Datum cidr_set_masklen(PG_FUNCTION_ARGS);
|
2001-06-17 04:05:20 +02:00
|
|
|
extern Datum network_scan_first(Datum in);
|
|
|
|
extern Datum network_scan_last(Datum in);
|
2004-06-13 21:56:52 +02:00
|
|
|
extern Datum inet_client_addr(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum inet_client_port(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum inet_server_addr(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum inet_server_port(PG_FUNCTION_ARGS);
|
2006-02-11 04:32:41 +01:00
|
|
|
extern Datum inetnot(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum inetand(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum inetor(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum inetpl(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum inetmi_int8(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum inetmi(PG_FUNCTION_ARGS);
|
2007-05-18 01:31:49 +02:00
|
|
|
extern void clean_ipv6_addr(int addr_family, char *addr);
|
2015-05-05 20:22:24 +02:00
|
|
|
extern Datum inet_same_family(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum inet_merge(PG_FUNCTION_ARGS);
|
1998-10-03 07:41:01 +02:00
|
|
|
|
|
|
|
/* mac.c */
|
2000-08-04 01:07:51 +02:00
|
|
|
extern Datum macaddr_in(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum macaddr_out(PG_FUNCTION_ARGS);
|
2003-05-13 20:03:08 +02:00
|
|
|
extern Datum macaddr_recv(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum macaddr_send(PG_FUNCTION_ARGS);
|
2000-08-04 01:07:51 +02:00
|
|
|
extern Datum macaddr_cmp(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum macaddr_lt(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum macaddr_le(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum macaddr_eq(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum macaddr_ge(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum macaddr_gt(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum macaddr_ne(PG_FUNCTION_ARGS);
|
2012-01-19 21:23:04 +01:00
|
|
|
extern Datum macaddr_not(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum macaddr_and(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum macaddr_or(PG_FUNCTION_ARGS);
|
2000-08-23 08:04:49 +02:00
|
|
|
extern Datum macaddr_trunc(PG_FUNCTION_ARGS);
|
2000-12-09 00:57:03 +01:00
|
|
|
extern Datum hashmacaddr(PG_FUNCTION_ARGS);
|
1998-10-03 07:41:01 +02:00
|
|
|
|
1998-12-30 20:56:35 +01:00
|
|
|
/* numeric.c */
|
2000-06-13 09:35:40 +02:00
|
|
|
extern Datum numeric_in(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum numeric_out(PG_FUNCTION_ARGS);
|
2003-05-13 01:08:52 +02:00
|
|
|
extern Datum numeric_recv(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum numeric_send(PG_FUNCTION_ARGS);
|
2006-12-30 22:21:56 +01:00
|
|
|
extern Datum numerictypmodin(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum numerictypmodout(PG_FUNCTION_ARGS);
|
2012-02-07 18:08:26 +01:00
|
|
|
extern Datum numeric_transform(PG_FUNCTION_ARGS);
|
2007-11-15 22:14:46 +01:00
|
|
|
extern Datum numeric (PG_FUNCTION_ARGS);
|
2000-07-29 05:26:51 +02:00
|
|
|
extern Datum numeric_abs(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum numeric_uminus(PG_FUNCTION_ARGS);
|
2001-06-07 02:09:32 +02:00
|
|
|
extern Datum numeric_uplus(PG_FUNCTION_ARGS);
|
2000-07-29 05:26:51 +02:00
|
|
|
extern Datum numeric_sign(PG_FUNCTION_ARGS);
|
2000-06-13 09:35:40 +02:00
|
|
|
extern Datum numeric_round(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum numeric_trunc(PG_FUNCTION_ARGS);
|
2000-07-29 05:26:51 +02:00
|
|
|
extern Datum numeric_ceil(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum numeric_floor(PG_FUNCTION_ARGS);
|
2015-04-02 20:02:55 +02:00
|
|
|
extern Datum numeric_sortsupport(PG_FUNCTION_ARGS);
|
2000-07-29 05:26:51 +02:00
|
|
|
extern Datum numeric_cmp(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum numeric_eq(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum numeric_ne(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum numeric_gt(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum numeric_ge(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum numeric_lt(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum numeric_le(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum numeric_add(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum numeric_sub(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum numeric_mul(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum numeric_div(PG_FUNCTION_ARGS);
|
2008-04-04 20:45:36 +02:00
|
|
|
extern Datum numeric_div_trunc(PG_FUNCTION_ARGS);
|
2000-07-29 05:26:51 +02:00
|
|
|
extern Datum numeric_mod(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum numeric_inc(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum numeric_smaller(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum numeric_larger(PG_FUNCTION_ARGS);
|
2003-12-01 22:52:38 +01:00
|
|
|
extern Datum numeric_fac(PG_FUNCTION_ARGS);
|
2000-07-29 05:26:51 +02:00
|
|
|
extern Datum numeric_sqrt(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum numeric_exp(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum numeric_ln(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum numeric_log(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum numeric_power(PG_FUNCTION_ARGS);
|
2016-01-05 23:02:13 +01:00
|
|
|
extern Datum numeric_scale(PG_FUNCTION_ARGS);
|
2000-06-13 09:35:40 +02:00
|
|
|
extern Datum int4_numeric(PG_FUNCTION_ARGS);
|
2000-07-29 05:26:51 +02:00
|
|
|
extern Datum numeric_int4(PG_FUNCTION_ARGS);
|
2000-07-17 05:05:41 +02:00
|
|
|
extern Datum int8_numeric(PG_FUNCTION_ARGS);
|
2000-07-29 05:26:51 +02:00
|
|
|
extern Datum numeric_int8(PG_FUNCTION_ARGS);
|
2000-06-05 09:29:25 +02:00
|
|
|
extern Datum int2_numeric(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum numeric_int2(PG_FUNCTION_ARGS);
|
2000-07-29 05:26:51 +02:00
|
|
|
extern Datum float8_numeric(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum numeric_float8(PG_FUNCTION_ARGS);
|
2001-10-14 01:32:34 +02:00
|
|
|
extern Datum numeric_float8_no_overflow(PG_FUNCTION_ARGS);
|
2000-07-29 05:26:51 +02:00
|
|
|
extern Datum float4_numeric(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum numeric_float4(PG_FUNCTION_ARGS);
|
2000-07-17 05:05:41 +02:00
|
|
|
extern Datum numeric_accum(PG_FUNCTION_ARGS);
|
2016-04-05 20:24:59 +02:00
|
|
|
extern Datum numeric_combine(PG_FUNCTION_ARGS);
|
2007-02-17 01:55:58 +01:00
|
|
|
extern Datum numeric_avg_accum(PG_FUNCTION_ARGS);
|
2016-04-05 20:24:59 +02:00
|
|
|
extern Datum numeric_avg_combine(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum numeric_avg_serialize(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum numeric_avg_deserialize(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum numeric_serialize(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum numeric_deserialize(PG_FUNCTION_ARGS);
|
2014-04-13 02:33:09 +02:00
|
|
|
extern Datum numeric_accum_inv(PG_FUNCTION_ARGS);
|
2000-07-17 05:05:41 +02:00
|
|
|
extern Datum int2_accum(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum int4_accum(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum int8_accum(PG_FUNCTION_ARGS);
|
2016-04-05 20:24:59 +02:00
|
|
|
extern Datum numeric_poly_combine(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum numeric_poly_serialize(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum numeric_poly_deserialize(PG_FUNCTION_ARGS);
|
2014-04-13 02:33:09 +02:00
|
|
|
extern Datum int2_accum_inv(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum int4_accum_inv(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum int8_accum_inv(PG_FUNCTION_ARGS);
|
2007-02-17 01:55:58 +01:00
|
|
|
extern Datum int8_avg_accum(PG_FUNCTION_ARGS);
|
2016-04-05 20:24:59 +02:00
|
|
|
extern Datum int8_avg_combine(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum int8_avg_serialize(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum int8_avg_deserialize(PG_FUNCTION_ARGS);
|
2000-07-17 05:05:41 +02:00
|
|
|
extern Datum numeric_avg(PG_FUNCTION_ARGS);
|
Improve performance of numeric sum(), avg(), stddev(), variance(), etc.
This patch improves performance of most built-in aggregates that formerly
used a NUMERIC or NUMERIC array as their transition type; this includes
not only aggregates on numeric inputs, but some aggregates on integer
inputs where overflow of an int8 value is a possibility. The code now
uses a special-purpose data structure to avoid array construction and
deconstruction overhead, as well as packing and unpacking overhead for
numeric values.
These aggregates' transition type is now declared as INTERNAL, since
it doesn't correspond to any SQL data type. To keep the planner from
thinking that that means a lot of storage will be used, we make use
of the just-added pg_aggregate.aggtransspace feature. The space estimate
is set to 128 bytes, which is at least in the right ballpark.
Hadi Moshayedi, reviewed by Pavel Stehule and Tomas Vondra
2013-11-17 00:46:34 +01:00
|
|
|
extern Datum numeric_sum(PG_FUNCTION_ARGS);
|
2006-03-10 21:15:28 +01:00
|
|
|
extern Datum numeric_var_pop(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum numeric_var_samp(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum numeric_stddev_pop(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum numeric_stddev_samp(PG_FUNCTION_ARGS);
|
2015-03-20 10:26:17 +01:00
|
|
|
extern Datum numeric_poly_sum(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum numeric_poly_avg(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum numeric_poly_var_pop(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum numeric_poly_var_samp(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum numeric_poly_stddev_pop(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum numeric_poly_stddev_samp(PG_FUNCTION_ARGS);
|
2000-07-17 05:05:41 +02:00
|
|
|
extern Datum int2_sum(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum int4_sum(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum int8_sum(PG_FUNCTION_ARGS);
|
2001-08-15 00:21:59 +02:00
|
|
|
extern Datum int2_avg_accum(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum int4_avg_accum(PG_FUNCTION_ARGS);
|
2016-04-05 20:24:59 +02:00
|
|
|
extern Datum int4_avg_combine(PG_FUNCTION_ARGS);
|
2014-04-13 02:33:09 +02:00
|
|
|
extern Datum int2_avg_accum_inv(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum int4_avg_accum_inv(PG_FUNCTION_ARGS);
|
2015-03-20 10:26:17 +01:00
|
|
|
extern Datum int8_avg_accum_inv(PG_FUNCTION_ARGS);
|
2001-08-15 00:21:59 +02:00
|
|
|
extern Datum int8_avg(PG_FUNCTION_ARGS);
|
2014-04-13 02:33:09 +02:00
|
|
|
extern Datum int2int4_sum(PG_FUNCTION_ARGS);
|
2004-05-14 23:42:30 +02:00
|
|
|
extern Datum width_bucket_numeric(PG_FUNCTION_ARGS);
|
2007-05-08 20:56:48 +02:00
|
|
|
extern Datum hash_numeric(PG_FUNCTION_ARGS);
|
2014-11-11 13:44:46 +01:00
|
|
|
extern Datum generate_series_numeric(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum generate_series_step_numeric(PG_FUNCTION_ARGS);
|
1998-12-30 20:56:35 +01:00
|
|
|
|
1999-09-30 16:54:24 +02:00
|
|
|
/* ri_triggers.c */
|
2000-05-29 03:59:17 +02:00
|
|
|
extern Datum RI_FKey_check_ins(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum RI_FKey_check_upd(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum RI_FKey_noaction_del(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum RI_FKey_noaction_upd(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum RI_FKey_cascade_del(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum RI_FKey_cascade_upd(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum RI_FKey_restrict_del(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum RI_FKey_restrict_upd(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum RI_FKey_setnull_del(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum RI_FKey_setnull_upd(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum RI_FKey_setdefault_del(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum RI_FKey_setdefault_upd(PG_FUNCTION_ARGS);
|
1998-10-03 07:41:01 +02:00
|
|
|
|
2008-11-03 21:17:21 +01:00
|
|
|
/* trigfuncs.c */
|
|
|
|
extern Datum suppress_redundant_updates_trigger(PG_FUNCTION_ARGS);
|
|
|
|
|
2002-09-03 23:45:44 +02:00
|
|
|
/* encoding support functions */
|
2000-06-13 09:35:40 +02:00
|
|
|
extern Datum getdatabaseencoding(PG_FUNCTION_ARGS);
|
Commit Karel's patch.
-------------------------------------------------------------------
Subject: Re: [PATCHES] encoding names
From: Karel Zak <zakkr@zf.jcu.cz>
To: Peter Eisentraut <peter_e@gmx.net>
Cc: pgsql-patches <pgsql-patches@postgresql.org>
Date: Fri, 31 Aug 2001 17:24:38 +0200
On Thu, Aug 30, 2001 at 01:30:40AM +0200, Peter Eisentraut wrote:
> > - convert encoding 'name' to 'id'
>
> I thought we decided not to add functions returning "new" names until we
> know exactly what the new names should be, and pending schema
Ok, the patch not to add functions.
> better
>
> ...(): encoding name too long
Fixed.
I found new bug in command/variable.c in parse_client_encoding(), nobody
probably never see this error:
if (pg_set_client_encoding(encoding))
{
elog(ERROR, "Conversion between %s and %s is not supported",
value, GetDatabaseEncodingName());
}
because pg_set_client_encoding() returns -1 for error and 0 as true.
It's fixed too.
IMHO it can be apply.
Karel
PS:
* following files are renamed:
src/utils/mb/Unicode/KOI8_to_utf8.map -->
src/utils/mb/Unicode/koi8r_to_utf8.map
src/utils/mb/Unicode/WIN_to_utf8.map -->
src/utils/mb/Unicode/win1251_to_utf8.map
src/utils/mb/Unicode/utf8_to_KOI8.map -->
src/utils/mb/Unicode/utf8_to_koi8r.map
src/utils/mb/Unicode/utf8_to_WIN.map -->
src/utils/mb/Unicode/utf8_to_win1251.map
* new file:
src/utils/mb/encname.c
* removed file:
src/utils/mb/common.c
--
Karel Zak <zakkr@zf.jcu.cz>
http://home.zf.jcu.cz/~zakkr/
C, PostgreSQL, PHP, WWW, http://docs.linux.cz, http://mape.jcu.cz
2001-09-06 06:57:30 +02:00
|
|
|
extern Datum database_character_set(PG_FUNCTION_ARGS);
|
2001-10-13 18:34:08 +02:00
|
|
|
extern Datum pg_client_encoding(PG_FUNCTION_ARGS);
|
2000-06-13 09:35:40 +02:00
|
|
|
extern Datum PG_encoding_to_char(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum PG_char_to_encoding(PG_FUNCTION_ARGS);
|
Commit Karel's patch.
-------------------------------------------------------------------
Subject: Re: [PATCHES] encoding names
From: Karel Zak <zakkr@zf.jcu.cz>
To: Peter Eisentraut <peter_e@gmx.net>
Cc: pgsql-patches <pgsql-patches@postgresql.org>
Date: Fri, 31 Aug 2001 17:24:38 +0200
On Thu, Aug 30, 2001 at 01:30:40AM +0200, Peter Eisentraut wrote:
> > - convert encoding 'name' to 'id'
>
> I thought we decided not to add functions returning "new" names until we
> know exactly what the new names should be, and pending schema
Ok, the patch not to add functions.
> better
>
> ...(): encoding name too long
Fixed.
I found new bug in command/variable.c in parse_client_encoding(), nobody
probably never see this error:
if (pg_set_client_encoding(encoding))
{
elog(ERROR, "Conversion between %s and %s is not supported",
value, GetDatabaseEncodingName());
}
because pg_set_client_encoding() returns -1 for error and 0 as true.
It's fixed too.
IMHO it can be apply.
Karel
PS:
* following files are renamed:
src/utils/mb/Unicode/KOI8_to_utf8.map -->
src/utils/mb/Unicode/koi8r_to_utf8.map
src/utils/mb/Unicode/WIN_to_utf8.map -->
src/utils/mb/Unicode/win1251_to_utf8.map
src/utils/mb/Unicode/utf8_to_KOI8.map -->
src/utils/mb/Unicode/utf8_to_koi8r.map
src/utils/mb/Unicode/utf8_to_WIN.map -->
src/utils/mb/Unicode/utf8_to_win1251.map
* new file:
src/utils/mb/encname.c
* removed file:
src/utils/mb/common.c
--
Karel Zak <zakkr@zf.jcu.cz>
http://home.zf.jcu.cz/~zakkr/
C, PostgreSQL, PHP, WWW, http://docs.linux.cz, http://mape.jcu.cz
2001-09-06 06:57:30 +02:00
|
|
|
extern Datum PG_character_set_name(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum PG_character_set_id(PG_FUNCTION_ARGS);
|
2001-08-15 09:07:40 +02:00
|
|
|
extern Datum pg_convert(PG_FUNCTION_ARGS);
|
2007-09-18 19:41:17 +02:00
|
|
|
extern Datum pg_convert_to(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum pg_convert_from(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum length_in_encoding(PG_FUNCTION_ARGS);
|
2009-07-07 20:23:15 +02:00
|
|
|
extern Datum pg_encoding_max_length_sql(PG_FUNCTION_ARGS);
|
2000-06-13 09:35:40 +02:00
|
|
|
|
2000-07-09 23:30:21 +02:00
|
|
|
/* format_type.c */
|
2000-07-07 21:24:43 +02:00
|
|
|
extern Datum format_type(PG_FUNCTION_ARGS);
|
2001-10-25 07:50:21 +02:00
|
|
|
extern char *format_type_be(Oid type_oid);
|
2013-03-20 22:19:19 +01:00
|
|
|
extern char *format_type_be_qualified(Oid type_oid);
|
2001-10-25 07:50:21 +02:00
|
|
|
extern char *format_type_with_typemod(Oid type_oid, int32 typemod);
|
Allow postgres_fdw to ship extension funcs/operators for remote execution.
The user can whitelist specified extension(s) in the foreign server's
options, whereupon we will treat immutable functions and operators of those
extensions as candidates to be sent for remote execution.
Whitelisting an extension in this way basically promises that the extension
exists on the remote server and behaves compatibly with the local instance.
We have no way to prove that formally, so we have to rely on the user to
get it right. But this seems like something that people can usually get
right in practice.
We might in future allow functions and operators to be whitelisted
individually, but extension granularity is a very convenient special case,
so it got done first.
The patch as-committed lacks any regression tests, which is unfortunate,
but introducing dependencies on other extensions for testing purposes
would break "make installcheck" scenarios, which is worse. I have some
ideas about klugy ways around that, but it seems like material for a
separate patch. For the moment, leave the problem open.
Paul Ramsey, hacked up a bit more by me
2015-11-04 00:42:02 +01:00
|
|
|
extern char *format_type_with_typemod_qualified(Oid type_oid, int32 typemod);
|
2000-07-09 23:30:21 +02:00
|
|
|
extern Datum oidvectortypes(PG_FUNCTION_ARGS);
|
2000-08-25 20:05:54 +02:00
|
|
|
extern int32 type_maximum_size(Oid type_oid, int32 typemod);
|
2000-07-07 21:24:43 +02:00
|
|
|
|
2000-09-05 22:25:14 +02:00
|
|
|
/* quote.c */
|
|
|
|
extern Datum quote_ident(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum quote_literal(PG_FUNCTION_ARGS);
|
2011-02-22 22:33:44 +01:00
|
|
|
extern char *quote_literal_cstr(const char *rawstr);
|
2008-03-23 01:24:20 +01:00
|
|
|
extern Datum quote_nullable(PG_FUNCTION_ARGS);
|
2001-10-28 07:26:15 +01:00
|
|
|
|
2002-07-20 07:49:28 +02:00
|
|
|
/* guc.c */
|
|
|
|
extern Datum show_config_by_name(PG_FUNCTION_ARGS);
|
2015-07-02 22:40:55 +02:00
|
|
|
extern Datum show_config_by_name_missing_ok(PG_FUNCTION_ARGS);
|
2002-07-20 07:49:28 +02:00
|
|
|
extern Datum set_config_by_name(PG_FUNCTION_ARGS);
|
2002-08-15 04:51:27 +02:00
|
|
|
extern Datum show_all_settings(PG_FUNCTION_ARGS);
|
2015-05-09 01:09:26 +02:00
|
|
|
extern Datum show_all_file_settings(PG_FUNCTION_ARGS);
|
2002-07-20 07:49:28 +02:00
|
|
|
|
2016-02-17 18:12:06 +01:00
|
|
|
/* pg_config.c */
|
|
|
|
extern Datum pg_config(PG_FUNCTION_ARGS);
|
|
|
|
|
2016-03-05 20:10:19 +01:00
|
|
|
/* pg_controldata.c */
|
|
|
|
extern Datum pg_control_checkpoint(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum pg_control_system(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum pg_control_init(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum pg_control_recovery(PG_FUNCTION_ARGS);
|
|
|
|
|
2015-07-28 22:21:22 +02:00
|
|
|
/* rls.c */
|
|
|
|
extern Datum row_security_active(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum row_security_active_name(PG_FUNCTION_ARGS);
|
|
|
|
|
2002-08-29 02:17:06 +02:00
|
|
|
/* lockfuncs.c */
|
|
|
|
extern Datum pg_lock_status(PG_FUNCTION_ARGS);
|
Create a function to reliably identify which sessions block which others.
This patch introduces "pg_blocking_pids(int) returns int[]", which returns
the PIDs of any sessions that are blocking the session with the given PID.
Historically people have obtained such information using a self-join on
the pg_locks view, but it's unreasonably tedious to do it that way with any
modicum of correctness, and the addition of parallel queries has pretty
much broken that approach altogether. (Given some more columns in the view
than there are today, you could imagine handling parallel-query cases with
a 4-way join; but ugh.)
The new function has the following behaviors that are painful or impossible
to get right via pg_locks:
1. Correctly understands which lock modes block which other ones.
2. In soft-block situations (two processes both waiting for conflicting lock
modes), only the one that's in front in the wait queue is reported to
block the other.
3. In parallel-query cases, reports all sessions blocking any member of
the given PID's lock group, and reports a session by naming its leader
process's PID, which will be the pg_backend_pid() value visible to
clients.
The motivation for doing this right now is mostly to fix the isolation
tests. Commit 38f8bdcac4982215beb9f65a19debecaf22fd470 lobotomized
isolationtester's is-it-waiting query by removing its ability to recognize
nonconflicting lock modes, as a crude workaround for the inability to
handle soft-block situations properly. But even without the lock mode
tests, the old query was excessively slow, particularly in
CLOBBER_CACHE_ALWAYS builds; some of our buildfarm animals fail the new
deadlock-hard test because the deadlock timeout elapses before they can
probe the waiting status of all eight sessions. Replacing the pg_locks
self-join with use of pg_blocking_pids() is not only much more correct, but
a lot faster: I measure it at about 9X faster in a typical dev build with
Asserts, and 3X faster in CLOBBER_CACHE_ALWAYS builds. That should provide
enough headroom for the slower CLOBBER_CACHE_ALWAYS animals to pass the
test, without having to lengthen deadlock_timeout yet more and thus slow
down the test for everyone else.
2016-02-22 20:31:43 +01:00
|
|
|
extern Datum pg_blocking_pids(PG_FUNCTION_ARGS);
|
2006-09-19 00:40:40 +02:00
|
|
|
extern Datum pg_advisory_lock_int8(PG_FUNCTION_ARGS);
|
2011-02-18 06:04:34 +01:00
|
|
|
extern Datum pg_advisory_xact_lock_int8(PG_FUNCTION_ARGS);
|
2006-09-19 00:40:40 +02:00
|
|
|
extern Datum pg_advisory_lock_shared_int8(PG_FUNCTION_ARGS);
|
2011-02-18 06:04:34 +01:00
|
|
|
extern Datum pg_advisory_xact_lock_shared_int8(PG_FUNCTION_ARGS);
|
2006-09-19 00:40:40 +02:00
|
|
|
extern Datum pg_try_advisory_lock_int8(PG_FUNCTION_ARGS);
|
2011-02-18 06:04:34 +01:00
|
|
|
extern Datum pg_try_advisory_xact_lock_int8(PG_FUNCTION_ARGS);
|
2006-09-19 00:40:40 +02:00
|
|
|
extern Datum pg_try_advisory_lock_shared_int8(PG_FUNCTION_ARGS);
|
2011-02-18 06:04:34 +01:00
|
|
|
extern Datum pg_try_advisory_xact_lock_shared_int8(PG_FUNCTION_ARGS);
|
2006-09-19 00:40:40 +02:00
|
|
|
extern Datum pg_advisory_unlock_int8(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum pg_advisory_unlock_shared_int8(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum pg_advisory_lock_int4(PG_FUNCTION_ARGS);
|
2011-02-18 06:04:34 +01:00
|
|
|
extern Datum pg_advisory_xact_lock_int4(PG_FUNCTION_ARGS);
|
2006-09-19 00:40:40 +02:00
|
|
|
extern Datum pg_advisory_lock_shared_int4(PG_FUNCTION_ARGS);
|
2011-02-18 06:04:34 +01:00
|
|
|
extern Datum pg_advisory_xact_lock_shared_int4(PG_FUNCTION_ARGS);
|
2006-09-19 00:40:40 +02:00
|
|
|
extern Datum pg_try_advisory_lock_int4(PG_FUNCTION_ARGS);
|
2011-02-18 06:04:34 +01:00
|
|
|
extern Datum pg_try_advisory_xact_lock_int4(PG_FUNCTION_ARGS);
|
2006-09-19 00:40:40 +02:00
|
|
|
extern Datum pg_try_advisory_lock_shared_int4(PG_FUNCTION_ARGS);
|
2011-02-18 06:04:34 +01:00
|
|
|
extern Datum pg_try_advisory_xact_lock_shared_int4(PG_FUNCTION_ARGS);
|
2006-09-19 00:40:40 +02:00
|
|
|
extern Datum pg_advisory_unlock_int4(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum pg_advisory_unlock_shared_int4(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum pg_advisory_unlock_all(PG_FUNCTION_ARGS);
|
2002-08-29 02:17:06 +02:00
|
|
|
|
2007-10-14 01:06:28 +02:00
|
|
|
/* txid.c */
|
|
|
|
extern Datum txid_snapshot_in(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum txid_snapshot_out(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum txid_snapshot_recv(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum txid_snapshot_send(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum txid_current(PG_FUNCTION_ARGS);
|
2016-08-23 16:30:52 +02:00
|
|
|
extern Datum txid_current_if_assigned(PG_FUNCTION_ARGS);
|
2007-10-14 01:06:28 +02:00
|
|
|
extern Datum txid_current_snapshot(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum txid_snapshot_xmin(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum txid_snapshot_xmax(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum txid_snapshot_xip(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum txid_visible_in_snapshot(PG_FUNCTION_ARGS);
|
2006-01-18 07:49:30 +01:00
|
|
|
|
2007-01-28 17:16:54 +01:00
|
|
|
/* uuid.c */
|
|
|
|
extern Datum uuid_in(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum uuid_out(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum uuid_send(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum uuid_recv(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum uuid_lt(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum uuid_le(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum uuid_eq(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum uuid_ge(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum uuid_gt(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum uuid_ne(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum uuid_cmp(PG_FUNCTION_ARGS);
|
2015-11-06 18:10:42 +01:00
|
|
|
extern Datum uuid_sortsupport(PG_FUNCTION_ARGS);
|
2007-01-28 17:16:54 +01:00
|
|
|
extern Datum uuid_hash(PG_FUNCTION_ARGS);
|
|
|
|
|
2008-12-28 19:54:01 +01:00
|
|
|
/* windowfuncs.c */
|
|
|
|
extern Datum window_row_number(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum window_rank(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum window_dense_rank(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum window_percent_rank(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum window_cume_dist(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum window_ntile(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum window_lag(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum window_lag_with_offset(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum window_lag_with_offset_and_default(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum window_lead(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum window_lead_with_offset(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum window_lead_with_offset_and_default(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum window_first_value(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum window_last_value(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum window_nth_value(PG_FUNCTION_ARGS);
|
|
|
|
|
2011-12-17 22:41:16 +01:00
|
|
|
/* access/spgist/spgquadtreeproc.c */
|
|
|
|
extern Datum spg_quad_config(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum spg_quad_choose(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum spg_quad_picksplit(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum spg_quad_inner_consistent(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum spg_quad_leaf_consistent(PG_FUNCTION_ARGS);
|
|
|
|
|
|
|
|
/* access/spgist/spgkdtreeproc.c */
|
|
|
|
extern Datum spg_kd_config(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum spg_kd_choose(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum spg_kd_picksplit(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum spg_kd_inner_consistent(PG_FUNCTION_ARGS);
|
|
|
|
|
|
|
|
/* access/spgist/spgtextproc.c */
|
|
|
|
extern Datum spg_text_config(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum spg_text_choose(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum spg_text_picksplit(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum spg_text_inner_consistent(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum spg_text_leaf_consistent(PG_FUNCTION_ARGS);
|
|
|
|
|
Fix GIN to support null keys, empty and null items, and full index scans.
Per my recent proposal(s). Null key datums can now be returned by
extractValue and extractQuery functions, and will be stored in the index.
Also, placeholder entries are made for indexable items that are NULL or
contain no keys according to extractValue. This means that the index is
now always complete, having at least one entry for every indexed heap TID,
and so we can get rid of the prohibition on full-index scans. A full-index
scan is implemented much the same way as partial-match scans were already:
we build a bitmap representing all the TIDs found in the index, and then
drive the results off that.
Also, introduce a concept of a "search mode" that can be requested by
extractQuery when the operator requires matching to empty items (this is
just as cheap as matching to a single key) or requires a full index scan
(which is not so cheap, but it sure beats failing or giving wrong answers).
The behavior remains backward compatible for opclasses that don't return
any null keys or request a non-default search mode.
Using these features, we can now make the GIN index opclass for anyarray
behave in a way that matches the actual anyarray operators for &&, <@, @>,
and = ... which it failed to do before in assorted corner cases.
This commit fixes the core GIN code and ginarrayprocs.c, updates the
documentation, and adds some simple regression test cases for the new
behaviors using the array operators. The tsearch and contrib GIN opclass
support functions still need to be looked over and probably fixed.
Another thing I intend to fix separately is that this is pretty inefficient
for cases where more than one scan condition needs a full-index search:
we'll run duplicate GinScanEntrys, each one of which builds a large bitmap.
There is some existing logic to merge duplicate GinScanEntrys but it needs
refactoring to make it work for entries belonging to different scan keys.
Note that most of gin.h has been split out into a new file gin_private.h,
so that gin.h doesn't export anything that's not supposed to be used by GIN
opclasses or the rest of the backend. I did quite a bit of other code
beautification work as well, mostly fixing comments and choosing more
appropriate names for things.
2011-01-08 01:16:24 +01:00
|
|
|
/* access/gin/ginarrayproc.c */
|
|
|
|
extern Datum ginarrayextract(PG_FUNCTION_ARGS);
|
2011-02-16 23:24:06 +01:00
|
|
|
extern Datum ginarrayextract_2args(PG_FUNCTION_ARGS);
|
Fix GIN to support null keys, empty and null items, and full index scans.
Per my recent proposal(s). Null key datums can now be returned by
extractValue and extractQuery functions, and will be stored in the index.
Also, placeholder entries are made for indexable items that are NULL or
contain no keys according to extractValue. This means that the index is
now always complete, having at least one entry for every indexed heap TID,
and so we can get rid of the prohibition on full-index scans. A full-index
scan is implemented much the same way as partial-match scans were already:
we build a bitmap representing all the TIDs found in the index, and then
drive the results off that.
Also, introduce a concept of a "search mode" that can be requested by
extractQuery when the operator requires matching to empty items (this is
just as cheap as matching to a single key) or requires a full index scan
(which is not so cheap, but it sure beats failing or giving wrong answers).
The behavior remains backward compatible for opclasses that don't return
any null keys or request a non-default search mode.
Using these features, we can now make the GIN index opclass for anyarray
behave in a way that matches the actual anyarray operators for &&, <@, @>,
and = ... which it failed to do before in assorted corner cases.
This commit fixes the core GIN code and ginarrayprocs.c, updates the
documentation, and adds some simple regression test cases for the new
behaviors using the array operators. The tsearch and contrib GIN opclass
support functions still need to be looked over and probably fixed.
Another thing I intend to fix separately is that this is pretty inefficient
for cases where more than one scan condition needs a full-index search:
we'll run duplicate GinScanEntrys, each one of which builds a large bitmap.
There is some existing logic to merge duplicate GinScanEntrys but it needs
refactoring to make it work for entries belonging to different scan keys.
Note that most of gin.h has been split out into a new file gin_private.h,
so that gin.h doesn't export anything that's not supposed to be used by GIN
opclasses or the rest of the backend. I did quite a bit of other code
beautification work as well, mostly fixing comments and choosing more
appropriate names for things.
2011-01-08 01:16:24 +01:00
|
|
|
extern Datum ginqueryarrayextract(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum ginarrayconsistent(PG_FUNCTION_ARGS);
|
2014-03-12 16:13:22 +01:00
|
|
|
extern Datum ginarraytriconsistent(PG_FUNCTION_ARGS);
|
Fix GIN to support null keys, empty and null items, and full index scans.
Per my recent proposal(s). Null key datums can now be returned by
extractValue and extractQuery functions, and will be stored in the index.
Also, placeholder entries are made for indexable items that are NULL or
contain no keys according to extractValue. This means that the index is
now always complete, having at least one entry for every indexed heap TID,
and so we can get rid of the prohibition on full-index scans. A full-index
scan is implemented much the same way as partial-match scans were already:
we build a bitmap representing all the TIDs found in the index, and then
drive the results off that.
Also, introduce a concept of a "search mode" that can be requested by
extractQuery when the operator requires matching to empty items (this is
just as cheap as matching to a single key) or requires a full index scan
(which is not so cheap, but it sure beats failing or giving wrong answers).
The behavior remains backward compatible for opclasses that don't return
any null keys or request a non-default search mode.
Using these features, we can now make the GIN index opclass for anyarray
behave in a way that matches the actual anyarray operators for &&, <@, @>,
and = ... which it failed to do before in assorted corner cases.
This commit fixes the core GIN code and ginarrayprocs.c, updates the
documentation, and adds some simple regression test cases for the new
behaviors using the array operators. The tsearch and contrib GIN opclass
support functions still need to be looked over and probably fixed.
Another thing I intend to fix separately is that this is pretty inefficient
for cases where more than one scan condition needs a full-index search:
we'll run duplicate GinScanEntrys, each one of which builds a large bitmap.
There is some existing logic to merge duplicate GinScanEntrys but it needs
refactoring to make it work for entries belonging to different scan keys.
Note that most of gin.h has been split out into a new file gin_private.h,
so that gin.h doesn't export anything that's not supposed to be used by GIN
opclasses or the rest of the backend. I did quite a bit of other code
beautification work as well, mostly fixing comments and choosing more
appropriate names for things.
2011-01-08 01:16:24 +01:00
|
|
|
|
Redesign tablesample method API, and do extensive code review.
The original implementation of TABLESAMPLE modeled the tablesample method
API on index access methods, which wasn't a good choice because, without
specialized DDL commands, there's no way to build an extension that can
implement a TSM. (Raw inserts into system catalogs are not an acceptable
thing to do, because we can't undo them during DROP EXTENSION, nor will
pg_upgrade behave sanely.) Instead adopt an API more like procedural
language handlers or foreign data wrappers, wherein the only SQL-level
support object needed is a single handler function identified by having
a special return type. This lets us get rid of the supporting catalog
altogether, so that no custom DDL support is needed for the feature.
Adjust the API so that it can support non-constant tablesample arguments
(the original coding assumed we could evaluate the argument expressions at
ExecInitSampleScan time, which is undesirable even if it weren't outright
unsafe), and discourage sampling methods from looking at invisible tuples.
Make sure that the BERNOULLI and SYSTEM methods are genuinely repeatable
within and across queries, as required by the SQL standard, and deal more
honestly with methods that can't support that requirement.
Make a full code-review pass over the tablesample additions, and fix
assorted bugs, omissions, infelicities, and cosmetic issues (such as
failure to put the added code stanzas in a consistent ordering).
Improve EXPLAIN's output of tablesample plans, too.
Back-patch to 9.5 so that we don't have to support the original API
in production.
2015-07-25 20:39:00 +02:00
|
|
|
/* access/tablesample/bernoulli.c */
|
|
|
|
extern Datum tsm_bernoulli_handler(PG_FUNCTION_ARGS);
|
|
|
|
|
|
|
|
/* access/tablesample/system.c */
|
|
|
|
extern Datum tsm_system_handler(PG_FUNCTION_ARGS);
|
|
|
|
|
2007-10-14 01:06:28 +02:00
|
|
|
/* access/transam/twophase.c */
|
|
|
|
extern Datum pg_prepared_xact(PG_FUNCTION_ARGS);
|
|
|
|
|
Improve concurrency of foreign key locking
This patch introduces two additional lock modes for tuples: "SELECT FOR
KEY SHARE" and "SELECT FOR NO KEY UPDATE". These don't block each
other, in contrast with already existing "SELECT FOR SHARE" and "SELECT
FOR UPDATE". UPDATE commands that do not modify the values stored in
the columns that are part of the key of the tuple now grab a SELECT FOR
NO KEY UPDATE lock on the tuple, allowing them to proceed concurrently
with tuple locks of the FOR KEY SHARE variety.
Foreign key triggers now use FOR KEY SHARE instead of FOR SHARE; this
means the concurrency improvement applies to them, which is the whole
point of this patch.
The added tuple lock semantics require some rejiggering of the multixact
module, so that the locking level that each transaction is holding can
be stored alongside its Xid. Also, multixacts now need to persist
across server restarts and crashes, because they can now represent not
only tuple locks, but also tuple updates. This means we need more
careful tracking of lifetime of pg_multixact SLRU files; since they now
persist longer, we require more infrastructure to figure out when they
can be removed. pg_upgrade also needs to be careful to copy
pg_multixact files over from the old server to the new, or at least part
of multixact.c state, depending on the versions of the old and new
servers.
Tuple time qualification rules (HeapTupleSatisfies routines) need to be
careful not to consider tuples with the "is multi" infomask bit set as
being only locked; they might need to look up MultiXact values (i.e.
possibly do pg_multixact I/O) to find out the Xid that updated a tuple,
whereas they previously were assured to only use information readily
available from the tuple header. This is considered acceptable, because
the extra I/O would involve cases that would previously cause some
commands to block waiting for concurrent transactions to finish.
Another important change is the fact that locking tuples that have
previously been updated causes the future versions to be marked as
locked, too; this is essential for correctness of foreign key checks.
This causes additional WAL-logging, also (there was previously a single
WAL record for a locked tuple; now there are as many as updated copies
of the tuple there exist.)
With all this in place, contention related to tuples being checked by
foreign key rules should be much reduced.
As a bonus, the old behavior that a subtransaction grabbing a stronger
tuple lock than the parent (sub)transaction held on a given tuple and
later aborting caused the weaker lock to be lost, has been fixed.
Many new spec files were added for isolation tester framework, to ensure
overall behavior is sane. There's probably room for several more tests.
There were several reviewers of this patch; in particular, Noah Misch
and Andres Freund spent considerable time in it. Original idea for the
patch came from Simon Riggs, after a problem report by Joel Jacobson.
Most code is from me, with contributions from Marti Raudsepp, Alexander
Shulgin, Noah Misch and Andres Freund.
This patch was discussed in several pgsql-hackers threads; the most
important start at the following message-ids:
AANLkTimo9XVcEzfiBR-ut3KVNDkjm2Vxh+t8kAmWjPuv@mail.gmail.com
1290721684-sup-3951@alvh.no-ip.org
1294953201-sup-2099@alvh.no-ip.org
1320343602-sup-2290@alvh.no-ip.org
1339690386-sup-8927@alvh.no-ip.org
4FE5FF020200002500048A3D@gw.wicourts.gov
4FEAB90A0200002500048B7D@gw.wicourts.gov
2013-01-23 16:04:59 +01:00
|
|
|
/* access/transam/multixact.c */
|
|
|
|
extern Datum pg_get_multixact_members(PG_FUNCTION_ARGS);
|
|
|
|
|
Keep track of transaction commit timestamps
Transactions can now set their commit timestamp directly as they commit,
or an external transaction commit timestamp can be fed from an outside
system using the new function TransactionTreeSetCommitTsData(). This
data is crash-safe, and truncated at Xid freeze point, same as pg_clog.
This module is disabled by default because it causes a performance hit,
but can be enabled in postgresql.conf requiring only a server restart.
A new test in src/test/modules is included.
Catalog version bumped due to the new subdirectory within PGDATA and a
couple of new SQL functions.
Authors: Álvaro Herrera and Petr Jelínek
Reviewed to varying degrees by Michael Paquier, Andres Freund, Robert
Haas, Amit Kapila, Fujii Masao, Jaime Casanova, Simon Riggs, Steven
Singer, Peter Eisentraut
2014-12-03 15:53:02 +01:00
|
|
|
/* access/transam/committs.c */
|
|
|
|
extern Datum pg_xact_commit_timestamp(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum pg_last_committed_xact(PG_FUNCTION_ARGS);
|
|
|
|
|
2010-11-18 20:33:48 +01:00
|
|
|
/* catalogs/dependency.c */
|
|
|
|
extern Datum pg_describe_object(PG_FUNCTION_ARGS);
|
2013-03-20 22:19:19 +01:00
|
|
|
extern Datum pg_identify_object(PG_FUNCTION_ARGS);
|
2014-12-30 19:41:50 +01:00
|
|
|
extern Datum pg_identify_object_as_address(PG_FUNCTION_ARGS);
|
2010-11-18 20:33:48 +01:00
|
|
|
|
2014-12-23 19:31:29 +01:00
|
|
|
/* catalog/objectaddress.c */
|
|
|
|
extern Datum pg_get_object_address(PG_FUNCTION_ARGS);
|
|
|
|
|
2009-07-29 22:56:21 +02:00
|
|
|
/* commands/constraint.c */
|
|
|
|
extern Datum unique_key_recheck(PG_FUNCTION_ARGS);
|
|
|
|
|
Add sql_drop event for event triggers
This event takes place just before ddl_command_end, and is fired if and
only if at least one object has been dropped by the command. (For
instance, DROP TABLE IF EXISTS of a table that does not in fact exist
will not lead to such a trigger firing). Commands that drop multiple
objects (such as DROP SCHEMA or DROP OWNED BY) will cause a single event
to fire. Some firings might be surprising, such as
ALTER TABLE DROP COLUMN.
The trigger is fired after the drop has taken place, because that has
been deemed the safest design, to avoid exposing possibly-inconsistent
internal state (system catalogs as well as current transaction) to the
user function code. This means that careful tracking of object
identification is required during the object removal phase.
Like other currently existing events, there is support for tag
filtering.
To support the new event, add a new pg_event_trigger_dropped_objects()
set-returning function, which returns a set of rows comprising the
objects affected by the command. This is to be used within the user
function code, and is mostly modelled after the recently introduced
pg_identify_object() function.
Catalog version bumped due to the new function.
Dimitri Fontaine and Álvaro Herrera
Review by Robert Haas, Tom Lane
2013-03-27 20:02:10 +01:00
|
|
|
/* commands/event_trigger.c */
|
|
|
|
extern Datum pg_event_trigger_dropped_objects(PG_FUNCTION_ARGS);
|
2014-12-07 16:55:28 +01:00
|
|
|
extern Datum pg_event_trigger_table_rewrite_oid(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum pg_event_trigger_table_rewrite_reason(PG_FUNCTION_ARGS);
|
Allow on-the-fly capture of DDL event details
This feature lets user code inspect and take action on DDL events.
Whenever a ddl_command_end event trigger is installed, DDL actions
executed are saved to a list which can be inspected during execution of
a function attached to ddl_command_end.
The set-returning function pg_event_trigger_ddl_commands can be used to
list actions so captured; it returns data about the type of command
executed, as well as the affected object. This is sufficient for many
uses of this feature. For the cases where it is not, we also provide a
"command" column of a new pseudo-type pg_ddl_command, which is a
pointer to a C structure that can be accessed by C code. The struct
contains all the info necessary to completely inspect and even
reconstruct the executed command.
There is no actual deparse code here; that's expected to come later.
What we have is enough infrastructure that the deparsing can be done in
an external extension. The intention is that we will add some deparsing
code in a later release, as an in-core extension.
A new test module is included. It's probably insufficient as is, but it
should be sufficient as a starting point for a more complete and
future-proof approach.
Authors: Álvaro Herrera, with some help from Andres Freund, Ian Barwick,
Abhijit Menon-Sen.
Reviews by Andres Freund, Robert Haas, Amit Kapila, Michael Paquier,
Craig Ringer, David Steele.
Additional input from Chris Browne, Dimitri Fontaine, Stephen Frost,
Petr Jelínek, Tom Lane, Jim Nasby, Steven Singer, Pavel Stěhule.
Based on original work by Dimitri Fontaine, though I didn't use his
code.
Discussion:
https://www.postgresql.org/message-id/m2txrsdzxa.fsf@2ndQuadrant.fr
https://www.postgresql.org/message-id/20131108153322.GU5809@eldon.alvh.no-ip.org
https://www.postgresql.org/message-id/20150215044814.GL3391@alvh.no-ip.org
2015-05-12 00:14:31 +02:00
|
|
|
extern Datum pg_event_trigger_ddl_commands(PG_FUNCTION_ARGS);
|
Add sql_drop event for event triggers
This event takes place just before ddl_command_end, and is fired if and
only if at least one object has been dropped by the command. (For
instance, DROP TABLE IF EXISTS of a table that does not in fact exist
will not lead to such a trigger firing). Commands that drop multiple
objects (such as DROP SCHEMA or DROP OWNED BY) will cause a single event
to fire. Some firings might be surprising, such as
ALTER TABLE DROP COLUMN.
The trigger is fired after the drop has taken place, because that has
been deemed the safest design, to avoid exposing possibly-inconsistent
internal state (system catalogs as well as current transaction) to the
user function code. This means that careful tracking of object
identification is required during the object removal phase.
Like other currently existing events, there is support for tag
filtering.
To support the new event, add a new pg_event_trigger_dropped_objects()
set-returning function, which returns a set of rows comprising the
objects affected by the command. This is to be used within the user
function code, and is mostly modelled after the recently introduced
pg_identify_object() function.
Catalog version bumped due to the new function.
Dimitri Fontaine and Álvaro Herrera
Review by Robert Haas, Tom Lane
2013-03-27 20:02:10 +01:00
|
|
|
|
2011-02-08 22:08:41 +01:00
|
|
|
/* commands/extension.c */
|
|
|
|
extern Datum pg_available_extensions(PG_FUNCTION_ARGS);
|
2011-02-14 22:07:00 +01:00
|
|
|
extern Datum pg_available_extension_versions(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum pg_extension_update_paths(PG_FUNCTION_ARGS);
|
2011-02-08 22:08:41 +01:00
|
|
|
extern Datum pg_extension_config_dump(PG_FUNCTION_ARGS);
|
|
|
|
|
2007-10-14 01:06:28 +02:00
|
|
|
/* commands/prepare.c */
|
|
|
|
extern Datum pg_prepared_statement(PG_FUNCTION_ARGS);
|
|
|
|
|
|
|
|
/* utils/mmgr/portalmem.c */
|
|
|
|
extern Datum pg_cursor(PG_FUNCTION_ARGS);
|
|
|
|
|
2001-11-05 18:46:40 +01:00
|
|
|
#endif /* BUILTINS_H */
|