Header And Logo

PostgreSQL
| The world's most advanced open source database.

Defines | Functions | Variables

builtins.h File Reference

#include "fmgr.h"
#include "nodes/parsenodes.h"
Include dependency graph for builtins.h:

Go to the source code of this file.

Defines

#define CStringGetTextDatum(s)   PointerGetDatum(cstring_to_text(s))
#define TextDatumGetCString(d)   text_to_cstring((text *) DatumGetPointer(d))

Functions

Datum has_any_column_privilege_name_name (PG_FUNCTION_ARGS)
Datum has_any_column_privilege_name_id (PG_FUNCTION_ARGS)
Datum has_any_column_privilege_id_name (PG_FUNCTION_ARGS)
Datum has_any_column_privilege_id_id (PG_FUNCTION_ARGS)
Datum has_any_column_privilege_name (PG_FUNCTION_ARGS)
Datum has_any_column_privilege_id (PG_FUNCTION_ARGS)
Datum has_column_privilege_name_name_name (PG_FUNCTION_ARGS)
Datum has_column_privilege_name_name_attnum (PG_FUNCTION_ARGS)
Datum has_column_privilege_name_id_name (PG_FUNCTION_ARGS)
Datum has_column_privilege_name_id_attnum (PG_FUNCTION_ARGS)
Datum has_column_privilege_id_name_name (PG_FUNCTION_ARGS)
Datum has_column_privilege_id_name_attnum (PG_FUNCTION_ARGS)
Datum has_column_privilege_id_id_name (PG_FUNCTION_ARGS)
Datum has_column_privilege_id_id_attnum (PG_FUNCTION_ARGS)
Datum has_column_privilege_name_name (PG_FUNCTION_ARGS)
Datum has_column_privilege_name_attnum (PG_FUNCTION_ARGS)
Datum has_column_privilege_id_name (PG_FUNCTION_ARGS)
Datum has_column_privilege_id_attnum (PG_FUNCTION_ARGS)
Datum has_table_privilege_name_name (PG_FUNCTION_ARGS)
Datum has_table_privilege_name_id (PG_FUNCTION_ARGS)
Datum has_table_privilege_id_name (PG_FUNCTION_ARGS)
Datum has_table_privilege_id_id (PG_FUNCTION_ARGS)
Datum has_table_privilege_name (PG_FUNCTION_ARGS)
Datum has_table_privilege_id (PG_FUNCTION_ARGS)
Datum has_sequence_privilege_name_name (PG_FUNCTION_ARGS)
Datum has_sequence_privilege_name_id (PG_FUNCTION_ARGS)
Datum has_sequence_privilege_id_name (PG_FUNCTION_ARGS)
Datum has_sequence_privilege_id_id (PG_FUNCTION_ARGS)
Datum has_sequence_privilege_name (PG_FUNCTION_ARGS)
Datum has_sequence_privilege_id (PG_FUNCTION_ARGS)
Datum has_database_privilege_name_name (PG_FUNCTION_ARGS)
Datum has_database_privilege_name_id (PG_FUNCTION_ARGS)
Datum has_database_privilege_id_name (PG_FUNCTION_ARGS)
Datum has_database_privilege_id_id (PG_FUNCTION_ARGS)
Datum has_database_privilege_name (PG_FUNCTION_ARGS)
Datum has_database_privilege_id (PG_FUNCTION_ARGS)
Datum has_foreign_data_wrapper_privilege_name_name (PG_FUNCTION_ARGS)
Datum has_foreign_data_wrapper_privilege_name_id (PG_FUNCTION_ARGS)
Datum has_foreign_data_wrapper_privilege_id_name (PG_FUNCTION_ARGS)
Datum has_foreign_data_wrapper_privilege_id_id (PG_FUNCTION_ARGS)
Datum has_foreign_data_wrapper_privilege_name (PG_FUNCTION_ARGS)
Datum has_foreign_data_wrapper_privilege_id (PG_FUNCTION_ARGS)
Datum has_function_privilege_name_name (PG_FUNCTION_ARGS)
Datum has_function_privilege_name_id (PG_FUNCTION_ARGS)
Datum has_function_privilege_id_name (PG_FUNCTION_ARGS)
Datum has_function_privilege_id_id (PG_FUNCTION_ARGS)
Datum has_function_privilege_name (PG_FUNCTION_ARGS)
Datum has_function_privilege_id (PG_FUNCTION_ARGS)
Datum has_language_privilege_name_name (PG_FUNCTION_ARGS)
Datum has_language_privilege_name_id (PG_FUNCTION_ARGS)
Datum has_language_privilege_id_name (PG_FUNCTION_ARGS)
Datum has_language_privilege_id_id (PG_FUNCTION_ARGS)
Datum has_language_privilege_name (PG_FUNCTION_ARGS)
Datum has_language_privilege_id (PG_FUNCTION_ARGS)
Datum has_schema_privilege_name_name (PG_FUNCTION_ARGS)
Datum has_schema_privilege_name_id (PG_FUNCTION_ARGS)
Datum has_schema_privilege_id_name (PG_FUNCTION_ARGS)
Datum has_schema_privilege_id_id (PG_FUNCTION_ARGS)
Datum has_schema_privilege_name (PG_FUNCTION_ARGS)
Datum has_schema_privilege_id (PG_FUNCTION_ARGS)
Datum has_server_privilege_name_name (PG_FUNCTION_ARGS)
Datum has_server_privilege_name_id (PG_FUNCTION_ARGS)
Datum has_server_privilege_id_name (PG_FUNCTION_ARGS)
Datum has_server_privilege_id_id (PG_FUNCTION_ARGS)
Datum has_server_privilege_name (PG_FUNCTION_ARGS)
Datum has_server_privilege_id (PG_FUNCTION_ARGS)
Datum has_tablespace_privilege_name_name (PG_FUNCTION_ARGS)
Datum has_tablespace_privilege_name_id (PG_FUNCTION_ARGS)
Datum has_tablespace_privilege_id_name (PG_FUNCTION_ARGS)
Datum has_tablespace_privilege_id_id (PG_FUNCTION_ARGS)
Datum has_tablespace_privilege_name (PG_FUNCTION_ARGS)
Datum has_tablespace_privilege_id (PG_FUNCTION_ARGS)
Datum has_type_privilege_name_name (PG_FUNCTION_ARGS)
Datum has_type_privilege_name_id (PG_FUNCTION_ARGS)
Datum has_type_privilege_id_name (PG_FUNCTION_ARGS)
Datum has_type_privilege_id_id (PG_FUNCTION_ARGS)
Datum has_type_privilege_name (PG_FUNCTION_ARGS)
Datum has_type_privilege_id (PG_FUNCTION_ARGS)
Datum pg_has_role_name_name (PG_FUNCTION_ARGS)
Datum pg_has_role_name_id (PG_FUNCTION_ARGS)
Datum pg_has_role_id_name (PG_FUNCTION_ARGS)
Datum pg_has_role_id_id (PG_FUNCTION_ARGS)
Datum pg_has_role_name (PG_FUNCTION_ARGS)
Datum pg_has_role_id (PG_FUNCTION_ARGS)
Datum boolin (PG_FUNCTION_ARGS)
Datum boolout (PG_FUNCTION_ARGS)
Datum boolrecv (PG_FUNCTION_ARGS)
Datum boolsend (PG_FUNCTION_ARGS)
Datum booltext (PG_FUNCTION_ARGS)
Datum booleq (PG_FUNCTION_ARGS)
Datum boolne (PG_FUNCTION_ARGS)
Datum boollt (PG_FUNCTION_ARGS)
Datum boolgt (PG_FUNCTION_ARGS)
Datum boolle (PG_FUNCTION_ARGS)
Datum boolge (PG_FUNCTION_ARGS)
Datum booland_statefunc (PG_FUNCTION_ARGS)
Datum boolor_statefunc (PG_FUNCTION_ARGS)
bool parse_bool (const char *value, bool *result)
bool parse_bool_with_len (const char *value, size_t len, bool *result)
Datum charin (PG_FUNCTION_ARGS)
Datum charout (PG_FUNCTION_ARGS)
Datum charrecv (PG_FUNCTION_ARGS)
Datum charsend (PG_FUNCTION_ARGS)
Datum chareq (PG_FUNCTION_ARGS)
Datum charne (PG_FUNCTION_ARGS)
Datum charlt (PG_FUNCTION_ARGS)
Datum charle (PG_FUNCTION_ARGS)
Datum chargt (PG_FUNCTION_ARGS)
Datum charge (PG_FUNCTION_ARGS)
Datum chartoi4 (PG_FUNCTION_ARGS)
Datum i4tochar (PG_FUNCTION_ARGS)
Datum text_char (PG_FUNCTION_ARGS)
Datum char_text (PG_FUNCTION_ARGS)
Datum domain_in (PG_FUNCTION_ARGS)
Datum domain_recv (PG_FUNCTION_ARGS)
void domain_check (Datum value, bool isnull, Oid domainType, void **extra, MemoryContext mcxt)
int errdatatype (Oid datatypeOid)
int errdomainconstraint (Oid datatypeOid, const char *conname)
Datum binary_encode (PG_FUNCTION_ARGS)
Datum binary_decode (PG_FUNCTION_ARGS)
unsigned hex_encode (const char *src, unsigned len, char *dst)
unsigned hex_decode (const char *src, unsigned len, char *dst)
Datum enum_in (PG_FUNCTION_ARGS)
Datum enum_out (PG_FUNCTION_ARGS)
Datum enum_recv (PG_FUNCTION_ARGS)
Datum enum_send (PG_FUNCTION_ARGS)
Datum enum_lt (PG_FUNCTION_ARGS)
Datum enum_le (PG_FUNCTION_ARGS)
Datum enum_eq (PG_FUNCTION_ARGS)
Datum enum_ne (PG_FUNCTION_ARGS)
Datum enum_ge (PG_FUNCTION_ARGS)
Datum enum_gt (PG_FUNCTION_ARGS)
Datum enum_cmp (PG_FUNCTION_ARGS)
Datum enum_smaller (PG_FUNCTION_ARGS)
Datum enum_larger (PG_FUNCTION_ARGS)
Datum enum_first (PG_FUNCTION_ARGS)
Datum enum_last (PG_FUNCTION_ARGS)
Datum enum_range_bounds (PG_FUNCTION_ARGS)
Datum enum_range_all (PG_FUNCTION_ARGS)
Datum int2in (PG_FUNCTION_ARGS)
Datum int2out (PG_FUNCTION_ARGS)
Datum int2recv (PG_FUNCTION_ARGS)
Datum int2send (PG_FUNCTION_ARGS)
Datum int2vectorin (PG_FUNCTION_ARGS)
Datum int2vectorout (PG_FUNCTION_ARGS)
Datum int2vectorrecv (PG_FUNCTION_ARGS)
Datum int2vectorsend (PG_FUNCTION_ARGS)
Datum int2vectoreq (PG_FUNCTION_ARGS)
Datum int4in (PG_FUNCTION_ARGS)
Datum int4out (PG_FUNCTION_ARGS)
Datum int4recv (PG_FUNCTION_ARGS)
Datum int4send (PG_FUNCTION_ARGS)
Datum i2toi4 (PG_FUNCTION_ARGS)
Datum i4toi2 (PG_FUNCTION_ARGS)
Datum int4_bool (PG_FUNCTION_ARGS)
Datum bool_int4 (PG_FUNCTION_ARGS)
Datum int4eq (PG_FUNCTION_ARGS)
Datum int4ne (PG_FUNCTION_ARGS)
Datum int4lt (PG_FUNCTION_ARGS)
Datum int4le (PG_FUNCTION_ARGS)
Datum int4gt (PG_FUNCTION_ARGS)
Datum int4ge (PG_FUNCTION_ARGS)
Datum int2eq (PG_FUNCTION_ARGS)
Datum int2ne (PG_FUNCTION_ARGS)
Datum int2lt (PG_FUNCTION_ARGS)
Datum int2le (PG_FUNCTION_ARGS)
Datum int2gt (PG_FUNCTION_ARGS)
Datum int2ge (PG_FUNCTION_ARGS)
Datum int24eq (PG_FUNCTION_ARGS)
Datum int24ne (PG_FUNCTION_ARGS)
Datum int24lt (PG_FUNCTION_ARGS)
Datum int24le (PG_FUNCTION_ARGS)
Datum int24gt (PG_FUNCTION_ARGS)
Datum int24ge (PG_FUNCTION_ARGS)
Datum int42eq (PG_FUNCTION_ARGS)
Datum int42ne (PG_FUNCTION_ARGS)
Datum int42lt (PG_FUNCTION_ARGS)
Datum int42le (PG_FUNCTION_ARGS)
Datum int42gt (PG_FUNCTION_ARGS)
Datum int42ge (PG_FUNCTION_ARGS)
Datum int4um (PG_FUNCTION_ARGS)
Datum int4up (PG_FUNCTION_ARGS)
Datum int4pl (PG_FUNCTION_ARGS)
Datum int4mi (PG_FUNCTION_ARGS)
Datum int4mul (PG_FUNCTION_ARGS)
Datum int4div (PG_FUNCTION_ARGS)
Datum int4abs (PG_FUNCTION_ARGS)
Datum int4inc (PG_FUNCTION_ARGS)
Datum int2um (PG_FUNCTION_ARGS)
Datum int2up (PG_FUNCTION_ARGS)
Datum int2pl (PG_FUNCTION_ARGS)
Datum int2mi (PG_FUNCTION_ARGS)
Datum int2mul (PG_FUNCTION_ARGS)
Datum int2div (PG_FUNCTION_ARGS)
Datum int2abs (PG_FUNCTION_ARGS)
Datum int24pl (PG_FUNCTION_ARGS)
Datum int24mi (PG_FUNCTION_ARGS)
Datum int24mul (PG_FUNCTION_ARGS)
Datum int24div (PG_FUNCTION_ARGS)
Datum int42pl (PG_FUNCTION_ARGS)
Datum int42mi (PG_FUNCTION_ARGS)
Datum int42mul (PG_FUNCTION_ARGS)
Datum int42div (PG_FUNCTION_ARGS)
Datum int4mod (PG_FUNCTION_ARGS)
Datum int2mod (PG_FUNCTION_ARGS)
Datum int2larger (PG_FUNCTION_ARGS)
Datum int2smaller (PG_FUNCTION_ARGS)
Datum int4larger (PG_FUNCTION_ARGS)
Datum int4smaller (PG_FUNCTION_ARGS)
Datum int4and (PG_FUNCTION_ARGS)
Datum int4or (PG_FUNCTION_ARGS)
Datum int4xor (PG_FUNCTION_ARGS)
Datum int4not (PG_FUNCTION_ARGS)
Datum int4shl (PG_FUNCTION_ARGS)
Datum int4shr (PG_FUNCTION_ARGS)
Datum int2and (PG_FUNCTION_ARGS)
Datum int2or (PG_FUNCTION_ARGS)
Datum int2xor (PG_FUNCTION_ARGS)
Datum int2not (PG_FUNCTION_ARGS)
Datum int2shl (PG_FUNCTION_ARGS)
Datum int2shr (PG_FUNCTION_ARGS)
Datum generate_series_int4 (PG_FUNCTION_ARGS)
Datum generate_series_step_int4 (PG_FUNCTION_ARGS)
int2vectorbuildint2vector (const int16 *int2s, int n)
Datum namein (PG_FUNCTION_ARGS)
Datum nameout (PG_FUNCTION_ARGS)
Datum namerecv (PG_FUNCTION_ARGS)
Datum namesend (PG_FUNCTION_ARGS)
Datum nameeq (PG_FUNCTION_ARGS)
Datum namene (PG_FUNCTION_ARGS)
Datum namelt (PG_FUNCTION_ARGS)
Datum namele (PG_FUNCTION_ARGS)
Datum namegt (PG_FUNCTION_ARGS)
Datum namege (PG_FUNCTION_ARGS)
int namecpy (Name n1, Name n2)
int namestrcpy (Name name, const char *str)
int namestrcmp (Name name, const char *str)
Datum current_user (PG_FUNCTION_ARGS)
Datum session_user (PG_FUNCTION_ARGS)
Datum current_schema (PG_FUNCTION_ARGS)
Datum current_schemas (PG_FUNCTION_ARGS)
int32 pg_atoi (char *s, int size, int c)
void pg_itoa (int16 i, char *a)
void pg_ltoa (int32 l, char *a)
void pg_lltoa (int64 ll, char *a)
Datum btboolcmp (PG_FUNCTION_ARGS)
Datum btint2cmp (PG_FUNCTION_ARGS)
Datum btint4cmp (PG_FUNCTION_ARGS)
Datum btint8cmp (PG_FUNCTION_ARGS)
Datum btfloat4cmp (PG_FUNCTION_ARGS)
Datum btfloat8cmp (PG_FUNCTION_ARGS)
Datum btint48cmp (PG_FUNCTION_ARGS)
Datum btint84cmp (PG_FUNCTION_ARGS)
Datum btint24cmp (PG_FUNCTION_ARGS)
Datum btint42cmp (PG_FUNCTION_ARGS)
Datum btint28cmp (PG_FUNCTION_ARGS)
Datum btint82cmp (PG_FUNCTION_ARGS)
Datum btfloat48cmp (PG_FUNCTION_ARGS)
Datum btfloat84cmp (PG_FUNCTION_ARGS)
Datum btoidcmp (PG_FUNCTION_ARGS)
Datum btoidvectorcmp (PG_FUNCTION_ARGS)
Datum btabstimecmp (PG_FUNCTION_ARGS)
Datum btreltimecmp (PG_FUNCTION_ARGS)
Datum bttintervalcmp (PG_FUNCTION_ARGS)
Datum btcharcmp (PG_FUNCTION_ARGS)
Datum btnamecmp (PG_FUNCTION_ARGS)
Datum bttextcmp (PG_FUNCTION_ARGS)
Datum btint2sortsupport (PG_FUNCTION_ARGS)
Datum btint4sortsupport (PG_FUNCTION_ARGS)
Datum btint8sortsupport (PG_FUNCTION_ARGS)
Datum btfloat4sortsupport (PG_FUNCTION_ARGS)
Datum btfloat8sortsupport (PG_FUNCTION_ARGS)
Datum btoidsortsupport (PG_FUNCTION_ARGS)
Datum btnamesortsupport (PG_FUNCTION_ARGS)
double get_float8_infinity (void)
float get_float4_infinity (void)
double get_float8_nan (void)
float get_float4_nan (void)
int is_infinite (double val)
Datum float4in (PG_FUNCTION_ARGS)
Datum float4out (PG_FUNCTION_ARGS)
Datum float4recv (PG_FUNCTION_ARGS)
Datum float4send (PG_FUNCTION_ARGS)
Datum float8in (PG_FUNCTION_ARGS)
Datum float8out (PG_FUNCTION_ARGS)
Datum float8recv (PG_FUNCTION_ARGS)
Datum float8send (PG_FUNCTION_ARGS)
Datum float4abs (PG_FUNCTION_ARGS)
Datum float4um (PG_FUNCTION_ARGS)
Datum float4up (PG_FUNCTION_ARGS)
Datum float4larger (PG_FUNCTION_ARGS)
Datum float4smaller (PG_FUNCTION_ARGS)
Datum float8abs (PG_FUNCTION_ARGS)
Datum float8um (PG_FUNCTION_ARGS)
Datum float8up (PG_FUNCTION_ARGS)
Datum float8larger (PG_FUNCTION_ARGS)
Datum float8smaller (PG_FUNCTION_ARGS)
Datum float4pl (PG_FUNCTION_ARGS)
Datum float4mi (PG_FUNCTION_ARGS)
Datum float4mul (PG_FUNCTION_ARGS)
Datum float4div (PG_FUNCTION_ARGS)
Datum float8pl (PG_FUNCTION_ARGS)
Datum float8mi (PG_FUNCTION_ARGS)
Datum float8mul (PG_FUNCTION_ARGS)
Datum float8div (PG_FUNCTION_ARGS)
Datum float4eq (PG_FUNCTION_ARGS)
Datum float4ne (PG_FUNCTION_ARGS)
Datum float4lt (PG_FUNCTION_ARGS)
Datum float4le (PG_FUNCTION_ARGS)
Datum float4gt (PG_FUNCTION_ARGS)
Datum float4ge (PG_FUNCTION_ARGS)
Datum float8eq (PG_FUNCTION_ARGS)
Datum float8ne (PG_FUNCTION_ARGS)
Datum float8lt (PG_FUNCTION_ARGS)
Datum float8le (PG_FUNCTION_ARGS)
Datum float8gt (PG_FUNCTION_ARGS)
Datum float8ge (PG_FUNCTION_ARGS)
Datum ftod (PG_FUNCTION_ARGS)
Datum i4tod (PG_FUNCTION_ARGS)
Datum i2tod (PG_FUNCTION_ARGS)
Datum dtof (PG_FUNCTION_ARGS)
Datum dtoi4 (PG_FUNCTION_ARGS)
Datum dtoi2 (PG_FUNCTION_ARGS)
Datum i4tof (PG_FUNCTION_ARGS)
Datum i2tof (PG_FUNCTION_ARGS)
Datum ftoi4 (PG_FUNCTION_ARGS)
Datum ftoi2 (PG_FUNCTION_ARGS)
Datum dround (PG_FUNCTION_ARGS)
Datum dceil (PG_FUNCTION_ARGS)
Datum dfloor (PG_FUNCTION_ARGS)
Datum dsign (PG_FUNCTION_ARGS)
Datum dtrunc (PG_FUNCTION_ARGS)
Datum dsqrt (PG_FUNCTION_ARGS)
Datum dcbrt (PG_FUNCTION_ARGS)
Datum dpow (PG_FUNCTION_ARGS)
Datum dexp (PG_FUNCTION_ARGS)
Datum dlog1 (PG_FUNCTION_ARGS)
Datum dlog10 (PG_FUNCTION_ARGS)
Datum dacos (PG_FUNCTION_ARGS)
Datum dasin (PG_FUNCTION_ARGS)
Datum datan (PG_FUNCTION_ARGS)
Datum datan2 (PG_FUNCTION_ARGS)
Datum dcos (PG_FUNCTION_ARGS)
Datum dcot (PG_FUNCTION_ARGS)
Datum dsin (PG_FUNCTION_ARGS)
Datum dtan (PG_FUNCTION_ARGS)
Datum degrees (PG_FUNCTION_ARGS)
Datum dpi (PG_FUNCTION_ARGS)
Datum radians (PG_FUNCTION_ARGS)
Datum drandom (PG_FUNCTION_ARGS)
Datum setseed (PG_FUNCTION_ARGS)
Datum float8_accum (PG_FUNCTION_ARGS)
Datum float4_accum (PG_FUNCTION_ARGS)
Datum float8_avg (PG_FUNCTION_ARGS)
Datum float8_var_pop (PG_FUNCTION_ARGS)
Datum float8_var_samp (PG_FUNCTION_ARGS)
Datum float8_stddev_pop (PG_FUNCTION_ARGS)
Datum float8_stddev_samp (PG_FUNCTION_ARGS)
Datum float8_regr_accum (PG_FUNCTION_ARGS)
Datum float8_regr_sxx (PG_FUNCTION_ARGS)
Datum float8_regr_syy (PG_FUNCTION_ARGS)
Datum float8_regr_sxy (PG_FUNCTION_ARGS)
Datum float8_regr_avgx (PG_FUNCTION_ARGS)
Datum float8_regr_avgy (PG_FUNCTION_ARGS)
Datum float8_covar_pop (PG_FUNCTION_ARGS)
Datum float8_covar_samp (PG_FUNCTION_ARGS)
Datum float8_corr (PG_FUNCTION_ARGS)
Datum float8_regr_r2 (PG_FUNCTION_ARGS)
Datum float8_regr_slope (PG_FUNCTION_ARGS)
Datum float8_regr_intercept (PG_FUNCTION_ARGS)
Datum float48pl (PG_FUNCTION_ARGS)
Datum float48mi (PG_FUNCTION_ARGS)
Datum float48mul (PG_FUNCTION_ARGS)
Datum float48div (PG_FUNCTION_ARGS)
Datum float84pl (PG_FUNCTION_ARGS)
Datum float84mi (PG_FUNCTION_ARGS)
Datum float84mul (PG_FUNCTION_ARGS)
Datum float84div (PG_FUNCTION_ARGS)
Datum float48eq (PG_FUNCTION_ARGS)
Datum float48ne (PG_FUNCTION_ARGS)
Datum float48lt (PG_FUNCTION_ARGS)
Datum float48le (PG_FUNCTION_ARGS)
Datum float48gt (PG_FUNCTION_ARGS)
Datum float48ge (PG_FUNCTION_ARGS)
Datum float84eq (PG_FUNCTION_ARGS)
Datum float84ne (PG_FUNCTION_ARGS)
Datum float84lt (PG_FUNCTION_ARGS)
Datum float84le (PG_FUNCTION_ARGS)
Datum float84gt (PG_FUNCTION_ARGS)
Datum float84ge (PG_FUNCTION_ARGS)
Datum width_bucket_float8 (PG_FUNCTION_ARGS)
Datum pg_tablespace_size_oid (PG_FUNCTION_ARGS)
Datum pg_tablespace_size_name (PG_FUNCTION_ARGS)
Datum pg_database_size_oid (PG_FUNCTION_ARGS)
Datum pg_database_size_name (PG_FUNCTION_ARGS)
Datum pg_relation_size (PG_FUNCTION_ARGS)
Datum pg_total_relation_size (PG_FUNCTION_ARGS)
Datum pg_size_pretty (PG_FUNCTION_ARGS)
Datum pg_size_pretty_numeric (PG_FUNCTION_ARGS)
Datum pg_table_size (PG_FUNCTION_ARGS)
Datum pg_indexes_size (PG_FUNCTION_ARGS)
Datum pg_relation_filenode (PG_FUNCTION_ARGS)
Datum pg_relation_filepath (PG_FUNCTION_ARGS)
Datum pg_relation_is_scannable (PG_FUNCTION_ARGS)
bytearead_binary_file (const char *filename, int64 seek_offset, int64 bytes_to_read)
Datum pg_stat_file (PG_FUNCTION_ARGS)
Datum pg_read_file (PG_FUNCTION_ARGS)
Datum pg_read_file_all (PG_FUNCTION_ARGS)
Datum pg_read_binary_file (PG_FUNCTION_ARGS)
Datum pg_read_binary_file_all (PG_FUNCTION_ARGS)
Datum pg_ls_dir (PG_FUNCTION_ARGS)
Datum current_database (PG_FUNCTION_ARGS)
Datum current_query (PG_FUNCTION_ARGS)
Datum pg_cancel_backend (PG_FUNCTION_ARGS)
Datum pg_terminate_backend (PG_FUNCTION_ARGS)
Datum pg_reload_conf (PG_FUNCTION_ARGS)
Datum pg_tablespace_databases (PG_FUNCTION_ARGS)
Datum pg_tablespace_location (PG_FUNCTION_ARGS)
Datum pg_rotate_logfile (PG_FUNCTION_ARGS)
Datum pg_sleep (PG_FUNCTION_ARGS)
Datum pg_get_keywords (PG_FUNCTION_ARGS)
Datum pg_typeof (PG_FUNCTION_ARGS)
Datum pg_collation_for (PG_FUNCTION_ARGS)
Datum pg_view_is_insertable (PG_FUNCTION_ARGS)
Datum pg_view_is_updatable (PG_FUNCTION_ARGS)
Datum oidin (PG_FUNCTION_ARGS)
Datum oidout (PG_FUNCTION_ARGS)
Datum oidrecv (PG_FUNCTION_ARGS)
Datum oidsend (PG_FUNCTION_ARGS)
Datum oideq (PG_FUNCTION_ARGS)
Datum oidne (PG_FUNCTION_ARGS)
Datum oidlt (PG_FUNCTION_ARGS)
Datum oidle (PG_FUNCTION_ARGS)
Datum oidge (PG_FUNCTION_ARGS)
Datum oidgt (PG_FUNCTION_ARGS)
Datum oidlarger (PG_FUNCTION_ARGS)
Datum oidsmaller (PG_FUNCTION_ARGS)
Datum oidvectorin (PG_FUNCTION_ARGS)
Datum oidvectorout (PG_FUNCTION_ARGS)
Datum oidvectorrecv (PG_FUNCTION_ARGS)
Datum oidvectorsend (PG_FUNCTION_ARGS)
Datum oidvectoreq (PG_FUNCTION_ARGS)
Datum oidvectorne (PG_FUNCTION_ARGS)
Datum oidvectorlt (PG_FUNCTION_ARGS)
Datum oidvectorle (PG_FUNCTION_ARGS)
Datum oidvectorge (PG_FUNCTION_ARGS)
Datum oidvectorgt (PG_FUNCTION_ARGS)
oidvectorbuildoidvector (const Oid *oids, int n)
Oid oidparse (Node *node)
Datum cstring_in (PG_FUNCTION_ARGS)
Datum cstring_out (PG_FUNCTION_ARGS)
Datum cstring_recv (PG_FUNCTION_ARGS)
Datum cstring_send (PG_FUNCTION_ARGS)
Datum any_in (PG_FUNCTION_ARGS)
Datum any_out (PG_FUNCTION_ARGS)
Datum anyarray_in (PG_FUNCTION_ARGS)
Datum anyarray_out (PG_FUNCTION_ARGS)
Datum anyarray_recv (PG_FUNCTION_ARGS)
Datum anyarray_send (PG_FUNCTION_ARGS)
Datum anynonarray_in (PG_FUNCTION_ARGS)
Datum anynonarray_out (PG_FUNCTION_ARGS)
Datum anyenum_in (PG_FUNCTION_ARGS)
Datum anyenum_out (PG_FUNCTION_ARGS)
Datum anyrange_in (PG_FUNCTION_ARGS)
Datum anyrange_out (PG_FUNCTION_ARGS)
Datum void_in (PG_FUNCTION_ARGS)
Datum void_out (PG_FUNCTION_ARGS)
Datum void_recv (PG_FUNCTION_ARGS)
Datum void_send (PG_FUNCTION_ARGS)
Datum trigger_in (PG_FUNCTION_ARGS)
Datum trigger_out (PG_FUNCTION_ARGS)
Datum event_trigger_in (PG_FUNCTION_ARGS)
Datum event_trigger_out (PG_FUNCTION_ARGS)
Datum language_handler_in (PG_FUNCTION_ARGS)
Datum language_handler_out (PG_FUNCTION_ARGS)
Datum fdw_handler_in (PG_FUNCTION_ARGS)
Datum fdw_handler_out (PG_FUNCTION_ARGS)
Datum internal_in (PG_FUNCTION_ARGS)
Datum internal_out (PG_FUNCTION_ARGS)
Datum opaque_in (PG_FUNCTION_ARGS)
Datum opaque_out (PG_FUNCTION_ARGS)
Datum anyelement_in (PG_FUNCTION_ARGS)
Datum anyelement_out (PG_FUNCTION_ARGS)
Datum shell_in (PG_FUNCTION_ARGS)
Datum shell_out (PG_FUNCTION_ARGS)
Datum pg_node_tree_in (PG_FUNCTION_ARGS)
Datum pg_node_tree_out (PG_FUNCTION_ARGS)
Datum pg_node_tree_recv (PG_FUNCTION_ARGS)
Datum pg_node_tree_send (PG_FUNCTION_ARGS)
Datum nameregexeq (PG_FUNCTION_ARGS)
Datum nameregexne (PG_FUNCTION_ARGS)
Datum textregexeq (PG_FUNCTION_ARGS)
Datum textregexne (PG_FUNCTION_ARGS)
Datum nameicregexeq (PG_FUNCTION_ARGS)
Datum nameicregexne (PG_FUNCTION_ARGS)
Datum texticregexeq (PG_FUNCTION_ARGS)
Datum texticregexne (PG_FUNCTION_ARGS)
Datum textregexsubstr (PG_FUNCTION_ARGS)
Datum textregexreplace_noopt (PG_FUNCTION_ARGS)
Datum textregexreplace (PG_FUNCTION_ARGS)
Datum similar_escape (PG_FUNCTION_ARGS)
Datum regexp_matches (PG_FUNCTION_ARGS)
Datum regexp_matches_no_flags (PG_FUNCTION_ARGS)
Datum regexp_split_to_table (PG_FUNCTION_ARGS)
Datum regexp_split_to_table_no_flags (PG_FUNCTION_ARGS)
Datum regexp_split_to_array (PG_FUNCTION_ARGS)
Datum regexp_split_to_array_no_flags (PG_FUNCTION_ARGS)
char * regexp_fixed_prefix (text *text_re, bool case_insensitive, Oid collation, bool *exact)
Datum regprocin (PG_FUNCTION_ARGS)
Datum regprocout (PG_FUNCTION_ARGS)
Datum regprocrecv (PG_FUNCTION_ARGS)
Datum regprocsend (PG_FUNCTION_ARGS)
Datum regprocedurein (PG_FUNCTION_ARGS)
Datum regprocedureout (PG_FUNCTION_ARGS)
Datum regprocedurerecv (PG_FUNCTION_ARGS)
Datum regproceduresend (PG_FUNCTION_ARGS)
Datum regoperin (PG_FUNCTION_ARGS)
Datum regoperout (PG_FUNCTION_ARGS)
Datum regoperrecv (PG_FUNCTION_ARGS)
Datum regopersend (PG_FUNCTION_ARGS)
Datum regoperatorin (PG_FUNCTION_ARGS)
Datum regoperatorout (PG_FUNCTION_ARGS)
Datum regoperatorrecv (PG_FUNCTION_ARGS)
Datum regoperatorsend (PG_FUNCTION_ARGS)
Datum regclassin (PG_FUNCTION_ARGS)
Datum regclassout (PG_FUNCTION_ARGS)
Datum regclassrecv (PG_FUNCTION_ARGS)
Datum regclasssend (PG_FUNCTION_ARGS)
Datum regtypein (PG_FUNCTION_ARGS)
Datum regtypeout (PG_FUNCTION_ARGS)
Datum regtyperecv (PG_FUNCTION_ARGS)
Datum regtypesend (PG_FUNCTION_ARGS)
Datum regconfigin (PG_FUNCTION_ARGS)
Datum regconfigout (PG_FUNCTION_ARGS)
Datum regconfigrecv (PG_FUNCTION_ARGS)
Datum regconfigsend (PG_FUNCTION_ARGS)
Datum regdictionaryin (PG_FUNCTION_ARGS)
Datum regdictionaryout (PG_FUNCTION_ARGS)
Datum regdictionaryrecv (PG_FUNCTION_ARGS)
Datum regdictionarysend (PG_FUNCTION_ARGS)
Datum text_regclass (PG_FUNCTION_ARGS)
ListstringToQualifiedNameList (const char *string)
char * format_procedure (Oid procedure_oid)
char * format_procedure_qualified (Oid procedure_oid)
char * format_operator (Oid operator_oid)
char * format_operator_qualified (Oid operator_oid)
Datum record_in (PG_FUNCTION_ARGS)
Datum record_out (PG_FUNCTION_ARGS)
Datum record_recv (PG_FUNCTION_ARGS)
Datum record_send (PG_FUNCTION_ARGS)
Datum record_eq (PG_FUNCTION_ARGS)
Datum record_ne (PG_FUNCTION_ARGS)
Datum record_lt (PG_FUNCTION_ARGS)
Datum record_gt (PG_FUNCTION_ARGS)
Datum record_le (PG_FUNCTION_ARGS)
Datum record_ge (PG_FUNCTION_ARGS)
Datum btrecordcmp (PG_FUNCTION_ARGS)
Datum pg_get_ruledef (PG_FUNCTION_ARGS)
Datum pg_get_ruledef_ext (PG_FUNCTION_ARGS)
Datum pg_get_viewdef (PG_FUNCTION_ARGS)
Datum pg_get_viewdef_ext (PG_FUNCTION_ARGS)
Datum pg_get_viewdef_wrap (PG_FUNCTION_ARGS)
Datum pg_get_viewdef_name (PG_FUNCTION_ARGS)
Datum pg_get_viewdef_name_ext (PG_FUNCTION_ARGS)
Datum pg_get_indexdef (PG_FUNCTION_ARGS)
Datum pg_get_indexdef_ext (PG_FUNCTION_ARGS)
char * pg_get_indexdef_string (Oid indexrelid)
char * pg_get_indexdef_columns (Oid indexrelid, bool pretty)
Datum pg_get_triggerdef (PG_FUNCTION_ARGS)
Datum pg_get_triggerdef_ext (PG_FUNCTION_ARGS)
Datum pg_get_constraintdef (PG_FUNCTION_ARGS)
Datum pg_get_constraintdef_ext (PG_FUNCTION_ARGS)
char * pg_get_constraintdef_string (Oid constraintId)
Datum pg_get_expr (PG_FUNCTION_ARGS)
Datum pg_get_expr_ext (PG_FUNCTION_ARGS)
Datum pg_get_userbyid (PG_FUNCTION_ARGS)
Datum pg_get_serial_sequence (PG_FUNCTION_ARGS)
Datum pg_get_functiondef (PG_FUNCTION_ARGS)
Datum pg_get_function_arguments (PG_FUNCTION_ARGS)
Datum pg_get_function_identity_arguments (PG_FUNCTION_ARGS)
Datum pg_get_function_result (PG_FUNCTION_ARGS)
char * deparse_expression (Node *expr, List *dpcontext, bool forceprefix, bool showimplicit)
Listdeparse_context_for (const char *aliasname, Oid relid)
Listdeparse_context_for_planstate (Node *planstate, List *ancestors, List *rtable, List *rtable_names)
Listselect_rtable_names_for_explain (List *rtable, Bitmapset *rels_used)
const char * quote_identifier (const char *ident)
char * quote_qualified_identifier (const char *qualifier, const char *ident)
char * generate_collation_name (Oid collid)
Datum tidin (PG_FUNCTION_ARGS)
Datum tidout (PG_FUNCTION_ARGS)
Datum tidrecv (PG_FUNCTION_ARGS)
Datum tidsend (PG_FUNCTION_ARGS)
Datum tideq (PG_FUNCTION_ARGS)
Datum tidne (PG_FUNCTION_ARGS)
Datum tidlt (PG_FUNCTION_ARGS)
Datum tidle (PG_FUNCTION_ARGS)
Datum tidgt (PG_FUNCTION_ARGS)
Datum tidge (PG_FUNCTION_ARGS)
Datum bttidcmp (PG_FUNCTION_ARGS)
Datum tidlarger (PG_FUNCTION_ARGS)
Datum tidsmaller (PG_FUNCTION_ARGS)
Datum currtid_byreloid (PG_FUNCTION_ARGS)
Datum currtid_byrelname (PG_FUNCTION_ARGS)
Datum bpcharin (PG_FUNCTION_ARGS)
Datum bpcharout (PG_FUNCTION_ARGS)
Datum bpcharrecv (PG_FUNCTION_ARGS)
Datum bpcharsend (PG_FUNCTION_ARGS)
Datum bpchartypmodin (PG_FUNCTION_ARGS)
Datum bpchartypmodout (PG_FUNCTION_ARGS)
Datum bpchar (PG_FUNCTION_ARGS)
Datum char_bpchar (PG_FUNCTION_ARGS)
Datum name_bpchar (PG_FUNCTION_ARGS)
Datum bpchar_name (PG_FUNCTION_ARGS)
Datum bpchareq (PG_FUNCTION_ARGS)
Datum bpcharne (PG_FUNCTION_ARGS)
Datum bpcharlt (PG_FUNCTION_ARGS)
Datum bpcharle (PG_FUNCTION_ARGS)
Datum bpchargt (PG_FUNCTION_ARGS)
Datum bpcharge (PG_FUNCTION_ARGS)
Datum bpcharcmp (PG_FUNCTION_ARGS)
Datum bpchar_larger (PG_FUNCTION_ARGS)
Datum bpchar_smaller (PG_FUNCTION_ARGS)
Datum bpcharlen (PG_FUNCTION_ARGS)
Datum bpcharoctetlen (PG_FUNCTION_ARGS)
Datum hashbpchar (PG_FUNCTION_ARGS)
Datum bpchar_pattern_lt (PG_FUNCTION_ARGS)
Datum bpchar_pattern_le (PG_FUNCTION_ARGS)
Datum bpchar_pattern_gt (PG_FUNCTION_ARGS)
Datum bpchar_pattern_ge (PG_FUNCTION_ARGS)
Datum btbpchar_pattern_cmp (PG_FUNCTION_ARGS)
Datum varcharin (PG_FUNCTION_ARGS)
Datum varcharout (PG_FUNCTION_ARGS)
Datum varcharrecv (PG_FUNCTION_ARGS)
Datum varcharsend (PG_FUNCTION_ARGS)
Datum varchartypmodin (PG_FUNCTION_ARGS)
Datum varchartypmodout (PG_FUNCTION_ARGS)
Datum varchar_transform (PG_FUNCTION_ARGS)
Datum varchar (PG_FUNCTION_ARGS)
textcstring_to_text (const char *s)
textcstring_to_text_with_len (const char *s, int len)
char * text_to_cstring (const text *t)
void text_to_cstring_buffer (const text *src, char *dst, size_t dst_len)
Datum textin (PG_FUNCTION_ARGS)
Datum textout (PG_FUNCTION_ARGS)
Datum textrecv (PG_FUNCTION_ARGS)
Datum textsend (PG_FUNCTION_ARGS)
Datum textcat (PG_FUNCTION_ARGS)
Datum texteq (PG_FUNCTION_ARGS)
Datum textne (PG_FUNCTION_ARGS)
Datum text_lt (PG_FUNCTION_ARGS)
Datum text_le (PG_FUNCTION_ARGS)
Datum text_gt (PG_FUNCTION_ARGS)
Datum text_ge (PG_FUNCTION_ARGS)
Datum text_larger (PG_FUNCTION_ARGS)
Datum text_smaller (PG_FUNCTION_ARGS)
Datum text_pattern_lt (PG_FUNCTION_ARGS)
Datum text_pattern_le (PG_FUNCTION_ARGS)
Datum text_pattern_gt (PG_FUNCTION_ARGS)
Datum text_pattern_ge (PG_FUNCTION_ARGS)
Datum bttext_pattern_cmp (PG_FUNCTION_ARGS)
Datum textlen (PG_FUNCTION_ARGS)
Datum textoctetlen (PG_FUNCTION_ARGS)
Datum textpos (PG_FUNCTION_ARGS)
Datum text_substr (PG_FUNCTION_ARGS)
Datum text_substr_no_len (PG_FUNCTION_ARGS)
Datum textoverlay (PG_FUNCTION_ARGS)
Datum textoverlay_no_len (PG_FUNCTION_ARGS)
Datum name_text (PG_FUNCTION_ARGS)
Datum text_name (PG_FUNCTION_ARGS)
int varstr_cmp (char *arg1, int len1, char *arg2, int len2, Oid collid)
ListtextToQualifiedNameList (text *textval)
bool SplitIdentifierString (char *rawstring, char separator, List **namelist)
bool SplitDirectoriesString (char *rawstring, char separator, List **namelist)
Datum replace_text (PG_FUNCTION_ARGS)
textreplace_text_regexp (text *src_text, void *regexp, text *replace_text, bool glob)
Datum split_text (PG_FUNCTION_ARGS)
Datum text_to_array (PG_FUNCTION_ARGS)
Datum array_to_text (PG_FUNCTION_ARGS)
Datum text_to_array_null (PG_FUNCTION_ARGS)
Datum array_to_text_null (PG_FUNCTION_ARGS)
Datum to_hex32 (PG_FUNCTION_ARGS)
Datum to_hex64 (PG_FUNCTION_ARGS)
Datum md5_text (PG_FUNCTION_ARGS)
Datum md5_bytea (PG_FUNCTION_ARGS)
Datum unknownin (PG_FUNCTION_ARGS)
Datum unknownout (PG_FUNCTION_ARGS)
Datum unknownrecv (PG_FUNCTION_ARGS)
Datum unknownsend (PG_FUNCTION_ARGS)
Datum pg_column_size (PG_FUNCTION_ARGS)
Datum bytea_string_agg_transfn (PG_FUNCTION_ARGS)
Datum bytea_string_agg_finalfn (PG_FUNCTION_ARGS)
Datum string_agg_transfn (PG_FUNCTION_ARGS)
Datum string_agg_finalfn (PG_FUNCTION_ARGS)
Datum text_concat (PG_FUNCTION_ARGS)
Datum text_concat_ws (PG_FUNCTION_ARGS)
Datum text_left (PG_FUNCTION_ARGS)
Datum text_right (PG_FUNCTION_ARGS)
Datum text_reverse (PG_FUNCTION_ARGS)
Datum text_format (PG_FUNCTION_ARGS)
Datum text_format_nv (PG_FUNCTION_ARGS)
Datum pgsql_version (PG_FUNCTION_ARGS)
Datum xidin (PG_FUNCTION_ARGS)
Datum xidout (PG_FUNCTION_ARGS)
Datum xidrecv (PG_FUNCTION_ARGS)
Datum xidsend (PG_FUNCTION_ARGS)
Datum xideq (PG_FUNCTION_ARGS)
Datum xid_age (PG_FUNCTION_ARGS)
int xidComparator (const void *arg1, const void *arg2)
Datum cidin (PG_FUNCTION_ARGS)
Datum cidout (PG_FUNCTION_ARGS)
Datum cidrecv (PG_FUNCTION_ARGS)
Datum cidsend (PG_FUNCTION_ARGS)
Datum cideq (PG_FUNCTION_ARGS)
Datum namelike (PG_FUNCTION_ARGS)
Datum namenlike (PG_FUNCTION_ARGS)
Datum nameiclike (PG_FUNCTION_ARGS)
Datum nameicnlike (PG_FUNCTION_ARGS)
Datum textlike (PG_FUNCTION_ARGS)
Datum textnlike (PG_FUNCTION_ARGS)
Datum texticlike (PG_FUNCTION_ARGS)
Datum texticnlike (PG_FUNCTION_ARGS)
Datum bytealike (PG_FUNCTION_ARGS)
Datum byteanlike (PG_FUNCTION_ARGS)
Datum like_escape (PG_FUNCTION_ARGS)
Datum like_escape_bytea (PG_FUNCTION_ARGS)
Datum lower (PG_FUNCTION_ARGS)
Datum upper (PG_FUNCTION_ARGS)
Datum initcap (PG_FUNCTION_ARGS)
Datum lpad (PG_FUNCTION_ARGS)
Datum rpad (PG_FUNCTION_ARGS)
Datum btrim (PG_FUNCTION_ARGS)
Datum btrim1 (PG_FUNCTION_ARGS)
Datum byteatrim (PG_FUNCTION_ARGS)
Datum ltrim (PG_FUNCTION_ARGS)
Datum ltrim1 (PG_FUNCTION_ARGS)
Datum rtrim (PG_FUNCTION_ARGS)
Datum rtrim1 (PG_FUNCTION_ARGS)
Datum translate (PG_FUNCTION_ARGS)
Datum chr (PG_FUNCTION_ARGS)
Datum repeat (PG_FUNCTION_ARGS)
Datum ascii (PG_FUNCTION_ARGS)
char * inet_cidr_ntop (int af, const void *src, int bits, char *dst, size_t size)
int inet_net_pton (int af, const char *src, void *dst, size_t size)
Datum inet_in (PG_FUNCTION_ARGS)
Datum inet_out (PG_FUNCTION_ARGS)
Datum inet_recv (PG_FUNCTION_ARGS)
Datum inet_send (PG_FUNCTION_ARGS)
Datum cidr_in (PG_FUNCTION_ARGS)
Datum cidr_out (PG_FUNCTION_ARGS)
Datum cidr_recv (PG_FUNCTION_ARGS)
Datum cidr_send (PG_FUNCTION_ARGS)
Datum network_cmp (PG_FUNCTION_ARGS)
Datum network_lt (PG_FUNCTION_ARGS)
Datum network_le (PG_FUNCTION_ARGS)
Datum network_eq (PG_FUNCTION_ARGS)
Datum network_ge (PG_FUNCTION_ARGS)
Datum network_gt (PG_FUNCTION_ARGS)
Datum network_ne (PG_FUNCTION_ARGS)
Datum hashinet (PG_FUNCTION_ARGS)
Datum network_sub (PG_FUNCTION_ARGS)
Datum network_subeq (PG_FUNCTION_ARGS)
Datum network_sup (PG_FUNCTION_ARGS)
Datum network_supeq (PG_FUNCTION_ARGS)
Datum network_network (PG_FUNCTION_ARGS)
Datum network_netmask (PG_FUNCTION_ARGS)
Datum network_hostmask (PG_FUNCTION_ARGS)
Datum network_masklen (PG_FUNCTION_ARGS)
Datum network_family (PG_FUNCTION_ARGS)
Datum network_broadcast (PG_FUNCTION_ARGS)
Datum network_host (PG_FUNCTION_ARGS)
Datum network_show (PG_FUNCTION_ARGS)
Datum inet_abbrev (PG_FUNCTION_ARGS)
Datum cidr_abbrev (PG_FUNCTION_ARGS)
double convert_network_to_scalar (Datum value, Oid typid)
Datum inet_to_cidr (PG_FUNCTION_ARGS)
Datum inet_set_masklen (PG_FUNCTION_ARGS)
Datum cidr_set_masklen (PG_FUNCTION_ARGS)
Datum network_scan_first (Datum in)
Datum network_scan_last (Datum in)
Datum inet_client_addr (PG_FUNCTION_ARGS)
Datum inet_client_port (PG_FUNCTION_ARGS)
Datum inet_server_addr (PG_FUNCTION_ARGS)
Datum inet_server_port (PG_FUNCTION_ARGS)
Datum inetnot (PG_FUNCTION_ARGS)
Datum inetand (PG_FUNCTION_ARGS)
Datum inetor (PG_FUNCTION_ARGS)
Datum inetpl (PG_FUNCTION_ARGS)
Datum inetmi_int8 (PG_FUNCTION_ARGS)
Datum inetmi (PG_FUNCTION_ARGS)
void clean_ipv6_addr (int addr_family, char *addr)
Datum macaddr_in (PG_FUNCTION_ARGS)
Datum macaddr_out (PG_FUNCTION_ARGS)
Datum macaddr_recv (PG_FUNCTION_ARGS)
Datum macaddr_send (PG_FUNCTION_ARGS)
Datum macaddr_cmp (PG_FUNCTION_ARGS)
Datum macaddr_lt (PG_FUNCTION_ARGS)
Datum macaddr_le (PG_FUNCTION_ARGS)
Datum macaddr_eq (PG_FUNCTION_ARGS)
Datum macaddr_ge (PG_FUNCTION_ARGS)
Datum macaddr_gt (PG_FUNCTION_ARGS)
Datum macaddr_ne (PG_FUNCTION_ARGS)
Datum macaddr_not (PG_FUNCTION_ARGS)
Datum macaddr_and (PG_FUNCTION_ARGS)
Datum macaddr_or (PG_FUNCTION_ARGS)
Datum macaddr_trunc (PG_FUNCTION_ARGS)
Datum hashmacaddr (PG_FUNCTION_ARGS)
Datum numeric_in (PG_FUNCTION_ARGS)
Datum numeric_out (PG_FUNCTION_ARGS)
Datum numeric_recv (PG_FUNCTION_ARGS)
Datum numeric_send (PG_FUNCTION_ARGS)
Datum numerictypmodin (PG_FUNCTION_ARGS)
Datum numerictypmodout (PG_FUNCTION_ARGS)
Datum numeric_transform (PG_FUNCTION_ARGS)
Datum numeric (PG_FUNCTION_ARGS)
Datum numeric_abs (PG_FUNCTION_ARGS)
Datum numeric_uminus (PG_FUNCTION_ARGS)
Datum numeric_uplus (PG_FUNCTION_ARGS)
Datum numeric_sign (PG_FUNCTION_ARGS)
Datum numeric_round (PG_FUNCTION_ARGS)
Datum numeric_trunc (PG_FUNCTION_ARGS)
Datum numeric_ceil (PG_FUNCTION_ARGS)
Datum numeric_floor (PG_FUNCTION_ARGS)
Datum numeric_cmp (PG_FUNCTION_ARGS)
Datum numeric_eq (PG_FUNCTION_ARGS)
Datum numeric_ne (PG_FUNCTION_ARGS)
Datum numeric_gt (PG_FUNCTION_ARGS)
Datum numeric_ge (PG_FUNCTION_ARGS)
Datum numeric_lt (PG_FUNCTION_ARGS)
Datum numeric_le (PG_FUNCTION_ARGS)
Datum numeric_add (PG_FUNCTION_ARGS)
Datum numeric_sub (PG_FUNCTION_ARGS)
Datum numeric_mul (PG_FUNCTION_ARGS)
Datum numeric_div (PG_FUNCTION_ARGS)
Datum numeric_div_trunc (PG_FUNCTION_ARGS)
Datum numeric_mod (PG_FUNCTION_ARGS)
Datum numeric_inc (PG_FUNCTION_ARGS)
Datum numeric_smaller (PG_FUNCTION_ARGS)
Datum numeric_larger (PG_FUNCTION_ARGS)
Datum numeric_fac (PG_FUNCTION_ARGS)
Datum numeric_sqrt (PG_FUNCTION_ARGS)
Datum numeric_exp (PG_FUNCTION_ARGS)
Datum numeric_ln (PG_FUNCTION_ARGS)
Datum numeric_log (PG_FUNCTION_ARGS)
Datum numeric_power (PG_FUNCTION_ARGS)
Datum int4_numeric (PG_FUNCTION_ARGS)
Datum numeric_int4 (PG_FUNCTION_ARGS)
Datum int8_numeric (PG_FUNCTION_ARGS)
Datum numeric_int8 (PG_FUNCTION_ARGS)
Datum int2_numeric (PG_FUNCTION_ARGS)
Datum numeric_int2 (PG_FUNCTION_ARGS)
Datum float8_numeric (PG_FUNCTION_ARGS)
Datum numeric_float8 (PG_FUNCTION_ARGS)
Datum numeric_float8_no_overflow (PG_FUNCTION_ARGS)
Datum float4_numeric (PG_FUNCTION_ARGS)
Datum numeric_float4 (PG_FUNCTION_ARGS)
Datum numeric_accum (PG_FUNCTION_ARGS)
Datum numeric_avg_accum (PG_FUNCTION_ARGS)
Datum int2_accum (PG_FUNCTION_ARGS)
Datum int4_accum (PG_FUNCTION_ARGS)
Datum int8_accum (PG_FUNCTION_ARGS)
Datum int8_avg_accum (PG_FUNCTION_ARGS)
Datum numeric_avg (PG_FUNCTION_ARGS)
Datum numeric_var_pop (PG_FUNCTION_ARGS)
Datum numeric_var_samp (PG_FUNCTION_ARGS)
Datum numeric_stddev_pop (PG_FUNCTION_ARGS)
Datum numeric_stddev_samp (PG_FUNCTION_ARGS)
Datum int2_sum (PG_FUNCTION_ARGS)
Datum int4_sum (PG_FUNCTION_ARGS)
Datum int8_sum (PG_FUNCTION_ARGS)
Datum int2_avg_accum (PG_FUNCTION_ARGS)
Datum int4_avg_accum (PG_FUNCTION_ARGS)
Datum int8_avg (PG_FUNCTION_ARGS)
Datum width_bucket_numeric (PG_FUNCTION_ARGS)
Datum hash_numeric (PG_FUNCTION_ARGS)
Datum RI_FKey_check_ins (PG_FUNCTION_ARGS)
Datum RI_FKey_check_upd (PG_FUNCTION_ARGS)
Datum RI_FKey_noaction_del (PG_FUNCTION_ARGS)
Datum RI_FKey_noaction_upd (PG_FUNCTION_ARGS)
Datum RI_FKey_cascade_del (PG_FUNCTION_ARGS)
Datum RI_FKey_cascade_upd (PG_FUNCTION_ARGS)
Datum RI_FKey_restrict_del (PG_FUNCTION_ARGS)
Datum RI_FKey_restrict_upd (PG_FUNCTION_ARGS)
Datum RI_FKey_setnull_del (PG_FUNCTION_ARGS)
Datum RI_FKey_setnull_upd (PG_FUNCTION_ARGS)
Datum RI_FKey_setdefault_del (PG_FUNCTION_ARGS)
Datum RI_FKey_setdefault_upd (PG_FUNCTION_ARGS)
Datum suppress_redundant_updates_trigger (PG_FUNCTION_ARGS)
Datum getdatabaseencoding (PG_FUNCTION_ARGS)
Datum database_character_set (PG_FUNCTION_ARGS)
Datum pg_client_encoding (PG_FUNCTION_ARGS)
Datum PG_encoding_to_char (PG_FUNCTION_ARGS)
Datum PG_char_to_encoding (PG_FUNCTION_ARGS)
Datum PG_character_set_name (PG_FUNCTION_ARGS)
Datum PG_character_set_id (PG_FUNCTION_ARGS)
Datum pg_convert (PG_FUNCTION_ARGS)
Datum pg_convert_to (PG_FUNCTION_ARGS)
Datum pg_convert_from (PG_FUNCTION_ARGS)
Datum length_in_encoding (PG_FUNCTION_ARGS)
Datum pg_encoding_max_length_sql (PG_FUNCTION_ARGS)
Datum format_type (PG_FUNCTION_ARGS)
char * format_type_be (Oid type_oid)
char * format_type_be_qualified (Oid type_oid)
char * format_type_with_typemod (Oid type_oid, int32 typemod)
Datum oidvectortypes (PG_FUNCTION_ARGS)
int32 type_maximum_size (Oid type_oid, int32 typemod)
Datum quote_ident (PG_FUNCTION_ARGS)
Datum quote_literal (PG_FUNCTION_ARGS)
char * quote_literal_cstr (const char *rawstr)
Datum quote_nullable (PG_FUNCTION_ARGS)
Datum show_config_by_name (PG_FUNCTION_ARGS)
Datum set_config_by_name (PG_FUNCTION_ARGS)
Datum show_all_settings (PG_FUNCTION_ARGS)
Datum pg_lock_status (PG_FUNCTION_ARGS)
Datum pg_advisory_lock_int8 (PG_FUNCTION_ARGS)
Datum pg_advisory_xact_lock_int8 (PG_FUNCTION_ARGS)
Datum pg_advisory_lock_shared_int8 (PG_FUNCTION_ARGS)
Datum pg_advisory_xact_lock_shared_int8 (PG_FUNCTION_ARGS)
Datum pg_try_advisory_lock_int8 (PG_FUNCTION_ARGS)
Datum pg_try_advisory_xact_lock_int8 (PG_FUNCTION_ARGS)
Datum pg_try_advisory_lock_shared_int8 (PG_FUNCTION_ARGS)
Datum pg_try_advisory_xact_lock_shared_int8 (PG_FUNCTION_ARGS)
Datum pg_advisory_unlock_int8 (PG_FUNCTION_ARGS)
Datum pg_advisory_unlock_shared_int8 (PG_FUNCTION_ARGS)
Datum pg_advisory_lock_int4 (PG_FUNCTION_ARGS)
Datum pg_advisory_xact_lock_int4 (PG_FUNCTION_ARGS)
Datum pg_advisory_lock_shared_int4 (PG_FUNCTION_ARGS)
Datum pg_advisory_xact_lock_shared_int4 (PG_FUNCTION_ARGS)
Datum pg_try_advisory_lock_int4 (PG_FUNCTION_ARGS)
Datum pg_try_advisory_xact_lock_int4 (PG_FUNCTION_ARGS)
Datum pg_try_advisory_lock_shared_int4 (PG_FUNCTION_ARGS)
Datum pg_try_advisory_xact_lock_shared_int4 (PG_FUNCTION_ARGS)
Datum pg_advisory_unlock_int4 (PG_FUNCTION_ARGS)
Datum pg_advisory_unlock_shared_int4 (PG_FUNCTION_ARGS)
Datum pg_advisory_unlock_all (PG_FUNCTION_ARGS)
Datum txid_snapshot_in (PG_FUNCTION_ARGS)
Datum txid_snapshot_out (PG_FUNCTION_ARGS)
Datum txid_snapshot_recv (PG_FUNCTION_ARGS)
Datum txid_snapshot_send (PG_FUNCTION_ARGS)
Datum txid_current (PG_FUNCTION_ARGS)
Datum txid_current_snapshot (PG_FUNCTION_ARGS)
Datum txid_snapshot_xmin (PG_FUNCTION_ARGS)
Datum txid_snapshot_xmax (PG_FUNCTION_ARGS)
Datum txid_snapshot_xip (PG_FUNCTION_ARGS)
Datum txid_visible_in_snapshot (PG_FUNCTION_ARGS)
Datum uuid_in (PG_FUNCTION_ARGS)
Datum uuid_out (PG_FUNCTION_ARGS)
Datum uuid_send (PG_FUNCTION_ARGS)
Datum uuid_recv (PG_FUNCTION_ARGS)
Datum uuid_lt (PG_FUNCTION_ARGS)
Datum uuid_le (PG_FUNCTION_ARGS)
Datum uuid_eq (PG_FUNCTION_ARGS)
Datum uuid_ge (PG_FUNCTION_ARGS)
Datum uuid_gt (PG_FUNCTION_ARGS)
Datum uuid_ne (PG_FUNCTION_ARGS)
Datum uuid_cmp (PG_FUNCTION_ARGS)
Datum uuid_hash (PG_FUNCTION_ARGS)
Datum window_row_number (PG_FUNCTION_ARGS)
Datum window_rank (PG_FUNCTION_ARGS)
Datum window_dense_rank (PG_FUNCTION_ARGS)
Datum window_percent_rank (PG_FUNCTION_ARGS)
Datum window_cume_dist (PG_FUNCTION_ARGS)
Datum window_ntile (PG_FUNCTION_ARGS)
Datum window_lag (PG_FUNCTION_ARGS)
Datum window_lag_with_offset (PG_FUNCTION_ARGS)
Datum window_lag_with_offset_and_default (PG_FUNCTION_ARGS)
Datum window_lead (PG_FUNCTION_ARGS)
Datum window_lead_with_offset (PG_FUNCTION_ARGS)
Datum window_lead_with_offset_and_default (PG_FUNCTION_ARGS)
Datum window_first_value (PG_FUNCTION_ARGS)
Datum window_last_value (PG_FUNCTION_ARGS)
Datum window_nth_value (PG_FUNCTION_ARGS)
Datum spg_quad_config (PG_FUNCTION_ARGS)
Datum spg_quad_choose (PG_FUNCTION_ARGS)
Datum spg_quad_picksplit (PG_FUNCTION_ARGS)
Datum spg_quad_inner_consistent (PG_FUNCTION_ARGS)
Datum spg_quad_leaf_consistent (PG_FUNCTION_ARGS)
Datum spg_kd_config (PG_FUNCTION_ARGS)
Datum spg_kd_choose (PG_FUNCTION_ARGS)
Datum spg_kd_picksplit (PG_FUNCTION_ARGS)
Datum spg_kd_inner_consistent (PG_FUNCTION_ARGS)
Datum spg_text_config (PG_FUNCTION_ARGS)
Datum spg_text_choose (PG_FUNCTION_ARGS)
Datum spg_text_picksplit (PG_FUNCTION_ARGS)
Datum spg_text_inner_consistent (PG_FUNCTION_ARGS)
Datum spg_text_leaf_consistent (PG_FUNCTION_ARGS)
Datum ginarrayextract (PG_FUNCTION_ARGS)
Datum ginarrayextract_2args (PG_FUNCTION_ARGS)
Datum ginqueryarrayextract (PG_FUNCTION_ARGS)
Datum ginarrayconsistent (PG_FUNCTION_ARGS)
Datum pg_prepared_xact (PG_FUNCTION_ARGS)
Datum pg_get_multixact_members (PG_FUNCTION_ARGS)
Datum pg_describe_object (PG_FUNCTION_ARGS)
Datum pg_identify_object (PG_FUNCTION_ARGS)
Datum unique_key_recheck (PG_FUNCTION_ARGS)
Datum pg_event_trigger_dropped_objects (PG_FUNCTION_ARGS)
Datum pg_available_extensions (PG_FUNCTION_ARGS)
Datum pg_available_extension_versions (PG_FUNCTION_ARGS)
Datum pg_extension_update_paths (PG_FUNCTION_ARGS)
Datum pg_extension_config_dump (PG_FUNCTION_ARGS)
Datum pg_prepared_statement (PG_FUNCTION_ARGS)
Datum pg_cursor (PG_FUNCTION_ARGS)

Variables

PGDLLIMPORT int extra_float_digits
bool quote_all_identifiers

Define Documentation

#define CStringGetTextDatum (   s  )     PointerGetDatum(cstring_to_text(s))
#define TextDatumGetCString (   d  )     text_to_cstring((text *) DatumGetPointer(d))

Definition at line 736 of file builtins.h.

Referenced by AlterDomainValidateConstraint(), AttrDefaultFetch(), binary_decode(), binary_encode(), bpcharout(), build_function_result_tupdesc_d(), CheckConstraintFetch(), compile_plperl_function(), compile_pltcl_function(), convert_string_datum(), DecodeTextArrayToCString(), decompile_conbin(), DefineDomain(), do_compile(), exec_stmt_close(), exec_stmt_fetch(), exec_stmt_forc(), exec_stmt_open(), fetch_cursor_param_value(), fetch_function_defaults(), find_language_template(), flatten_reloptions(), fmgr_c_validator(), fmgr_info_C_lang(), fmgr_info_cxt_security(), fmgr_internal_validator(), fmgr_sql_validator(), func_get_detail(), generateClonedIndexStmt(), get_func_arg_info(), get_func_input_arg_names(), get_func_result_name(), get_path_all(), get_text_array_contents(), get_typdefault(), GetAggInitVal(), GetComment(), GetDomainConstraints(), GetForeignServer(), GetSecurityLabel(), GetSharedSecurityLabel(), GUCArrayAdd(), GUCArrayDelete(), GUCArrayReset(), init_sql_fcache(), inline_function(), inline_set_returning_function(), json_out(), like_fixed_prefix(), make_greater_string(), md5_crypt_verify(), MergeWithExistingConstraint(), metaphone(), parseRelOptions(), patternsel(), pg_get_constraintdef_worker(), pg_get_functiondef(), pg_get_indexdef_worker(), pg_get_triggerdef_worker(), PLy_procedure_create(), prefix_quals(), print_function_arguments(), ProcedureCreate(), ProcessGUCArray(), regex_fixed_prefix(), RelationBuildRuleLock(), RelationBuildTriggers(), RelationGetIndexExpressions(), RelationGetIndexPredicate(), RenameRole(), sepgsql_restorecon(), sepgsql_setcon(), set_config_by_name(), show_config_by_name(), textout(), tsa_headline_byname(), untransformRelOptions(), validateCheckConstraint(), and varcharout().


Function Documentation

Datum any_in ( PG_FUNCTION_ARGS   ) 

Definition at line 91 of file pseudotypes.c.

References ereport, errcode(), errmsg(), ERROR, and PG_RETURN_VOID.

{
    ereport(ERROR,
            (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
             errmsg("cannot accept a value of type any")));

    PG_RETURN_VOID();           /* keep compiler quiet */
}

Datum any_out ( PG_FUNCTION_ARGS   ) 

Definition at line 104 of file pseudotypes.c.

References ereport, errcode(), errmsg(), ERROR, and PG_RETURN_VOID.

{
    ereport(ERROR,
            (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
             errmsg("cannot display a value of type any")));

    PG_RETURN_VOID();           /* keep compiler quiet */
}

Datum anyarray_in ( PG_FUNCTION_ARGS   ) 

Definition at line 118 of file pseudotypes.c.

References ereport, errcode(), errmsg(), ERROR, and PG_RETURN_VOID.

{
    ereport(ERROR,
            (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
             errmsg("cannot accept a value of type anyarray")));

    PG_RETURN_VOID();           /* keep compiler quiet */
}

Datum anyarray_out ( PG_FUNCTION_ARGS   ) 

Definition at line 133 of file pseudotypes.c.

References array_out().

{
    return array_out(fcinfo);
}

Datum anyarray_recv ( PG_FUNCTION_ARGS   ) 

Definition at line 146 of file pseudotypes.c.

References ereport, errcode(), errmsg(), ERROR, and PG_RETURN_VOID.

{
    ereport(ERROR,
            (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
             errmsg("cannot accept a value of type anyarray")));

    PG_RETURN_VOID();           /* keep compiler quiet */
}

Datum anyarray_send ( PG_FUNCTION_ARGS   ) 

Definition at line 161 of file pseudotypes.c.

References array_send().

{
    return array_send(fcinfo);
}

Datum anyelement_in ( PG_FUNCTION_ARGS   ) 

Definition at line 434 of file pseudotypes.c.

References ereport, errcode(), errmsg(), ERROR, and PG_RETURN_VOID.

{
    ereport(ERROR,
            (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
             errmsg("cannot accept a value of type anyelement")));

    PG_RETURN_VOID();           /* keep compiler quiet */
}

Datum anyelement_out ( PG_FUNCTION_ARGS   ) 

Definition at line 447 of file pseudotypes.c.

References ereport, errcode(), errmsg(), ERROR, and PG_RETURN_VOID.

{
    ereport(ERROR,
            (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
             errmsg("cannot display a value of type anyelement")));

    PG_RETURN_VOID();           /* keep compiler quiet */
}

Datum anyenum_in ( PG_FUNCTION_ARGS   ) 

Definition at line 171 of file pseudotypes.c.

References ereport, errcode(), errmsg(), ERROR, and PG_RETURN_VOID.

{
    ereport(ERROR,
            (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
             errmsg("cannot accept a value of type anyenum")));

    PG_RETURN_VOID();           /* keep compiler quiet */
}

Datum anyenum_out ( PG_FUNCTION_ARGS   ) 

Definition at line 186 of file pseudotypes.c.

References enum_out().

{
    return enum_out(fcinfo);
}

Datum anynonarray_in ( PG_FUNCTION_ARGS   ) 

Definition at line 460 of file pseudotypes.c.

References ereport, errcode(), errmsg(), ERROR, and PG_RETURN_VOID.

{
    ereport(ERROR,
            (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
             errmsg("cannot accept a value of type anynonarray")));

    PG_RETURN_VOID();           /* keep compiler quiet */
}

Datum anynonarray_out ( PG_FUNCTION_ARGS   ) 

Definition at line 473 of file pseudotypes.c.

References ereport, errcode(), errmsg(), ERROR, and PG_RETURN_VOID.

{
    ereport(ERROR,
            (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
             errmsg("cannot display a value of type anynonarray")));

    PG_RETURN_VOID();           /* keep compiler quiet */
}

Datum anyrange_in ( PG_FUNCTION_ARGS   ) 

Definition at line 195 of file pseudotypes.c.

References ereport, errcode(), errmsg(), ERROR, and PG_RETURN_VOID.

{
    ereport(ERROR,
            (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
             errmsg("cannot accept a value of type anyrange")));

    PG_RETURN_VOID();           /* keep compiler quiet */
}

Datum anyrange_out ( PG_FUNCTION_ARGS   ) 

Definition at line 210 of file pseudotypes.c.

References range_out().

{
    return range_out(fcinfo);
}

Datum array_to_text ( PG_FUNCTION_ARGS   ) 
Datum array_to_text_null ( PG_FUNCTION_ARGS   ) 

Definition at line 3436 of file varlena.c.

References array_to_text_internal(), PG_ARGISNULL, PG_GETARG_ARRAYTYPE_P, PG_GETARG_TEXT_PP, PG_RETURN_NULL, PG_RETURN_TEXT_P, and text_to_cstring().

{
    ArrayType  *v;
    char       *fldsep;
    char       *null_string;

    /* returns NULL when first or second parameter is NULL */
    if (PG_ARGISNULL(0) || PG_ARGISNULL(1))
        PG_RETURN_NULL();

    v = PG_GETARG_ARRAYTYPE_P(0);
    fldsep = text_to_cstring(PG_GETARG_TEXT_PP(1));

    /* NULL null string is passed through as a null pointer */
    if (!PG_ARGISNULL(2))
        null_string = text_to_cstring(PG_GETARG_TEXT_PP(2));
    else
        null_string = NULL;

    PG_RETURN_TEXT_P(array_to_text_internal(fcinfo, v, fldsep, null_string));
}

Datum ascii ( PG_FUNCTION_ARGS   ) 

Definition at line 844 of file oracle_compat.c.

References Assert, encoding, ereport, errcode(), errmsg(), ERROR, GetDatabaseEncoding(), i, pg_encoding_max_length(), PG_GETARG_TEXT_PP, PG_RETURN_INT32, PG_UTF8, VARDATA_ANY, and VARSIZE_ANY_EXHDR.

Referenced by float4out(), and float8out().

{
    text       *string = PG_GETARG_TEXT_PP(0);
    int         encoding = GetDatabaseEncoding();
    unsigned char *data;

    if (VARSIZE_ANY_EXHDR(string) <= 0)
        PG_RETURN_INT32(0);

    data = (unsigned char *) VARDATA_ANY(string);

    if (encoding == PG_UTF8 && *data > 127)
    {
        /* return the code point for Unicode */

        int         result = 0,
                    tbytes = 0,
                    i;

        if (*data >= 0xF0)
        {
            result = *data & 0x07;
            tbytes = 3;
        }
        else if (*data >= 0xE0)
        {
            result = *data & 0x0F;
            tbytes = 2;
        }
        else
        {
            Assert(*data > 0xC0);
            result = *data & 0x1f;
            tbytes = 1;
        }

        Assert(tbytes > 0);

        for (i = 1; i <= tbytes; i++)
        {
            Assert((data[i] & 0xC0) == 0x80);
            result = (result << 6) + (data[i] & 0x3f);
        }

        PG_RETURN_INT32(result);
    }
    else
    {
        if (pg_encoding_max_length(encoding) > 1 && *data > 127)
            ereport(ERROR,
                    (errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
                     errmsg("requested character too large")));


        PG_RETURN_INT32((int32) *data);
    }
}

Datum binary_decode ( PG_FUNCTION_ARGS   ) 

Definition at line 72 of file encode.c.

References pg_encoding::decode, pg_encoding::decode_len, elog, enc, ereport, errcode(), errmsg(), ERROR, FATAL, name, NULL, palloc(), pg_find_encoding(), PG_GETARG_DATUM, PG_GETARG_TEXT_P, PG_RETURN_BYTEA_P, SET_VARSIZE, TextDatumGetCString, VARDATA, VARHDRSZ, and VARSIZE.

{
    text       *data = PG_GETARG_TEXT_P(0);
    Datum       name = PG_GETARG_DATUM(1);
    bytea      *result;
    char       *namebuf;
    int         datalen,
                resultlen,
                res;
    const struct pg_encoding *enc;

    datalen = VARSIZE(data) - VARHDRSZ;

    namebuf = TextDatumGetCString(name);

    enc = pg_find_encoding(namebuf);
    if (enc == NULL)
        ereport(ERROR,
                (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
                 errmsg("unrecognized encoding: \"%s\"", namebuf)));

    resultlen = enc->decode_len(VARDATA(data), datalen);
    result = palloc(VARHDRSZ + resultlen);

    res = enc->decode(VARDATA(data), datalen, VARDATA(result));

    /* Make this FATAL 'cause we've trodden on memory ... */
    if (res > resultlen)
        elog(FATAL, "overflow - decode estimate too small");

    SET_VARSIZE(result, VARHDRSZ + res);

    PG_RETURN_BYTEA_P(result);
}

Datum binary_encode ( PG_FUNCTION_ARGS   ) 

Definition at line 36 of file encode.c.

References elog, enc, pg_encoding::encode, pg_encoding::encode_len, ereport, errcode(), errmsg(), ERROR, FATAL, name, NULL, palloc(), pg_find_encoding(), PG_GETARG_BYTEA_P, PG_GETARG_DATUM, PG_RETURN_TEXT_P, SET_VARSIZE, TextDatumGetCString, VARDATA, VARHDRSZ, and VARSIZE.

{
    bytea      *data = PG_GETARG_BYTEA_P(0);
    Datum       name = PG_GETARG_DATUM(1);
    text       *result;
    char       *namebuf;
    int         datalen,
                resultlen,
                res;
    const struct pg_encoding *enc;

    datalen = VARSIZE(data) - VARHDRSZ;

    namebuf = TextDatumGetCString(name);

    enc = pg_find_encoding(namebuf);
    if (enc == NULL)
        ereport(ERROR,
                (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
                 errmsg("unrecognized encoding: \"%s\"", namebuf)));

    resultlen = enc->encode_len(VARDATA(data), datalen);
    result = palloc(VARHDRSZ + resultlen);

    res = enc->encode(VARDATA(data), datalen, VARDATA(result));

    /* Make this FATAL 'cause we've trodden on memory ... */
    if (res > resultlen)
        elog(FATAL, "overflow - encode estimate too small");

    SET_VARSIZE(result, VARHDRSZ + res);

    PG_RETURN_TEXT_P(result);
}

Datum bool_int4 ( PG_FUNCTION_ARGS   ) 

Definition at line 366 of file int.c.

References PG_GETARG_BOOL, and PG_RETURN_INT32.

{
    if (PG_GETARG_BOOL(0) == false)
        PG_RETURN_INT32(0);
    else
        PG_RETURN_INT32(1);
}

Datum booland_statefunc ( PG_FUNCTION_ARGS   ) 

Definition at line 290 of file bool.c.

References PG_GETARG_BOOL, and PG_RETURN_BOOL.

Datum booleq ( PG_FUNCTION_ARGS   ) 

Definition at line 229 of file bool.c.

References PG_GETARG_BOOL, and PG_RETURN_BOOL.

{
    bool        arg1 = PG_GETARG_BOOL(0);
    bool        arg2 = PG_GETARG_BOOL(1);

    PG_RETURN_BOOL(arg1 == arg2);
}

Datum boolge ( PG_FUNCTION_ARGS   ) 

Definition at line 274 of file bool.c.

References PG_GETARG_BOOL, and PG_RETURN_BOOL.

{
    bool        arg1 = PG_GETARG_BOOL(0);
    bool        arg2 = PG_GETARG_BOOL(1);

    PG_RETURN_BOOL(arg1 >= arg2);
}

Datum boolgt ( PG_FUNCTION_ARGS   ) 

Definition at line 256 of file bool.c.

References PG_GETARG_BOOL, and PG_RETURN_BOOL.

{
    bool        arg1 = PG_GETARG_BOOL(0);
    bool        arg2 = PG_GETARG_BOOL(1);

    PG_RETURN_BOOL(arg1 > arg2);
}

Datum boolin ( PG_FUNCTION_ARGS   ) 

Definition at line 130 of file bool.c.

References ereport, errcode(), errmsg(), ERROR, parse_bool_with_len(), PG_GETARG_CSTRING, and PG_RETURN_BOOL.

{
    const char *in_str = PG_GETARG_CSTRING(0);
    const char *str;
    size_t      len;
    bool        result;

    /*
     * Skip leading and trailing whitespace
     */
    str = in_str;
    while (isspace((unsigned char) *str))
        str++;

    len = strlen(str);
    while (len > 0 && isspace((unsigned char) str[len - 1]))
        len--;

    if (parse_bool_with_len(str, len, &result))
        PG_RETURN_BOOL(result);

    ereport(ERROR,
            (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
           errmsg("invalid input syntax for type boolean: \"%s\"", in_str)));

    /* not reached */
    PG_RETURN_BOOL(false);
}

Datum boolle ( PG_FUNCTION_ARGS   ) 

Definition at line 265 of file bool.c.

References PG_GETARG_BOOL, and PG_RETURN_BOOL.

{
    bool        arg1 = PG_GETARG_BOOL(0);
    bool        arg2 = PG_GETARG_BOOL(1);

    PG_RETURN_BOOL(arg1 <= arg2);
}

Datum boollt ( PG_FUNCTION_ARGS   ) 

Definition at line 247 of file bool.c.

References PG_GETARG_BOOL, and PG_RETURN_BOOL.

{
    bool        arg1 = PG_GETARG_BOOL(0);
    bool        arg2 = PG_GETARG_BOOL(1);

    PG_RETURN_BOOL(arg1 < arg2);
}

Datum boolne ( PG_FUNCTION_ARGS   ) 

Definition at line 238 of file bool.c.

References PG_GETARG_BOOL, and PG_RETURN_BOOL.

{
    bool        arg1 = PG_GETARG_BOOL(0);
    bool        arg2 = PG_GETARG_BOOL(1);

    PG_RETURN_BOOL(arg1 != arg2);
}

Datum boolor_statefunc ( PG_FUNCTION_ARGS   ) 

Definition at line 299 of file bool.c.

References PG_GETARG_BOOL, and PG_RETURN_BOOL.

Datum boolout ( PG_FUNCTION_ARGS   ) 

Definition at line 163 of file bool.c.

References palloc(), PG_GETARG_BOOL, and PG_RETURN_CSTRING.

{
    bool        b = PG_GETARG_BOOL(0);
    char       *result = (char *) palloc(2);

    result[0] = (b) ? 't' : 'f';
    result[1] = '\0';
    PG_RETURN_CSTRING(result);
}

Datum boolrecv ( PG_FUNCTION_ARGS   ) 

Definition at line 180 of file bool.c.

References buf, PG_GETARG_POINTER, PG_RETURN_BOOL, and pq_getmsgbyte().

{
    StringInfo  buf = (StringInfo) PG_GETARG_POINTER(0);
    int         ext;

    ext = pq_getmsgbyte(buf);
    PG_RETURN_BOOL((ext != 0) ? true : false);
}

Datum boolsend ( PG_FUNCTION_ARGS   ) 

Definition at line 193 of file bool.c.

References buf, PG_GETARG_BOOL, PG_RETURN_BYTEA_P, pq_begintypsend(), pq_endtypsend(), and pq_sendbyte().

{
    bool        arg1 = PG_GETARG_BOOL(0);
    StringInfoData buf;

    pq_begintypsend(&buf);
    pq_sendbyte(&buf, arg1 ? 1 : 0);
    PG_RETURN_BYTEA_P(pq_endtypsend(&buf));
}

Datum booltext ( PG_FUNCTION_ARGS   ) 

Definition at line 210 of file bool.c.

References cstring_to_text(), PG_GETARG_BOOL, and PG_RETURN_TEXT_P.

{
    bool        arg1 = PG_GETARG_BOOL(0);
    const char *str;

    if (arg1)
        str = "true";
    else
        str = "false";

    PG_RETURN_TEXT_P(cstring_to_text(str));
}

Datum bpchar ( PG_FUNCTION_ARGS   ) 

Definition at line 265 of file varchar.c.

References Assert, ereport, errcode(), errmsg(), ERROR, i, palloc(), PG_GETARG_BOOL, PG_GETARG_BPCHAR_PP, PG_GETARG_INT32, pg_mbcharcliplen(), pg_mbstrlen_with_len(), PG_RETURN_BPCHAR_P, SET_VARSIZE, VARDATA, VARDATA_ANY, VARHDRSZ, and VARSIZE_ANY_EXHDR.

{
    BpChar     *source = PG_GETARG_BPCHAR_PP(0);
    int32       maxlen = PG_GETARG_INT32(1);
    bool        isExplicit = PG_GETARG_BOOL(2);
    BpChar     *result;
    int32       len;
    char       *r;
    char       *s;
    int         i;
    int         charlen;        /* number of characters in the input string +
                                 * VARHDRSZ */

    /* No work if typmod is invalid */
    if (maxlen < (int32) VARHDRSZ)
        PG_RETURN_BPCHAR_P(source);

    maxlen -= VARHDRSZ;

    len = VARSIZE_ANY_EXHDR(source);
    s = VARDATA_ANY(source);

    charlen = pg_mbstrlen_with_len(s, len);

    /* No work if supplied data matches typmod already */
    if (charlen == maxlen)
        PG_RETURN_BPCHAR_P(source);

    if (charlen > maxlen)
    {
        /* Verify that extra characters are spaces, and clip them off */
        size_t      maxmblen;

        maxmblen = pg_mbcharcliplen(s, len, maxlen);

        if (!isExplicit)
        {
            for (i = maxmblen; i < len; i++)
                if (s[i] != ' ')
                    ereport(ERROR,
                            (errcode(ERRCODE_STRING_DATA_RIGHT_TRUNCATION),
                             errmsg("value too long for type character(%d)",
                                    maxlen)));
        }

        len = maxmblen;

        /*
         * At this point, maxlen is the necessary byte length, not the number
         * of CHARACTERS!
         */
        maxlen = len;
    }
    else
    {
        /*
         * At this point, maxlen is the necessary byte length, not the number
         * of CHARACTERS!
         */
        maxlen = len + (maxlen - charlen);
    }

    Assert(maxlen >= len);

    result = palloc(maxlen + VARHDRSZ);
    SET_VARSIZE(result, maxlen + VARHDRSZ);
    r = VARDATA(result);

    memcpy(r, s, len);

    /* blank pad the string if necessary */
    if (maxlen > len)
        memset(r + len, ' ', maxlen - len);

    PG_RETURN_BPCHAR_P(result);
}

Datum bpchar_larger ( PG_FUNCTION_ARGS   ) 

Definition at line 862 of file varchar.c.

References bcTruelen(), PG_GET_COLLATION, PG_GETARG_BPCHAR_PP, PG_RETURN_BPCHAR_P, VARDATA_ANY, and varstr_cmp().

{
    BpChar     *arg1 = PG_GETARG_BPCHAR_PP(0);
    BpChar     *arg2 = PG_GETARG_BPCHAR_PP(1);
    int         len1,
                len2;
    int         cmp;

    len1 = bcTruelen(arg1);
    len2 = bcTruelen(arg2);

    cmp = varstr_cmp(VARDATA_ANY(arg1), len1, VARDATA_ANY(arg2), len2,
                     PG_GET_COLLATION());

    PG_RETURN_BPCHAR_P((cmp >= 0) ? arg1 : arg2);
}

Datum bpchar_name ( PG_FUNCTION_ARGS   ) 

Definition at line 365 of file varchar.c.

References NAMEDATALEN, NameStr, palloc0(), PG_GETARG_BPCHAR_PP, pg_mbcliplen(), PG_RETURN_NAME, VARDATA_ANY, and VARSIZE_ANY_EXHDR.

{
    BpChar     *s = PG_GETARG_BPCHAR_PP(0);
    char       *s_data;
    Name        result;
    int         len;

    len = VARSIZE_ANY_EXHDR(s);
    s_data = VARDATA_ANY(s);

    /* Truncate oversize input */
    if (len >= NAMEDATALEN)
        len = pg_mbcliplen(s_data, len, NAMEDATALEN - 1);

    /* Remove trailing blanks */
    while (len > 0)
    {
        if (s_data[len - 1] != ' ')
            break;
        len--;
    }

    /* We use palloc0 here to ensure result is zero-padded */
    result = (Name) palloc0(NAMEDATALEN);
    memcpy(NameStr(*result), s_data, len);

    PG_RETURN_NAME(result);
}

Datum bpchar_pattern_ge ( PG_FUNCTION_ARGS   ) 

Definition at line 988 of file varchar.c.

References internal_bpchar_pattern_compare(), PG_FREE_IF_COPY, PG_GETARG_BPCHAR_PP, and PG_RETURN_BOOL.

{
    BpChar     *arg1 = PG_GETARG_BPCHAR_PP(0);
    BpChar     *arg2 = PG_GETARG_BPCHAR_PP(1);
    int         result;

    result = internal_bpchar_pattern_compare(arg1, arg2);

    PG_FREE_IF_COPY(arg1, 0);
    PG_FREE_IF_COPY(arg2, 1);

    PG_RETURN_BOOL(result >= 0);
}

Datum bpchar_pattern_gt ( PG_FUNCTION_ARGS   ) 

Definition at line 1004 of file varchar.c.

References internal_bpchar_pattern_compare(), PG_FREE_IF_COPY, PG_GETARG_BPCHAR_PP, and PG_RETURN_BOOL.

{
    BpChar     *arg1 = PG_GETARG_BPCHAR_PP(0);
    BpChar     *arg2 = PG_GETARG_BPCHAR_PP(1);
    int         result;

    result = internal_bpchar_pattern_compare(arg1, arg2);

    PG_FREE_IF_COPY(arg1, 0);
    PG_FREE_IF_COPY(arg2, 1);

    PG_RETURN_BOOL(result > 0);
}

Datum bpchar_pattern_le ( PG_FUNCTION_ARGS   ) 

Definition at line 972 of file varchar.c.

References internal_bpchar_pattern_compare(), PG_FREE_IF_COPY, PG_GETARG_BPCHAR_PP, and PG_RETURN_BOOL.

{
    BpChar     *arg1 = PG_GETARG_BPCHAR_PP(0);
    BpChar     *arg2 = PG_GETARG_BPCHAR_PP(1);
    int         result;

    result = internal_bpchar_pattern_compare(arg1, arg2);

    PG_FREE_IF_COPY(arg1, 0);
    PG_FREE_IF_COPY(arg2, 1);

    PG_RETURN_BOOL(result <= 0);
}

Datum bpchar_pattern_lt ( PG_FUNCTION_ARGS   ) 

Definition at line 956 of file varchar.c.

References internal_bpchar_pattern_compare(), PG_FREE_IF_COPY, PG_GETARG_BPCHAR_PP, and PG_RETURN_BOOL.

{
    BpChar     *arg1 = PG_GETARG_BPCHAR_PP(0);
    BpChar     *arg2 = PG_GETARG_BPCHAR_PP(1);
    int         result;

    result = internal_bpchar_pattern_compare(arg1, arg2);

    PG_FREE_IF_COPY(arg1, 0);
    PG_FREE_IF_COPY(arg2, 1);

    PG_RETURN_BOOL(result < 0);
}

Datum bpchar_smaller ( PG_FUNCTION_ARGS   ) 

Definition at line 880 of file varchar.c.

References bcTruelen(), PG_GET_COLLATION, PG_GETARG_BPCHAR_PP, PG_RETURN_BPCHAR_P, VARDATA_ANY, and varstr_cmp().

{
    BpChar     *arg1 = PG_GETARG_BPCHAR_PP(0);
    BpChar     *arg2 = PG_GETARG_BPCHAR_PP(1);
    int         len1,
                len2;
    int         cmp;

    len1 = bcTruelen(arg1);
    len2 = bcTruelen(arg2);

    cmp = varstr_cmp(VARDATA_ANY(arg1), len1, VARDATA_ANY(arg2), len2,
                     PG_GET_COLLATION());

    PG_RETURN_BPCHAR_P((cmp <= 0) ? arg1 : arg2);
}

Datum bpcharcmp ( PG_FUNCTION_ARGS   ) 

Definition at line 841 of file varchar.c.

References bcTruelen(), PG_FREE_IF_COPY, PG_GET_COLLATION, PG_GETARG_BPCHAR_PP, PG_RETURN_INT32, VARDATA_ANY, and varstr_cmp().

{
    BpChar     *arg1 = PG_GETARG_BPCHAR_PP(0);
    BpChar     *arg2 = PG_GETARG_BPCHAR_PP(1);
    int         len1,
                len2;
    int         cmp;

    len1 = bcTruelen(arg1);
    len2 = bcTruelen(arg2);

    cmp = varstr_cmp(VARDATA_ANY(arg1), len1, VARDATA_ANY(arg2), len2,
                     PG_GET_COLLATION());

    PG_FREE_IF_COPY(arg1, 0);
    PG_FREE_IF_COPY(arg2, 1);

    PG_RETURN_INT32(cmp);
}

Datum bpchareq ( PG_FUNCTION_ARGS   ) 

Definition at line 703 of file varchar.c.

References bcTruelen(), memcmp(), PG_FREE_IF_COPY, PG_GETARG_BPCHAR_PP, PG_RETURN_BOOL, and VARDATA_ANY.

{
    BpChar     *arg1 = PG_GETARG_BPCHAR_PP(0);
    BpChar     *arg2 = PG_GETARG_BPCHAR_PP(1);
    int         len1,
                len2;
    bool        result;

    len1 = bcTruelen(arg1);
    len2 = bcTruelen(arg2);

    /*
     * Since we only care about equality or not-equality, we can avoid all the
     * expense of strcoll() here, and just do bitwise comparison.
     */
    if (len1 != len2)
        result = false;
    else
        result = (memcmp(VARDATA_ANY(arg1), VARDATA_ANY(arg2), len1) == 0);

    PG_FREE_IF_COPY(arg1, 0);
    PG_FREE_IF_COPY(arg2, 1);

    PG_RETURN_BOOL(result);
}

Datum bpcharge ( PG_FUNCTION_ARGS   ) 

Definition at line 820 of file varchar.c.

References bcTruelen(), PG_FREE_IF_COPY, PG_GET_COLLATION, PG_GETARG_BPCHAR_PP, PG_RETURN_BOOL, VARDATA_ANY, and varstr_cmp().

{
    BpChar     *arg1 = PG_GETARG_BPCHAR_PP(0);
    BpChar     *arg2 = PG_GETARG_BPCHAR_PP(1);
    int         len1,
                len2;
    int         cmp;

    len1 = bcTruelen(arg1);
    len2 = bcTruelen(arg2);

    cmp = varstr_cmp(VARDATA_ANY(arg1), len1, VARDATA_ANY(arg2), len2,
                     PG_GET_COLLATION());

    PG_FREE_IF_COPY(arg1, 0);
    PG_FREE_IF_COPY(arg2, 1);

    PG_RETURN_BOOL(cmp >= 0);
}

Datum bpchargt ( PG_FUNCTION_ARGS   ) 

Definition at line 799 of file varchar.c.

References bcTruelen(), PG_FREE_IF_COPY, PG_GET_COLLATION, PG_GETARG_BPCHAR_PP, PG_RETURN_BOOL, VARDATA_ANY, and varstr_cmp().

{
    BpChar     *arg1 = PG_GETARG_BPCHAR_PP(0);
    BpChar     *arg2 = PG_GETARG_BPCHAR_PP(1);
    int         len1,
                len2;
    int         cmp;

    len1 = bcTruelen(arg1);
    len2 = bcTruelen(arg2);

    cmp = varstr_cmp(VARDATA_ANY(arg1), len1, VARDATA_ANY(arg2), len2,
                     PG_GET_COLLATION());

    PG_FREE_IF_COPY(arg1, 0);
    PG_FREE_IF_COPY(arg2, 1);

    PG_RETURN_BOOL(cmp > 0);
}

Datum bpcharin ( PG_FUNCTION_ARGS   ) 

Definition at line 190 of file varchar.c.

References bpchar_input(), PG_GETARG_CSTRING, PG_GETARG_INT32, PG_GETARG_OID, and PG_RETURN_BPCHAR_P.

{
    char       *s = PG_GETARG_CSTRING(0);

#ifdef NOT_USED
    Oid         typelem = PG_GETARG_OID(1);
#endif
    int32       atttypmod = PG_GETARG_INT32(2);
    BpChar     *result;

    result = bpchar_input(s, strlen(s), atttypmod);
    PG_RETURN_BPCHAR_P(result);
}

Datum bpcharle ( PG_FUNCTION_ARGS   ) 

Definition at line 778 of file varchar.c.

References bcTruelen(), PG_FREE_IF_COPY, PG_GET_COLLATION, PG_GETARG_BPCHAR_PP, PG_RETURN_BOOL, VARDATA_ANY, and varstr_cmp().

{
    BpChar     *arg1 = PG_GETARG_BPCHAR_PP(0);
    BpChar     *arg2 = PG_GETARG_BPCHAR_PP(1);
    int         len1,
                len2;
    int         cmp;

    len1 = bcTruelen(arg1);
    len2 = bcTruelen(arg2);

    cmp = varstr_cmp(VARDATA_ANY(arg1), len1, VARDATA_ANY(arg2), len2,
                     PG_GET_COLLATION());

    PG_FREE_IF_COPY(arg1, 0);
    PG_FREE_IF_COPY(arg2, 1);

    PG_RETURN_BOOL(cmp <= 0);
}

Datum bpcharlen ( PG_FUNCTION_ARGS   ) 

Definition at line 669 of file varchar.c.

References arg, bcTruelen(), pg_database_encoding_max_length(), PG_GETARG_BPCHAR_PP, pg_mbstrlen_with_len(), PG_RETURN_INT32, and VARDATA_ANY.

{
    BpChar     *arg = PG_GETARG_BPCHAR_PP(0);
    int         len;

    /* get number of bytes, ignoring trailing spaces */
    len = bcTruelen(arg);

    /* in multibyte encoding, convert to number of characters */
    if (pg_database_encoding_max_length() != 1)
        len = pg_mbstrlen_with_len(VARDATA_ANY(arg), len);

    PG_RETURN_INT32(len);
}

Datum bpcharlt ( PG_FUNCTION_ARGS   ) 

Definition at line 757 of file varchar.c.

References bcTruelen(), PG_FREE_IF_COPY, PG_GET_COLLATION, PG_GETARG_BPCHAR_PP, PG_RETURN_BOOL, VARDATA_ANY, and varstr_cmp().

{
    BpChar     *arg1 = PG_GETARG_BPCHAR_PP(0);
    BpChar     *arg2 = PG_GETARG_BPCHAR_PP(1);
    int         len1,
                len2;
    int         cmp;

    len1 = bcTruelen(arg1);
    len2 = bcTruelen(arg2);

    cmp = varstr_cmp(VARDATA_ANY(arg1), len1, VARDATA_ANY(arg2), len2,
                     PG_GET_COLLATION());

    PG_FREE_IF_COPY(arg1, 0);
    PG_FREE_IF_COPY(arg2, 1);

    PG_RETURN_BOOL(cmp < 0);
}

Datum bpcharne ( PG_FUNCTION_ARGS   ) 

Definition at line 730 of file varchar.c.

References bcTruelen(), memcmp(), PG_FREE_IF_COPY, PG_GETARG_BPCHAR_PP, PG_RETURN_BOOL, and VARDATA_ANY.

{
    BpChar     *arg1 = PG_GETARG_BPCHAR_PP(0);
    BpChar     *arg2 = PG_GETARG_BPCHAR_PP(1);
    int         len1,
                len2;
    bool        result;

    len1 = bcTruelen(arg1);
    len2 = bcTruelen(arg2);

    /*
     * Since we only care about equality or not-equality, we can avoid all the
     * expense of strcoll() here, and just do bitwise comparison.
     */
    if (len1 != len2)
        result = true;
    else
        result = (memcmp(VARDATA_ANY(arg1), VARDATA_ANY(arg2), len1) != 0);

    PG_FREE_IF_COPY(arg1, 0);
    PG_FREE_IF_COPY(arg2, 1);

    PG_RETURN_BOOL(result);
}

Datum bpcharoctetlen ( PG_FUNCTION_ARGS   ) 

Definition at line 685 of file varchar.c.

References arg, PG_GETARG_DATUM, PG_RETURN_INT32, toast_raw_datum_size(), and VARHDRSZ.

{
    Datum       arg = PG_GETARG_DATUM(0);

    /* We need not detoast the input at all */
    PG_RETURN_INT32(toast_raw_datum_size(arg) - VARHDRSZ);
}

Datum bpcharout ( PG_FUNCTION_ARGS   ) 
Datum bpcharrecv ( PG_FUNCTION_ARGS   ) 

Definition at line 223 of file varchar.c.

References bpchar_input(), buf, StringInfoData::cursor, StringInfoData::len, pfree(), PG_GETARG_INT32, PG_GETARG_OID, PG_GETARG_POINTER, PG_RETURN_BPCHAR_P, and pq_getmsgtext().

{
    StringInfo  buf = (StringInfo) PG_GETARG_POINTER(0);

#ifdef NOT_USED
    Oid         typelem = PG_GETARG_OID(1);
#endif
    int32       atttypmod = PG_GETARG_INT32(2);
    BpChar     *result;
    char       *str;
    int         nbytes;

    str = pq_getmsgtext(buf, buf->len - buf->cursor, &nbytes);
    result = bpchar_input(str, nbytes, atttypmod);
    pfree(str);
    PG_RETURN_BPCHAR_P(result);
}

Datum bpcharsend ( PG_FUNCTION_ARGS   ) 

Definition at line 245 of file varchar.c.

References textsend().

{
    /* Exactly the same as textsend, so share code */
    return textsend(fcinfo);
}

Datum bpchartypmodin ( PG_FUNCTION_ARGS   ) 
Datum bpchartypmodout ( PG_FUNCTION_ARGS   ) 

Definition at line 419 of file varchar.c.

References anychar_typmodout(), PG_GETARG_INT32, and PG_RETURN_CSTRING.

Datum btabstimecmp ( PG_FUNCTION_ARGS   ) 
Datum btboolcmp ( PG_FUNCTION_ARGS   ) 

Definition at line 56 of file nbtcompare.c.

References PG_GETARG_BOOL, and PG_RETURN_INT32.

{
    bool        a = PG_GETARG_BOOL(0);
    bool        b = PG_GETARG_BOOL(1);

    PG_RETURN_INT32((int32) a - (int32) b);
}

Datum btbpchar_pattern_cmp ( PG_FUNCTION_ARGS   ) 

Definition at line 1020 of file varchar.c.

References internal_bpchar_pattern_compare(), PG_FREE_IF_COPY, PG_GETARG_BPCHAR_PP, and PG_RETURN_INT32.

{
    BpChar     *arg1 = PG_GETARG_BPCHAR_PP(0);
    BpChar     *arg2 = PG_GETARG_BPCHAR_PP(1);
    int         result;

    result = internal_bpchar_pattern_compare(arg1, arg2);

    PG_FREE_IF_COPY(arg1, 0);
    PG_FREE_IF_COPY(arg2, 1);

    PG_RETURN_INT32(result);
}

Datum btcharcmp ( PG_FUNCTION_ARGS   ) 

Definition at line 311 of file nbtcompare.c.

References PG_GETARG_CHAR, and PG_RETURN_INT32.

{
    char        a = PG_GETARG_CHAR(0);
    char        b = PG_GETARG_CHAR(1);

    /* Be careful to compare chars as unsigned */
    PG_RETURN_INT32((int32) ((uint8) a) - (int32) ((uint8) b));
}

Datum btfloat48cmp ( PG_FUNCTION_ARGS   ) 

Definition at line 1097 of file float.c.

References float8_cmp_internal(), PG_GETARG_FLOAT4, PG_GETARG_FLOAT8, and PG_RETURN_INT32.

{
    float4      arg1 = PG_GETARG_FLOAT4(0);
    float8      arg2 = PG_GETARG_FLOAT8(1);

    /* widen float4 to float8 and then compare */
    PG_RETURN_INT32(float8_cmp_internal(arg1, arg2));
}

Datum btfloat4cmp ( PG_FUNCTION_ARGS   ) 

Definition at line 956 of file float.c.

References float4_cmp_internal(), PG_GETARG_FLOAT4, and PG_RETURN_INT32.

Datum btfloat4sortsupport ( PG_FUNCTION_ARGS   ) 

Definition at line 974 of file float.c.

References SortSupportData::comparator, PG_GETARG_POINTER, and PG_RETURN_VOID.

{
    SortSupport ssup = (SortSupport) PG_GETARG_POINTER(0);

    ssup->comparator = btfloat4fastcmp;
    PG_RETURN_VOID();
}

Datum btfloat84cmp ( PG_FUNCTION_ARGS   ) 

Definition at line 1107 of file float.c.

References float8_cmp_internal(), PG_GETARG_FLOAT4, PG_GETARG_FLOAT8, and PG_RETURN_INT32.

{
    float8      arg1 = PG_GETARG_FLOAT8(0);
    float4      arg2 = PG_GETARG_FLOAT4(1);

    /* widen float4 to float8 and then compare */
    PG_RETURN_INT32(float8_cmp_internal(arg1, arg2));
}

Datum btfloat8cmp ( PG_FUNCTION_ARGS   ) 

Definition at line 1070 of file float.c.

References float8_cmp_internal(), PG_GETARG_FLOAT8, and PG_RETURN_INT32.

Datum btfloat8sortsupport ( PG_FUNCTION_ARGS   ) 

Definition at line 1088 of file float.c.

References SortSupportData::comparator, PG_GETARG_POINTER, and PG_RETURN_VOID.

{
    SortSupport ssup = (SortSupport) PG_GETARG_POINTER(0);

    ssup->comparator = btfloat8fastcmp;
    PG_RETURN_VOID();
}

Datum btint24cmp ( PG_FUNCTION_ARGS   ) 

Definition at line 194 of file nbtcompare.c.

References PG_GETARG_INT16, PG_GETARG_INT32, and PG_RETURN_INT32.

{
    int16       a = PG_GETARG_INT16(0);
    int32       b = PG_GETARG_INT32(1);

    if (a > b)
        PG_RETURN_INT32(1);
    else if (a == b)
        PG_RETURN_INT32(0);
    else
        PG_RETURN_INT32(-1);
}

Datum btint28cmp ( PG_FUNCTION_ARGS   ) 

Definition at line 222 of file nbtcompare.c.

References PG_GETARG_INT16, PG_GETARG_INT64, and PG_RETURN_INT32.

{
    int16       a = PG_GETARG_INT16(0);
    int64       b = PG_GETARG_INT64(1);

    if (a > b)
        PG_RETURN_INT32(1);
    else if (a == b)
        PG_RETURN_INT32(0);
    else
        PG_RETURN_INT32(-1);
}

Datum btint2cmp ( PG_FUNCTION_ARGS   ) 

Definition at line 65 of file nbtcompare.c.

References PG_GETARG_INT16, and PG_RETURN_INT32.

Datum btint2sortsupport ( PG_FUNCTION_ARGS   ) 

Definition at line 83 of file nbtcompare.c.

References SortSupportData::comparator, PG_GETARG_POINTER, and PG_RETURN_VOID.

{
    SortSupport ssup = (SortSupport) PG_GETARG_POINTER(0);

    ssup->comparator = btint2fastcmp;
    PG_RETURN_VOID();
}

Datum btint42cmp ( PG_FUNCTION_ARGS   ) 

Definition at line 208 of file nbtcompare.c.

References PG_GETARG_INT16, PG_GETARG_INT32, and PG_RETURN_INT32.

{
    int32       a = PG_GETARG_INT32(0);
    int16       b = PG_GETARG_INT16(1);

    if (a > b)
        PG_RETURN_INT32(1);
    else if (a == b)
        PG_RETURN_INT32(0);
    else
        PG_RETURN_INT32(-1);
}

Datum btint48cmp ( PG_FUNCTION_ARGS   ) 

Definition at line 166 of file nbtcompare.c.

References PG_GETARG_INT32, PG_GETARG_INT64, and PG_RETURN_INT32.

{
    int32       a = PG_GETARG_INT32(0);
    int64       b = PG_GETARG_INT64(1);

    if (a > b)
        PG_RETURN_INT32(1);
    else if (a == b)
        PG_RETURN_INT32(0);
    else
        PG_RETURN_INT32(-1);
}

Datum btint4cmp ( PG_FUNCTION_ARGS   ) 

Definition at line 92 of file nbtcompare.c.

References PG_GETARG_INT32, and PG_RETURN_INT32.

{
    int32       a = PG_GETARG_INT32(0);
    int32       b = PG_GETARG_INT32(1);

    if (a > b)
        PG_RETURN_INT32(1);
    else if (a == b)
        PG_RETURN_INT32(0);
    else
        PG_RETURN_INT32(-1);
}

Datum btint4sortsupport ( PG_FUNCTION_ARGS   ) 

Definition at line 120 of file nbtcompare.c.

References SortSupportData::comparator, PG_GETARG_POINTER, and PG_RETURN_VOID.

{
    SortSupport ssup = (SortSupport) PG_GETARG_POINTER(0);

    ssup->comparator = btint4fastcmp;
    PG_RETURN_VOID();
}

Datum btint82cmp ( PG_FUNCTION_ARGS   ) 

Definition at line 236 of file nbtcompare.c.

References PG_GETARG_INT16, PG_GETARG_INT64, and PG_RETURN_INT32.

{
    int64       a = PG_GETARG_INT64(0);
    int16       b = PG_GETARG_INT16(1);

    if (a > b)
        PG_RETURN_INT32(1);
    else if (a == b)
        PG_RETURN_INT32(0);
    else
        PG_RETURN_INT32(-1);
}

Datum btint84cmp ( PG_FUNCTION_ARGS   ) 

Definition at line 180 of file nbtcompare.c.

References PG_GETARG_INT32, PG_GETARG_INT64, and PG_RETURN_INT32.

{
    int64       a = PG_GETARG_INT64(0);
    int32       b = PG_GETARG_INT32(1);

    if (a > b)
        PG_RETURN_INT32(1);
    else if (a == b)
        PG_RETURN_INT32(0);
    else
        PG_RETURN_INT32(-1);
}

Datum btint8cmp ( PG_FUNCTION_ARGS   ) 

Definition at line 129 of file nbtcompare.c.

References PG_GETARG_INT64, and PG_RETURN_INT32.

{
    int64       a = PG_GETARG_INT64(0);
    int64       b = PG_GETARG_INT64(1);

    if (a > b)
        PG_RETURN_INT32(1);
    else if (a == b)
        PG_RETURN_INT32(0);
    else
        PG_RETURN_INT32(-1);
}

Datum btint8sortsupport ( PG_FUNCTION_ARGS   ) 

Definition at line 157 of file nbtcompare.c.

References SortSupportData::comparator, PG_GETARG_POINTER, and PG_RETURN_VOID.

{
    SortSupport ssup = (SortSupport) PG_GETARG_POINTER(0);

    ssup->comparator = btint8fastcmp;
    PG_RETURN_VOID();
}

Datum btnamecmp ( PG_FUNCTION_ARGS   ) 

Definition at line 321 of file nbtcompare.c.

References NAMEDATALEN, NameStr, PG_GETARG_NAME, and PG_RETURN_INT32.

Datum btnamesortsupport ( PG_FUNCTION_ARGS   ) 

Definition at line 339 of file nbtcompare.c.

References SortSupportData::comparator, PG_GETARG_POINTER, and PG_RETURN_VOID.

{
    SortSupport ssup = (SortSupport) PG_GETARG_POINTER(0);

    ssup->comparator = btnamefastcmp;
    PG_RETURN_VOID();
}

Datum btoidcmp ( PG_FUNCTION_ARGS   ) 

Definition at line 250 of file nbtcompare.c.

References PG_GETARG_OID, and PG_RETURN_INT32.

{
    Oid         a = PG_GETARG_OID(0);
    Oid         b = PG_GETARG_OID(1);

    if (a > b)
        PG_RETURN_INT32(1);
    else if (a == b)
        PG_RETURN_INT32(0);
    else
        PG_RETURN_INT32(-1);
}

Datum btoidsortsupport ( PG_FUNCTION_ARGS   ) 

Definition at line 278 of file nbtcompare.c.

References SortSupportData::comparator, PG_GETARG_POINTER, and PG_RETURN_VOID.

{
    SortSupport ssup = (SortSupport) PG_GETARG_POINTER(0);

    ssup->comparator = btoidfastcmp;
    PG_RETURN_VOID();
}

Datum btoidvectorcmp ( PG_FUNCTION_ARGS   ) 

Definition at line 287 of file nbtcompare.c.

References oidvector::dim1, i, PG_GETARG_POINTER, PG_RETURN_INT32, and oidvector::values.

Referenced by oidvectoreq(), oidvectorge(), oidvectorgt(), oidvectorle(), oidvectorlt(), and oidvectorne().

{
    oidvector  *a = (oidvector *) PG_GETARG_POINTER(0);
    oidvector  *b = (oidvector *) PG_GETARG_POINTER(1);
    int         i;

    /* We arbitrarily choose to sort first by vector length */
    if (a->dim1 != b->dim1)
        PG_RETURN_INT32(a->dim1 - b->dim1);

    for (i = 0; i < a->dim1; i++)
    {
        if (a->values[i] != b->values[i])
        {
            if (a->values[i] > b->values[i])
                PG_RETURN_INT32(1);
            else
                PG_RETURN_INT32(-1);
        }
    }
    PG_RETURN_INT32(0);
}

Datum btrecordcmp ( PG_FUNCTION_ARGS   ) 

Definition at line 1280 of file rowtypes.c.

References PG_RETURN_INT32, and record_cmp().

Datum btreltimecmp ( PG_FUNCTION_ARGS   ) 
Datum btrim ( PG_FUNCTION_ARGS   ) 

Definition at line 335 of file oracle_compat.c.

References dotrim(), PG_GETARG_TEXT_PP, PG_RETURN_TEXT_P, VARDATA_ANY, and VARSIZE_ANY_EXHDR.

{
    text       *string = PG_GETARG_TEXT_PP(0);
    text       *set = PG_GETARG_TEXT_PP(1);
    text       *ret;

    ret = dotrim(VARDATA_ANY(string), VARSIZE_ANY_EXHDR(string),
                 VARDATA_ANY(set), VARSIZE_ANY_EXHDR(set),
                 true, true);

    PG_RETURN_TEXT_P(ret);
}

Datum btrim1 ( PG_FUNCTION_ARGS   ) 

Definition at line 355 of file oracle_compat.c.

References dotrim(), PG_GETARG_TEXT_PP, PG_RETURN_TEXT_P, VARDATA_ANY, and VARSIZE_ANY_EXHDR.

{
    text       *string = PG_GETARG_TEXT_PP(0);
    text       *ret;

    ret = dotrim(VARDATA_ANY(string), VARSIZE_ANY_EXHDR(string),
                 " ", 1,
                 true, true);

    PG_RETURN_TEXT_P(ret);
}

Datum bttext_pattern_cmp ( PG_FUNCTION_ARGS   ) 

Definition at line 1806 of file varlena.c.

References internal_text_pattern_compare(), PG_FREE_IF_COPY, PG_GETARG_TEXT_PP, and PG_RETURN_INT32.

{
    text       *arg1 = PG_GETARG_TEXT_PP(0);
    text       *arg2 = PG_GETARG_TEXT_PP(1);
    int         result;

    result = internal_text_pattern_compare(arg1, arg2);

    PG_FREE_IF_COPY(arg1, 0);
    PG_FREE_IF_COPY(arg2, 1);

    PG_RETURN_INT32(result);
}

Datum bttextcmp ( PG_FUNCTION_ARGS   ) 

Definition at line 1672 of file varlena.c.

References PG_FREE_IF_COPY, PG_GET_COLLATION, PG_GETARG_TEXT_PP, PG_RETURN_INT32, and text_cmp().

Referenced by gbt_textcmp().

{
    text       *arg1 = PG_GETARG_TEXT_PP(0);
    text       *arg2 = PG_GETARG_TEXT_PP(1);
    int32       result;

    result = text_cmp(arg1, arg2, PG_GET_COLLATION());

    PG_FREE_IF_COPY(arg1, 0);
    PG_FREE_IF_COPY(arg2, 1);

    PG_RETURN_INT32(result);
}

Datum bttidcmp ( PG_FUNCTION_ARGS   ) 
Datum bttintervalcmp ( PG_FUNCTION_ARGS   ) 
int2vector* buildint2vector ( const int16 int2s,
int  n 
)

Definition at line 112 of file int.c.

References int2vector::dataoffset, int2vector::dim1, int2vector::elemtype, Int2VectorSize, int2vector::lbound1, int2vector::ndim, palloc0(), SET_VARSIZE, and int2vector::values.

Referenced by CreateTrigger(), and UpdateIndexRelation().

{
    int2vector *result;

    result = (int2vector *) palloc0(Int2VectorSize(n));

    if (n > 0 && int2s)
        memcpy(result->values, int2s, n * sizeof(int16));

    /*
     * Attach standard array header.  For historical reasons, we set the index
     * lower bound to 0 not 1.
     */
    SET_VARSIZE(result, Int2VectorSize(n));
    result->ndim = 1;
    result->dataoffset = 0;     /* never any nulls */
    result->elemtype = INT2OID;
    result->dim1 = n;
    result->lbound1 = 0;

    return result;
}

oidvector* buildoidvector ( const Oid oids,
int  n 
)

Definition at line 164 of file oid.c.

References oidvector::dataoffset, oidvector::dim1, oidvector::elemtype, oidvector::lbound1, oidvector::ndim, OidVectorSize, palloc0(), SET_VARSIZE, and oidvector::values.

Referenced by AggregateCreate(), CreateProceduralLanguage(), examine_parameter_list(), makeRangeConstructors(), and UpdateIndexRelation().

{
    oidvector  *result;

    result = (oidvector *) palloc0(OidVectorSize(n));

    if (n > 0 && oids)
        memcpy(result->values, oids, n * sizeof(Oid));

    /*
     * Attach standard array header.  For historical reasons, we set the index
     * lower bound to 0 not 1.
     */
    SET_VARSIZE(result, OidVectorSize(n));
    result->ndim = 1;
    result->dataoffset = 0;     /* never any nulls */
    result->elemtype = OIDOID;
    result->dim1 = n;
    result->lbound1 = 0;

    return result;
}

Datum bytea_string_agg_finalfn ( PG_FUNCTION_ARGS   ) 

Definition at line 441 of file varlena.c.

References AggCheckCallContext(), Assert, StringInfoData::data, StringInfoData::len, NULL, palloc(), PG_ARGISNULL, PG_GETARG_POINTER, PG_RETURN_BYTEA_P, PG_RETURN_NULL, SET_VARSIZE, VARDATA, and VARHDRSZ.

{
    StringInfo  state;

    /* cannot be called directly because of internal-type argument */
    Assert(AggCheckCallContext(fcinfo, NULL));

    state = PG_ARGISNULL(0) ? NULL : (StringInfo) PG_GETARG_POINTER(0);

    if (state != NULL)
    {
        bytea      *result;

        result = (bytea *) palloc(state->len + VARHDRSZ);
        SET_VARSIZE(result, state->len + VARHDRSZ);
        memcpy(VARDATA(result), state->data, state->len);
        PG_RETURN_BYTEA_P(result);
    }
    else
        PG_RETURN_NULL();
}

Datum bytea_string_agg_transfn ( PG_FUNCTION_ARGS   ) 

Definition at line 409 of file varlena.c.

References appendBinaryStringInfo(), makeStringAggState(), NULL, PG_ARGISNULL, PG_GETARG_BYTEA_PP, PG_GETARG_POINTER, PG_RETURN_POINTER, value, VARDATA_ANY, and VARSIZE_ANY_EXHDR.

{
    StringInfo  state;

    state = PG_ARGISNULL(0) ? NULL : (StringInfo) PG_GETARG_POINTER(0);

    /* Append the value unless null. */
    if (!PG_ARGISNULL(1))
    {
        bytea      *value = PG_GETARG_BYTEA_PP(1);

        /* On the first time through, we ignore the delimiter. */
        if (state == NULL)
            state = makeStringAggState(fcinfo);
        else if (!PG_ARGISNULL(2))
        {
            bytea      *delim = PG_GETARG_BYTEA_PP(2);

            appendBinaryStringInfo(state, VARDATA_ANY(delim), VARSIZE_ANY_EXHDR(delim));
        }

        appendBinaryStringInfo(state, VARDATA_ANY(value), VARSIZE_ANY_EXHDR(value));
    }

    /*
     * The transition type for string_agg() is declared to be "internal",
     * which is a pass-by-value type the same size as a pointer.
     */
    PG_RETURN_POINTER(state);
}

Datum bytealike ( PG_FUNCTION_ARGS   ) 

Definition at line 314 of file like.c.

References PG_GETARG_BYTEA_PP, PG_RETURN_BOOL, SB_MatchText(), VARDATA_ANY, and VARSIZE_ANY_EXHDR.

{
    bytea      *str = PG_GETARG_BYTEA_PP(0);
    bytea      *pat = PG_GETARG_BYTEA_PP(1);
    bool        result;
    char       *s,
               *p;
    int         slen,
                plen;

    s = VARDATA_ANY(str);
    slen = VARSIZE_ANY_EXHDR(str);
    p = VARDATA_ANY(pat);
    plen = VARSIZE_ANY_EXHDR(pat);

    result = (SB_MatchText(s, slen, p, plen, 0, true) == LIKE_TRUE);

    PG_RETURN_BOOL(result);
}

Datum byteanlike ( PG_FUNCTION_ARGS   ) 

Definition at line 335 of file like.c.

References PG_GETARG_BYTEA_PP, PG_RETURN_BOOL, SB_MatchText(), VARDATA_ANY, and VARSIZE_ANY_EXHDR.

{
    bytea      *str = PG_GETARG_BYTEA_PP(0);
    bytea      *pat = PG_GETARG_BYTEA_PP(1);
    bool        result;
    char       *s,
               *p;
    int         slen,
                plen;

    s = VARDATA_ANY(str);
    slen = VARSIZE_ANY_EXHDR(str);
    p = VARDATA_ANY(pat);
    plen = VARSIZE_ANY_EXHDR(pat);

    result = (SB_MatchText(s, slen, p, plen, 0, true) != LIKE_TRUE);

    PG_RETURN_BOOL(result);
}

Datum byteatrim ( PG_FUNCTION_ARGS   ) 

Definition at line 540 of file oracle_compat.c.

References palloc(), PG_GETARG_BYTEA_PP, PG_RETURN_BYTEA_P, SET_VARSIZE, VARDATA, VARDATA_ANY, VARHDRSZ, and VARSIZE_ANY_EXHDR.

{
    bytea      *string = PG_GETARG_BYTEA_PP(0);
    bytea      *set = PG_GETARG_BYTEA_PP(1);
    bytea      *ret;
    char       *ptr,
               *end,
               *ptr2,
               *ptr2start,
               *end2;
    int         m,
                stringlen,
                setlen;

    stringlen = VARSIZE_ANY_EXHDR(string);
    setlen = VARSIZE_ANY_EXHDR(set);

    if (stringlen <= 0 || setlen <= 0)
        PG_RETURN_BYTEA_P(string);

    m = stringlen;
    ptr = VARDATA_ANY(string);
    end = ptr + stringlen - 1;
    ptr2start = VARDATA_ANY(set);
    end2 = ptr2start + setlen - 1;

    while (m > 0)
    {
        ptr2 = ptr2start;
        while (ptr2 <= end2)
        {
            if (*ptr == *ptr2)
                break;
            ++ptr2;
        }
        if (ptr2 > end2)
            break;
        ptr++;
        m--;
    }

    while (m > 0)
    {
        ptr2 = ptr2start;
        while (ptr2 <= end2)
        {
            if (*end == *ptr2)
                break;
            ++ptr2;
        }
        if (ptr2 > end2)
            break;
        end--;
        m--;
    }

    ret = (bytea *) palloc(VARHDRSZ + m);
    SET_VARSIZE(ret, VARHDRSZ + m);
    memcpy(VARDATA(ret), ptr, m);

    PG_RETURN_BYTEA_P(ret);
}

Datum char_bpchar ( PG_FUNCTION_ARGS   ) 

Definition at line 347 of file varchar.c.

References palloc(), PG_GETARG_CHAR, PG_RETURN_BPCHAR_P, SET_VARSIZE, VARDATA, and VARHDRSZ.

{
    char        c = PG_GETARG_CHAR(0);
    BpChar     *result;

    result = (BpChar *) palloc(VARHDRSZ + 1);

    SET_VARSIZE(result, VARHDRSZ + 1);
    *(VARDATA(result)) = c;

    PG_RETURN_BPCHAR_P(result);
}

Datum char_text ( PG_FUNCTION_ARGS   ) 

Definition at line 195 of file char.c.

References palloc(), PG_GETARG_CHAR, PG_RETURN_TEXT_P, SET_VARSIZE, VARDATA, and VARHDRSZ.

{
    char        arg1 = PG_GETARG_CHAR(0);
    text       *result = palloc(VARHDRSZ + 1);

    /*
     * Convert \0 to an empty string, for consistency with charout (and
     * because the text stuff doesn't like embedded nulls all that well).
     */
    if (arg1 != '\0')
    {
        SET_VARSIZE(result, VARHDRSZ + 1);
        *(VARDATA(result)) = arg1;
    }
    else
        SET_VARSIZE(result, VARHDRSZ);

    PG_RETURN_TEXT_P(result);
}

Datum chareq ( PG_FUNCTION_ARGS   ) 

Definition at line 99 of file char.c.

References PG_GETARG_CHAR, and PG_RETURN_BOOL.

{
    char        arg1 = PG_GETARG_CHAR(0);
    char        arg2 = PG_GETARG_CHAR(1);

    PG_RETURN_BOOL(arg1 == arg2);
}

Datum charge ( PG_FUNCTION_ARGS   ) 

Definition at line 144 of file char.c.

References PG_GETARG_CHAR, and PG_RETURN_BOOL.

{
    char        arg1 = PG_GETARG_CHAR(0);
    char        arg2 = PG_GETARG_CHAR(1);

    PG_RETURN_BOOL((uint8) arg1 >= (uint8) arg2);
}

Datum chargt ( PG_FUNCTION_ARGS   ) 

Definition at line 135 of file char.c.

References PG_GETARG_CHAR, and PG_RETURN_BOOL.

{
    char        arg1 = PG_GETARG_CHAR(0);
    char        arg2 = PG_GETARG_CHAR(1);

    PG_RETURN_BOOL((uint8) arg1 > (uint8) arg2);
}

Datum charin ( PG_FUNCTION_ARGS   ) 

Definition at line 33 of file char.c.

References PG_GETARG_CSTRING, and PG_RETURN_CHAR.

{
    char       *ch = PG_GETARG_CSTRING(0);

    PG_RETURN_CHAR(ch[0]);
}

Datum charle ( PG_FUNCTION_ARGS   ) 

Definition at line 126 of file char.c.

References PG_GETARG_CHAR, and PG_RETURN_BOOL.

{
    char        arg1 = PG_GETARG_CHAR(0);
    char        arg2 = PG_GETARG_CHAR(1);

    PG_RETURN_BOOL((uint8) arg1 <= (uint8) arg2);
}

Datum charlt ( PG_FUNCTION_ARGS   ) 

Definition at line 117 of file char.c.

References PG_GETARG_CHAR, and PG_RETURN_BOOL.

{
    char        arg1 = PG_GETARG_CHAR(0);
    char        arg2 = PG_GETARG_CHAR(1);

    PG_RETURN_BOOL((uint8) arg1 < (uint8) arg2);
}

Datum charne ( PG_FUNCTION_ARGS   ) 

Definition at line 108 of file char.c.

References PG_GETARG_CHAR, and PG_RETURN_BOOL.

{
    char        arg1 = PG_GETARG_CHAR(0);
    char        arg2 = PG_GETARG_CHAR(1);

    PG_RETURN_BOOL(arg1 != arg2);
}

Datum charout ( PG_FUNCTION_ARGS   ) 

Definition at line 48 of file char.c.

References palloc(), PG_GETARG_CHAR, and PG_RETURN_CSTRING.

{
    char        ch = PG_GETARG_CHAR(0);
    char       *result = (char *) palloc(2);

    result[0] = ch;
    result[1] = '\0';
    PG_RETURN_CSTRING(result);
}

Datum charrecv ( PG_FUNCTION_ARGS   ) 
Datum charsend ( PG_FUNCTION_ARGS   ) 
Datum chartoi4 ( PG_FUNCTION_ARGS   ) 

Definition at line 154 of file char.c.

References PG_GETARG_CHAR, and PG_RETURN_INT32.

{
    char        arg1 = PG_GETARG_CHAR(0);

    PG_RETURN_INT32((int32) ((int8) arg1));
}

Datum chr ( PG_FUNCTION_ARGS   ) 

Definition at line 925 of file oracle_compat.c.

References encoding, ereport, errcode(), errmsg(), ERROR, GetDatabaseEncoding(), palloc(), pg_encoding_max_length(), PG_GETARG_UINT32, PG_RETURN_TEXT_P, PG_UTF8, SET_VARSIZE, VARDATA, and VARHDRSZ.

{
    uint32      cvalue = PG_GETARG_UINT32(0);
    text       *result;
    int         encoding = GetDatabaseEncoding();

    if (encoding == PG_UTF8 && cvalue > 127)
    {
        /* for Unicode we treat the argument as a code point */
        int         bytes;
        char       *wch;

        /* We only allow valid Unicode code points */
        if (cvalue > 0x001fffff)
            ereport(ERROR,
                    (errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
                     errmsg("requested character too large for encoding: %d",
                            cvalue)));

        if (cvalue > 0xffff)
            bytes = 4;
        else if (cvalue > 0x07ff)
            bytes = 3;
        else
            bytes = 2;

        result = (text *) palloc(VARHDRSZ + bytes);
        SET_VARSIZE(result, VARHDRSZ + bytes);
        wch = VARDATA(result);

        if (bytes == 2)
        {
            wch[0] = 0xC0 | ((cvalue >> 6) & 0x1F);
            wch[1] = 0x80 | (cvalue & 0x3F);;
        }
        else if (bytes == 3)
        {
            wch[0] = 0xE0 | ((cvalue >> 12) & 0x0F);
            wch[1] = 0x80 | ((cvalue >> 6) & 0x3F);
            wch[2] = 0x80 | (cvalue & 0x3F);
        }
        else
        {
            wch[0] = 0xF0 | ((cvalue >> 18) & 0x07);
            wch[1] = 0x80 | ((cvalue >> 12) & 0x3F);
            wch[2] = 0x80 | ((cvalue >> 6) & 0x3F);
            wch[3] = 0x80 | (cvalue & 0x3F);
        }

    }

    else
    {
        bool        is_mb;

        /*
         * Error out on arguments that make no sense or that we can't validly
         * represent in the encoding.
         */

        if (cvalue == 0)
            ereport(ERROR,
                    (errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
                     errmsg("null character not permitted")));

        is_mb = pg_encoding_max_length(encoding) > 1;

        if ((is_mb && (cvalue > 127)) || (!is_mb && (cvalue > 255)))
            ereport(ERROR,
                    (errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
                     errmsg("requested character too large for encoding: %d",
                            cvalue)));


        result = (text *) palloc(VARHDRSZ + 1);
        SET_VARSIZE(result, VARHDRSZ + 1);
        *VARDATA(result) = (char) cvalue;
    }

    PG_RETURN_TEXT_P(result);
}

Datum cideq ( PG_FUNCTION_ARGS   ) 

Definition at line 182 of file xid.c.

References PG_GETARG_COMMANDID, and PG_RETURN_BOOL.

Datum cidin ( PG_FUNCTION_ARGS   ) 

Definition at line 133 of file xid.c.

References PG_GETARG_CSTRING, and PG_RETURN_COMMANDID.

{
    char       *s = PG_GETARG_CSTRING(0);
    CommandId   c;

    c = atoi(s);

    PG_RETURN_COMMANDID(c);
}

Datum cidout ( PG_FUNCTION_ARGS   ) 

Definition at line 147 of file xid.c.

References palloc(), PG_GETARG_COMMANDID, PG_RETURN_CSTRING, and snprintf().

{
    CommandId   c = PG_GETARG_COMMANDID(0);
    char       *result = (char *) palloc(16);

    snprintf(result, 16, "%u", (unsigned int) c);
    PG_RETURN_CSTRING(result);
}

Datum cidr_abbrev ( PG_FUNCTION_ARGS   ) 

Definition at line 670 of file network.c.

References cstring_to_text(), ereport, errcode(), errmsg(), ERROR, inet_cidr_ntop(), ip_addr, ip_bits, ip_family, NULL, PG_GETARG_INET_PP, and PG_RETURN_TEXT_P.

{
    inet       *ip = PG_GETARG_INET_PP(0);
    char       *dst;
    char        tmp[sizeof("xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:255.255.255.255/128")];

    dst = inet_cidr_ntop(ip_family(ip), ip_addr(ip),
                         ip_bits(ip), tmp, sizeof(tmp));

    if (dst == NULL)
        ereport(ERROR,
                (errcode(ERRCODE_INVALID_BINARY_REPRESENTATION),
                 errmsg("could not format cidr value: %m")));

    PG_RETURN_TEXT_P(cstring_to_text(tmp));
}

Datum cidr_in ( PG_FUNCTION_ARGS   ) 

Definition at line 137 of file network.c.

References network_in(), PG_GETARG_CSTRING, and PG_RETURN_INET_P.

{
    char       *src = PG_GETARG_CSTRING(0);

    PG_RETURN_INET_P(network_in(src, true));
}

Datum cidr_out ( PG_FUNCTION_ARGS   ) 

Definition at line 181 of file network.c.

References network_out(), PG_GETARG_INET_PP, and PG_RETURN_CSTRING.

Datum cidr_recv ( PG_FUNCTION_ARGS   ) 
Datum cidr_send ( PG_FUNCTION_ARGS   ) 

Definition at line 308 of file network.c.

References network_send(), PG_GETARG_INET_PP, and PG_RETURN_BYTEA_P.

{
    inet       *addr = PG_GETARG_INET_PP(0);

    PG_RETURN_BYTEA_P(network_send(addr, true));
}

Datum cidr_set_masklen ( PG_FUNCTION_ARGS   ) 

Definition at line 382 of file network.c.

References ereport, errcode(), errmsg(), ERROR, ip_addr, ip_addrsize(), ip_bits, ip_maxbits, palloc(), PG_GETARG_INET_PP, PG_GETARG_INT32, PG_RETURN_INET_P, and VARSIZE_ANY.

{
    inet       *src = PG_GETARG_INET_PP(0);
    int         bits = PG_GETARG_INT32(1);
    inet       *dst;
    int         byte;
    int         nbits;
    int         maxbytes;

    if (bits == -1)
        bits = ip_maxbits(src);

    if ((bits < 0) || (bits > ip_maxbits(src)))
        ereport(ERROR,
                (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
                 errmsg("invalid mask length: %d", bits)));

    /* clone the original data */
    dst = (inet *) palloc(VARSIZE_ANY(src));
    memcpy(dst, src, VARSIZE_ANY(src));

    ip_bits(dst) = bits;

    /* zero out any bits to the right of the new netmask */
    byte = bits / 8;

    nbits = bits % 8;
    /* clear the first byte, this might be a partial byte */
    if (nbits != 0)
    {
        ip_addr(dst)[byte] &= ~(0xFF >> nbits);
        byte++;
    }
    /* clear remaining bytes */
    maxbytes = ip_addrsize(dst);
    while (byte < maxbytes)
    {
        ip_addr(dst)[byte] = 0;
        byte++;
    }

    PG_RETURN_INET_P(dst);
}

Datum cidrecv ( PG_FUNCTION_ARGS   ) 
Datum cidsend ( PG_FUNCTION_ARGS   ) 
void clean_ipv6_addr ( int  addr_family,
char *  addr 
)

Definition at line 1457 of file network.c.

Referenced by inet_client_addr(), inet_server_addr(), pg_stat_get_activity(), and pg_stat_get_backend_client_addr().

{
#ifdef HAVE_IPV6
    if (addr_family == AF_INET6)
    {
        char       *pct = strchr(addr, '%');

        if (pct)
            *pct = '\0';
    }
#endif
}

double convert_network_to_scalar ( Datum  value,
Oid  typid 
)

Definition at line 903 of file network.c.

References macaddr::a, macaddr::b, macaddr::c, CIDROID, macaddr::d, DatumGetInetPP, DatumGetMacaddrP, macaddr::e, elog, ERROR, macaddr::f, i, INETOID, ip_addr, ip_family, MACADDROID, and PGSQL_AF_INET.

Referenced by convert_to_scalar(), gbt_inet_compress(), and gbt_inet_consistent().

{
    switch (typid)
    {
        case INETOID:
        case CIDROID:
            {
                inet       *ip = DatumGetInetPP(value);
                int         len;
                double      res;
                int         i;

                /*
                 * Note that we don't use the full address for IPv6.
                 */
                if (ip_family(ip) == PGSQL_AF_INET)
                    len = 4;
                else
                    len = 5;

                res = ip_family(ip);
                for (i = 0; i < len; i++)
                {
                    res *= 256;
                    res += ip_addr(ip)[i];
                }
                return res;

                break;
            }
        case MACADDROID:
            {
                macaddr    *mac = DatumGetMacaddrP(value);
                double      res;

                res = (mac->a << 16) | (mac->b << 8) | (mac->c);
                res *= 256 * 256 * 256;
                res += (mac->d << 16) | (mac->e << 8) | (mac->f);
                return res;
            }
    }

    /*
     * Can't get here unless someone tries to use scalarltsel/scalargtsel on
     * an operator with one network and one non-network operand.
     */
    elog(ERROR, "unsupported type: %u", typid);
    return 0;
}

Datum cstring_in ( PG_FUNCTION_ARGS   ) 

Definition at line 37 of file pseudotypes.c.

References PG_GETARG_CSTRING, PG_RETURN_CSTRING, and pstrdup().

{
    char       *str = PG_GETARG_CSTRING(0);

    PG_RETURN_CSTRING(pstrdup(str));
}

Datum cstring_out ( PG_FUNCTION_ARGS   ) 

Definition at line 51 of file pseudotypes.c.

References PG_GETARG_CSTRING, PG_RETURN_CSTRING, and pstrdup().

{
    char       *str = PG_GETARG_CSTRING(0);

    PG_RETURN_CSTRING(pstrdup(str));
}

Datum cstring_recv ( PG_FUNCTION_ARGS   ) 

Definition at line 62 of file pseudotypes.c.

References buf, StringInfoData::cursor, StringInfoData::len, PG_GETARG_POINTER, PG_RETURN_CSTRING, and pq_getmsgtext().

{
    StringInfo  buf = (StringInfo) PG_GETARG_POINTER(0);
    char       *str;
    int         nbytes;

    str = pq_getmsgtext(buf, buf->len - buf->cursor, &nbytes);
    PG_RETURN_CSTRING(str);
}

Datum cstring_send ( PG_FUNCTION_ARGS   ) 

Definition at line 76 of file pseudotypes.c.

References buf, PG_GETARG_CSTRING, PG_RETURN_BYTEA_P, pq_begintypsend(), pq_endtypsend(), and pq_sendtext().

{
    char       *str = PG_GETARG_CSTRING(0);
    StringInfoData buf;

    pq_begintypsend(&buf);
    pq_sendtext(&buf, str, strlen(str));
    PG_RETURN_BYTEA_P(pq_endtypsend(&buf));
}

text* cstring_to_text ( const char *  s  ) 

Definition at line 108 of file varlena.c.

References cstring_to_text_with_len().

Referenced by array_dims(), array_to_json(), array_to_json_pretty(), ASN1_STRING_to_text(), booltext(), cash_words(), chkpass_rout(), cidr_abbrev(), convert_charset(), cstring_to_xmltype(), current_query(), datetime_to_char_body(), dblink_build_sql_delete(), dblink_build_sql_insert(), dblink_build_sql_update(), dblink_cancel_query(), dblink_close(), dblink_connect(), dblink_disconnect(), dblink_error_message(), dblink_exec(), dblink_open(), dmetaphone(), dmetaphone_alt(), exec_assign_c_string(), filter_list_to_array(), format_type(), fsm_page_contents(), get_scalar(), hstore_to_json(), hstore_to_json_loose(), inet_abbrev(), initcap(), json_agg_finalfn(), json_in(), lower(), md5_bytea(), md5_text(), metaphone(), name_bpchar(), name_text(), network_host(), network_show(), oidvectortypes(), pg_collation_for(), pg_create_restore_point(), pg_crypt(), pg_current_xlog_insert_location(), pg_current_xlog_location(), pg_describe_object(), pg_export_snapshot(), pg_last_xlog_receive_location(), pg_last_xlog_replay_location(), pg_relation_filepath(), pg_size_pretty(), pg_size_pretty_numeric(), pg_start_backup(), pg_stat_get_backend_activity(), pg_stop_backup(), pg_switch_xlog(), pg_tablespace_location(), pg_xlogfile_name(), pgsql_version(), pgxml_result_to_text(), quote_ident(), quote_ident_cstr(), quote_nullable(), row_to_json(), row_to_json_pretty(), sepgsql_getcon(), sepgsql_mcstrans_in(), sepgsql_mcstrans_out(), set_config_by_name(), show_config_by_name(), ShowAllGUCConfig(), soundex(), split_text(), ssl_cipher(), ssl_version(), string_to_text(), text_substring(), textin(), timeofday(), to_hex32(), to_hex64(), to_json(), tsquerytree(), unaccent_dict(), upper(), X509_NAME_to_text(), xml_encode_special_chars(), xml_in(), and xml_recv().

{
    return cstring_to_text_with_len(s, strlen(s));
}

text* cstring_to_text_with_len ( const char *  s,
int  len 
)
Datum current_database ( PG_FUNCTION_ARGS   ) 
Datum current_query ( PG_FUNCTION_ARGS   ) 

Definition at line 67 of file misc.c.

References cstring_to_text(), debug_query_string, PG_RETURN_NULL, and PG_RETURN_TEXT_P.

Referenced by dblink_current_query().

{
    /* there is no easy way to access the more concise 'query_string' */
    if (debug_query_string)
        PG_RETURN_TEXT_P(cstring_to_text(debug_query_string));
    else
        PG_RETURN_NULL();
}

Datum current_schema ( PG_FUNCTION_ARGS   ) 

Definition at line 280 of file name.c.

References CStringGetDatum, DirectFunctionCall1, fetch_search_path(), get_namespace_name(), linitial_oid, list_free(), namein(), NIL, PG_RETURN_DATUM, and PG_RETURN_NULL.

{
    List       *search_path = fetch_search_path(false);
    char       *nspname;

    if (search_path == NIL)
        PG_RETURN_NULL();
    nspname = get_namespace_name(linitial_oid(search_path));
    list_free(search_path);
    if (!nspname)
        PG_RETURN_NULL();       /* recently-deleted namespace? */
    PG_RETURN_DATUM(DirectFunctionCall1(namein, CStringGetDatum(nspname)));
}

Datum current_schemas ( PG_FUNCTION_ARGS   ) 

Definition at line 295 of file name.c.

References construct_array(), CStringGetDatum, DirectFunctionCall1, fetch_search_path(), get_namespace_name(), lfirst_oid, list_free(), list_length(), namein(), NAMEOID, palloc(), PG_GETARG_BOOL, and PG_RETURN_POINTER.

{
    List       *search_path = fetch_search_path(PG_GETARG_BOOL(0));
    ListCell   *l;
    Datum      *names;
    int         i;
    ArrayType  *array;

    names = (Datum *) palloc(list_length(search_path) * sizeof(Datum));
    i = 0;
    foreach(l, search_path)
    {
        char       *nspname;

        nspname = get_namespace_name(lfirst_oid(l));
        if (nspname)            /* watch out for deleted namespace */
        {
            names[i] = DirectFunctionCall1(namein, CStringGetDatum(nspname));
            i++;
        }
    }
    list_free(search_path);

    array = construct_array(names, i,
                            NAMEOID,
                            NAMEDATALEN,        /* sizeof(Name) */
                            false,      /* Name is not by-val */
                            'c');       /* alignment of Name */

    PG_RETURN_POINTER(array);
}

Datum current_user ( PG_FUNCTION_ARGS   ) 
Datum currtid_byrelname ( PG_FUNCTION_ARGS   ) 
Datum currtid_byreloid ( PG_FUNCTION_ARGS   ) 
Datum dacos ( PG_FUNCTION_ARGS   ) 

Definition at line 1523 of file float.c.

References CHECKFLOATVAL, ereport, errcode(), errmsg(), ERROR, isinf(), PG_GETARG_FLOAT8, and PG_RETURN_FLOAT8.

{
    float8      arg1 = PG_GETARG_FLOAT8(0);
    float8      result;

    /*
     * We use errno here because the trigonometric functions are cyclic and
     * hard to check for underflow.
     */
    errno = 0;
    result = acos(arg1);
    if (errno != 0)
        ereport(ERROR,
                (errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
                 errmsg("input is out of range")));

    CHECKFLOATVAL(result, isinf(arg1), true);
    PG_RETURN_FLOAT8(result);
}

Datum dasin ( PG_FUNCTION_ARGS   ) 

Definition at line 1548 of file float.c.

References CHECKFLOATVAL, ereport, errcode(), errmsg(), ERROR, isinf(), PG_GETARG_FLOAT8, and PG_RETURN_FLOAT8.

{
    float8      arg1 = PG_GETARG_FLOAT8(0);
    float8      result;

    errno = 0;
    result = asin(arg1);
    if (errno != 0)
        ereport(ERROR,
                (errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
                 errmsg("input is out of range")));

    CHECKFLOATVAL(result, isinf(arg1), true);
    PG_RETURN_FLOAT8(result);
}

Datum database_character_set ( PG_FUNCTION_ARGS   ) 
Datum datan ( PG_FUNCTION_ARGS   ) 

Definition at line 1569 of file float.c.

References CHECKFLOATVAL, ereport, errcode(), errmsg(), ERROR, isinf(), PG_GETARG_FLOAT8, and PG_RETURN_FLOAT8.

{
    float8      arg1 = PG_GETARG_FLOAT8(0);
    float8      result;

    errno = 0;
    result = atan(arg1);
    if (errno != 0)
        ereport(ERROR,
                (errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
                 errmsg("input is out of range")));

    CHECKFLOATVAL(result, isinf(arg1), true);
    PG_RETURN_FLOAT8(result);
}

Datum datan2 ( PG_FUNCTION_ARGS   ) 

Definition at line 1590 of file float.c.

References CHECKFLOATVAL, ereport, errcode(), errmsg(), ERROR, isinf(), PG_GETARG_FLOAT8, and PG_RETURN_FLOAT8.

{
    float8      arg1 = PG_GETARG_FLOAT8(0);
    float8      arg2 = PG_GETARG_FLOAT8(1);
    float8      result;

    errno = 0;
    result = atan2(arg1, arg2);
    if (errno != 0)
        ereport(ERROR,
                (errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
                 errmsg("input is out of range")));

    CHECKFLOATVAL(result, isinf(arg1) || isinf(arg2), true);
    PG_RETURN_FLOAT8(result);
}

Datum dcbrt ( PG_FUNCTION_ARGS   ) 

Definition at line 1377 of file float.c.

References cbrt, CHECKFLOATVAL, isinf(), PG_GETARG_FLOAT8, and PG_RETURN_FLOAT8.

{
    float8      arg1 = PG_GETARG_FLOAT8(0);
    float8      result;

    result = cbrt(arg1);
    CHECKFLOATVAL(result, isinf(arg1), arg1 == 0);
    PG_RETURN_FLOAT8(result);
}

Datum dceil ( PG_FUNCTION_ARGS   ) 

Definition at line 1290 of file float.c.

References PG_GETARG_FLOAT8, and PG_RETURN_FLOAT8.

{
    float8      arg1 = PG_GETARG_FLOAT8(0);

    PG_RETURN_FLOAT8(ceil(arg1));
}

Datum dcos ( PG_FUNCTION_ARGS   ) 

Definition at line 1612 of file float.c.

References CHECKFLOATVAL, ereport, errcode(), errmsg(), ERROR, isinf(), PG_GETARG_FLOAT8, and PG_RETURN_FLOAT8.

{
    float8      arg1 = PG_GETARG_FLOAT8(0);
    float8      result;

    errno = 0;
    result = cos(arg1);
    if (errno != 0)
        ereport(ERROR,
                (errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
                 errmsg("input is out of range")));

    CHECKFLOATVAL(result, isinf(arg1), true);
    PG_RETURN_FLOAT8(result);
}

Datum dcot ( PG_FUNCTION_ARGS   ) 

Definition at line 1633 of file float.c.

References CHECKFLOATVAL, ereport, errcode(), errmsg(), ERROR, PG_GETARG_FLOAT8, and PG_RETURN_FLOAT8.

{
    float8      arg1 = PG_GETARG_FLOAT8(0);
    float8      result;

    errno = 0;
    result = tan(arg1);
    if (errno != 0)
        ereport(ERROR,
                (errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
                 errmsg("input is out of range")));

    result = 1.0 / result;
    CHECKFLOATVAL(result, true /* cotan(pi/2) == inf */ , true);
    PG_RETURN_FLOAT8(result);
}

Datum degrees ( PG_FUNCTION_ARGS   ) 

Definition at line 1697 of file float.c.

References CHECKFLOATVAL, isinf(), PG_GETARG_FLOAT8, and PG_RETURN_FLOAT8.

{
    float8      arg1 = PG_GETARG_FLOAT8(0);
    float8      result;

    result = arg1 * (180.0 / M_PI);

    CHECKFLOATVAL(result, isinf(arg1), arg1 == 0);
    PG_RETURN_FLOAT8(result);
}

List* deparse_context_for ( const char *  aliasname,
Oid  relid 
)

Definition at line 2333 of file ruleutils.c.

References RangeTblEntry::alias, deparse_namespace::ctes, RangeTblEntry::eref, RangeTblEntry::inFromCl, RangeTblEntry::inh, RangeTblEntry::lateral, list_make1, makeAlias(), makeNode, NIL, NULL, palloc0(), RangeTblEntry::relid, RangeTblEntry::relkind, deparse_namespace::rtable, RangeTblEntry::rtekind, set_rtable_names(), and set_simple_column_names().

Referenced by pg_get_constraintdef_worker(), pg_get_expr_worker(), pg_get_indexdef_worker(), StoreAttrDefault(), and StoreRelCheck().

{
    deparse_namespace *dpns;
    RangeTblEntry *rte;

    dpns = (deparse_namespace *) palloc0(sizeof(deparse_namespace));

    /* Build a minimal RTE for the rel */
    rte = makeNode(RangeTblEntry);
    rte->rtekind = RTE_RELATION;
    rte->relid = relid;
    rte->relkind = RELKIND_RELATION;    /* no need for exactness here */
    rte->alias = makeAlias(aliasname, NIL);
    rte->eref = rte->alias;
    rte->lateral = false;
    rte->inh = false;
    rte->inFromCl = true;

    /* Build one-element rtable */
    dpns->rtable = list_make1(rte);
    dpns->ctes = NIL;
    set_rtable_names(dpns, NIL, NULL);
    set_simple_column_names(dpns);

    /* Return a one-deep namespace stack */
    return list_make1(dpns);
}

List* deparse_context_for_planstate ( Node planstate,
List ancestors,
List rtable,
List rtable_names 
)

Definition at line 2387 of file ruleutils.c.

References deparse_namespace::ancestors, deparse_namespace::ctes, list_make1, palloc0(), deparse_namespace::rtable, deparse_namespace::rtable_names, set_deparse_planstate(), and set_simple_column_names().

Referenced by show_expression(), show_plan_tlist(), and show_sort_keys_common().

{
    deparse_namespace *dpns;

    dpns = (deparse_namespace *) palloc0(sizeof(deparse_namespace));

    /* Initialize fields that stay the same across the whole plan tree */
    dpns->rtable = rtable;
    dpns->rtable_names = rtable_names;
    dpns->ctes = NIL;

    /*
     * Set up column name aliases.  We will get rather bogus results for join
     * RTEs, but that doesn't matter because plan trees don't contain any join
     * alias Vars.
     */
    set_simple_column_names(dpns);

    /* Set our attention on the specific plan node passed in */
    set_deparse_planstate(dpns, (PlanState *) planstate);
    dpns->ancestors = ancestors;

    /* Return a one-deep namespace stack */
    return list_make1(dpns);
}

char* deparse_expression ( Node expr,
List dpcontext,
bool  forceprefix,
bool  showimplicit 
)
Datum dexp ( PG_FUNCTION_ARGS   ) 

Definition at line 1445 of file float.c.

References CHECKFLOATVAL, get_float8_infinity(), isinf(), PG_GETARG_FLOAT8, and PG_RETURN_FLOAT8.

{
    float8      arg1 = PG_GETARG_FLOAT8(0);
    float8      result;

    errno = 0;
    result = exp(arg1);
    if (errno == ERANGE && result != 0 && !isinf(result))
        result = get_float8_infinity();

    CHECKFLOATVAL(result, isinf(arg1), false);
    PG_RETURN_FLOAT8(result);
}

Datum dfloor ( PG_FUNCTION_ARGS   ) 

Definition at line 1302 of file float.c.

References PG_GETARG_FLOAT8, and PG_RETURN_FLOAT8.

{
    float8      arg1 = PG_GETARG_FLOAT8(0);

    PG_RETURN_FLOAT8(floor(arg1));
}

Datum dlog1 ( PG_FUNCTION_ARGS   ) 

Definition at line 1464 of file float.c.

References CHECKFLOATVAL, ereport, errcode(), errmsg(), ERROR, isinf(), PG_GETARG_FLOAT8, and PG_RETURN_FLOAT8.

{
    float8      arg1 = PG_GETARG_FLOAT8(0);
    float8      result;

    /*
     * Emit particular SQLSTATE error codes for ln(). This is required by the
     * SQL standard.
     */
    if (arg1 == 0.0)
        ereport(ERROR,
                (errcode(ERRCODE_INVALID_ARGUMENT_FOR_LOG),
                 errmsg("cannot take logarithm of zero")));
    if (arg1 < 0)
        ereport(ERROR,
                (errcode(ERRCODE_INVALID_ARGUMENT_FOR_LOG),
                 errmsg("cannot take logarithm of a negative number")));

    result = log(arg1);

    CHECKFLOATVAL(result, isinf(arg1), arg1 == 1);
    PG_RETURN_FLOAT8(result);
}

Datum dlog10 ( PG_FUNCTION_ARGS   ) 

Definition at line 1493 of file float.c.

References CHECKFLOATVAL, ereport, errcode(), errmsg(), ERROR, isinf(), PG_GETARG_FLOAT8, and PG_RETURN_FLOAT8.

{
    float8      arg1 = PG_GETARG_FLOAT8(0);
    float8      result;

    /*
     * Emit particular SQLSTATE error codes for log(). The SQL spec doesn't
     * define log(), but it does define ln(), so it makes sense to emit the
     * same error code for an analogous error condition.
     */
    if (arg1 == 0.0)
        ereport(ERROR,
                (errcode(ERRCODE_INVALID_ARGUMENT_FOR_LOG),
                 errmsg("cannot take logarithm of zero")));
    if (arg1 < 0)
        ereport(ERROR,
                (errcode(ERRCODE_INVALID_ARGUMENT_FOR_LOG),
                 errmsg("cannot take logarithm of a negative number")));

    result = log10(arg1);

    CHECKFLOATVAL(result, isinf(arg1), arg1 == 1);
    PG_RETURN_FLOAT8(result);
}

void domain_check ( Datum  value,
bool  isnull,
Oid  domainType,
void **  extra,
MemoryContext  mcxt 
)

Definition at line 319 of file domains.c.

References CurrentMemoryContext, domain_check_input(), domain_state_setup(), DomainIOData::domain_type, MemoryContextAlloc(), and NULL.

Referenced by PLyObject_ToBool(), and PLyObject_ToBytea().

{
    DomainIOData *my_extra = NULL;

    if (mcxt == NULL)
        mcxt = CurrentMemoryContext;

    /*
     * We arrange to look up the needed info just once per series of calls,
     * assuming the domain type doesn't change underneath us.
     */
    if (extra)
        my_extra = (DomainIOData *) *extra;
    if (my_extra == NULL)
    {
        my_extra = (DomainIOData *) MemoryContextAlloc(mcxt,
                                                       sizeof(DomainIOData));
        domain_state_setup(my_extra, domainType, true, mcxt);
        if (extra)
            *extra = (void *) my_extra;
    }
    else if (my_extra->domain_type != domainType)
        domain_state_setup(my_extra, domainType, true, mcxt);

    /*
     * Do the necessary checks to ensure it's a valid domain value.
     */
    domain_check_input(value, isnull, my_extra);
}

Datum domain_in ( PG_FUNCTION_ARGS   ) 

Definition at line 196 of file domains.c.

References domain_check_input(), domain_state_setup(), DomainIOData::domain_type, InputFunctionCall(), MemoryContextAlloc(), NULL, PG_ARGISNULL, PG_GETARG_CSTRING, PG_GETARG_OID, PG_RETURN_DATUM, PG_RETURN_NULL, DomainIOData::proc, DomainIOData::typioparam, DomainIOData::typtypmod, and value.

{
    char       *string;
    Oid         domainType;
    DomainIOData *my_extra;
    Datum       value;

    /*
     * Since domain_in is not strict, we have to check for null inputs. The
     * typioparam argument should never be null in normal system usage, but it
     * could be null in a manual invocation --- if so, just return null.
     */
    if (PG_ARGISNULL(0))
        string = NULL;
    else
        string = PG_GETARG_CSTRING(0);
    if (PG_ARGISNULL(1))
        PG_RETURN_NULL();
    domainType = PG_GETARG_OID(1);

    /*
     * We arrange to look up the needed info just once per series of calls,
     * assuming the domain type doesn't change underneath us.
     */
    my_extra = (DomainIOData *) fcinfo->flinfo->fn_extra;
    if (my_extra == NULL)
    {
        my_extra = (DomainIOData *) MemoryContextAlloc(fcinfo->flinfo->fn_mcxt,
                                                       sizeof(DomainIOData));
        domain_state_setup(my_extra, domainType, false,
                           fcinfo->flinfo->fn_mcxt);
        fcinfo->flinfo->fn_extra = (void *) my_extra;
    }
    else if (my_extra->domain_type != domainType)
        domain_state_setup(my_extra, domainType, false,
                           fcinfo->flinfo->fn_mcxt);

    /*
     * Invoke the base type's typinput procedure to convert the data.
     */
    value = InputFunctionCall(&my_extra->proc,
                              string,
                              my_extra->typioparam,
                              my_extra->typtypmod);

    /*
     * Do the necessary checks to ensure it's a valid domain value.
     */
    domain_check_input(value, (string == NULL), my_extra);

    if (string == NULL)
        PG_RETURN_NULL();
    else
        PG_RETURN_DATUM(value);
}

Datum domain_recv ( PG_FUNCTION_ARGS   ) 

Definition at line 256 of file domains.c.

References buf, domain_check_input(), domain_state_setup(), DomainIOData::domain_type, MemoryContextAlloc(), NULL, PG_ARGISNULL, PG_GETARG_OID, PG_GETARG_POINTER, PG_RETURN_DATUM, PG_RETURN_NULL, DomainIOData::proc, ReceiveFunctionCall(), DomainIOData::typioparam, DomainIOData::typtypmod, and value.

{
    StringInfo  buf;
    Oid         domainType;
    DomainIOData *my_extra;
    Datum       value;

    /*
     * Since domain_recv is not strict, we have to check for null inputs. The
     * typioparam argument should never be null in normal system usage, but it
     * could be null in a manual invocation --- if so, just return null.
     */
    if (PG_ARGISNULL(0))
        buf = NULL;
    else
        buf = (StringInfo) PG_GETARG_POINTER(0);
    if (PG_ARGISNULL(1))
        PG_RETURN_NULL();
    domainType = PG_GETARG_OID(1);

    /*
     * We arrange to look up the needed info just once per series of calls,
     * assuming the domain type doesn't change underneath us.
     */
    my_extra = (DomainIOData *) fcinfo->flinfo->fn_extra;
    if (my_extra == NULL)
    {
        my_extra = (DomainIOData *) MemoryContextAlloc(fcinfo->flinfo->fn_mcxt,
                                                       sizeof(DomainIOData));
        domain_state_setup(my_extra, domainType, true,
                           fcinfo->flinfo->fn_mcxt);
        fcinfo->flinfo->fn_extra = (void *) my_extra;
    }
    else if (my_extra->domain_type != domainType)
        domain_state_setup(my_extra, domainType, true,
                           fcinfo->flinfo->fn_mcxt);

    /*
     * Invoke the base type's typreceive procedure to convert the data.
     */
    value = ReceiveFunctionCall(&my_extra->proc,
                                buf,
                                my_extra->typioparam,
                                my_extra->typtypmod);

    /*
     * Do the necessary checks to ensure it's a valid domain value.
     */
    domain_check_input(value, (buf == NULL), my_extra);

    if (buf == NULL)
        PG_RETURN_NULL();
    else
        PG_RETURN_DATUM(value);
}

Datum dpi ( PG_FUNCTION_ARGS   ) 

Definition at line 1713 of file float.c.

References M_PI, and PG_RETURN_FLOAT8.

Datum dpow ( PG_FUNCTION_ARGS   ) 

Definition at line 1392 of file float.c.

References CHECKFLOATVAL, ereport, errcode(), errmsg(), ERROR, get_float8_infinity(), isinf(), PG_GETARG_FLOAT8, and PG_RETURN_FLOAT8.

{
    float8      arg1 = PG_GETARG_FLOAT8(0);
    float8      arg2 = PG_GETARG_FLOAT8(1);
    float8      result;

    /*
     * The SQL spec requires that we emit a particular SQLSTATE error code for
     * certain error conditions.  Specifically, we don't return a
     * divide-by-zero error code for 0 ^ -1.
     */
    if (arg1 == 0 && arg2 < 0)
        ereport(ERROR,
                (errcode(ERRCODE_INVALID_ARGUMENT_FOR_POWER_FUNCTION),
                 errmsg("zero raised to a negative power is undefined")));
    if (arg1 < 0 && floor(arg2) != arg2)
        ereport(ERROR,
                (errcode(ERRCODE_INVALID_ARGUMENT_FOR_POWER_FUNCTION),
                 errmsg("a negative number raised to a non-integer power yields a complex result")));

    /*
     * pow() sets errno only on some platforms, depending on whether it
     * follows _IEEE_, _POSIX_, _XOPEN_, or _SVID_, so we try to avoid using
     * errno.  However, some platform/CPU combinations return errno == EDOM
     * and result == Nan for negative arg1 and very large arg2 (they must be
     * using something different from our floor() test to decide it's
     * invalid).  Other platforms (HPPA) return errno == ERANGE and a large
     * (HUGE_VAL) but finite result to signal overflow.
     */
    errno = 0;
    result = pow(arg1, arg2);
    if (errno == EDOM && isnan(result))
    {
        if ((fabs(arg1) > 1 && arg2 >= 0) || (fabs(arg1) < 1 && arg2 < 0))
            /* The sign of Inf is not significant in this case. */
            result = get_float8_infinity();
        else if (fabs(arg1) != 1)
            result = 0;
        else
            result = 1;
    }
    else if (errno == ERANGE && result != 0 && !isinf(result))
        result = get_float8_infinity();

    CHECKFLOATVAL(result, isinf(arg1) || isinf(arg2), arg1 == 0);
    PG_RETURN_FLOAT8(result);
}

Datum drandom ( PG_FUNCTION_ARGS   ) 

Definition at line 1739 of file float.c.

References MAX_RANDOM_VALUE, PG_RETURN_FLOAT8, and random().

{
    float8      result;

    /* result [0.0 - 1.0) */
    result = (double) random() / ((double) MAX_RANDOM_VALUE + 1);

    PG_RETURN_FLOAT8(result);
}

Datum dround ( PG_FUNCTION_ARGS   ) 

Definition at line 1278 of file float.c.

References PG_GETARG_FLOAT8, PG_RETURN_FLOAT8, and rint().

Datum dsign ( PG_FUNCTION_ARGS   ) 

Definition at line 1315 of file float.c.

References PG_GETARG_FLOAT8, and PG_RETURN_FLOAT8.

{
    float8      arg1 = PG_GETARG_FLOAT8(0);
    float8      result;

    if (arg1 > 0)
        result = 1.0;
    else if (arg1 < 0)
        result = -1.0;
    else
        result = 0.0;

    PG_RETURN_FLOAT8(result);
}

Datum dsin ( PG_FUNCTION_ARGS   ) 

Definition at line 1655 of file float.c.

References CHECKFLOATVAL, ereport, errcode(), errmsg(), ERROR, isinf(), PG_GETARG_FLOAT8, and PG_RETURN_FLOAT8.

{
    float8      arg1 = PG_GETARG_FLOAT8(0);
    float8      result;

    errno = 0;
    result = sin(arg1);
    if (errno != 0)
        ereport(ERROR,
                (errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
                 errmsg("input is out of range")));

    CHECKFLOATVAL(result, isinf(arg1), true);
    PG_RETURN_FLOAT8(result);
}

Datum dsqrt ( PG_FUNCTION_ARGS   ) 

Definition at line 1356 of file float.c.

References CHECKFLOATVAL, ereport, errcode(), errmsg(), ERROR, isinf(), PG_GETARG_FLOAT8, and PG_RETURN_FLOAT8.

{
    float8      arg1 = PG_GETARG_FLOAT8(0);
    float8      result;

    if (arg1 < 0)
        ereport(ERROR,
                (errcode(ERRCODE_INVALID_ARGUMENT_FOR_POWER_FUNCTION),
                 errmsg("cannot take square root of a negative number")));

    result = sqrt(arg1);

    CHECKFLOATVAL(result, isinf(arg1), arg1 == 0);
    PG_RETURN_FLOAT8(result);
}

Datum dtan ( PG_FUNCTION_ARGS   ) 

Definition at line 1676 of file float.c.

References CHECKFLOATVAL, ereport, errcode(), errmsg(), ERROR, PG_GETARG_FLOAT8, and PG_RETURN_FLOAT8.

{
    float8      arg1 = PG_GETARG_FLOAT8(0);
    float8      result;

    errno = 0;
    result = tan(arg1);
    if (errno != 0)
        ereport(ERROR,
                (errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
                 errmsg("input is out of range")));

    CHECKFLOATVAL(result, true /* tan(pi/2) == Inf */ , true);
    PG_RETURN_FLOAT8(result);
}

Datum dtof ( PG_FUNCTION_ARGS   ) 

Definition at line 1139 of file float.c.

References CHECKFLOATVAL, isinf(), PG_GETARG_FLOAT8, and PG_RETURN_FLOAT4.

{
    float8      num = PG_GETARG_FLOAT8(0);

    CHECKFLOATVAL((float4) num, isinf(num), num == 0);

    PG_RETURN_FLOAT4((float4) num);
}

Datum dtoi2 ( PG_FUNCTION_ARGS   ) 

Definition at line 1173 of file float.c.

References ereport, errcode(), errmsg(), ERROR, PG_GETARG_FLOAT8, PG_RETURN_INT16, and rint().

{
    float8      num = PG_GETARG_FLOAT8(0);

    if (num < SHRT_MIN || num > SHRT_MAX || isnan(num))
        ereport(ERROR,
                (errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
                 errmsg("smallint out of range")));

    PG_RETURN_INT16((int16) rint(num));
}

Datum dtoi4 ( PG_FUNCTION_ARGS   ) 

Definition at line 1153 of file float.c.

References ereport, errcode(), errmsg(), ERROR, PG_GETARG_FLOAT8, PG_RETURN_INT32, and rint().

{
    float8      num = PG_GETARG_FLOAT8(0);
    int32       result;

    /* 'Inf' is handled by INT_MAX */
    if (num < INT_MIN || num > INT_MAX || isnan(num))
        ereport(ERROR,
                (errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
                 errmsg("integer out of range")));

    result = (int32) rint(num);
    PG_RETURN_INT32(result);
}

Datum dtrunc ( PG_FUNCTION_ARGS   ) 

Definition at line 1338 of file float.c.

References PG_GETARG_FLOAT8, and PG_RETURN_FLOAT8.

{
    float8      arg1 = PG_GETARG_FLOAT8(0);
    float8      result;

    if (arg1 >= 0)
        result = floor(arg1);
    else
        result = -floor(-arg1);

    PG_RETURN_FLOAT8(result);
}

Datum enum_cmp ( PG_FUNCTION_ARGS   ) 

Definition at line 285 of file enum.c.

References enum_cmp_internal(), PG_GETARG_OID, and PG_RETURN_INT32.

{
    Oid         a = PG_GETARG_OID(0);
    Oid         b = PG_GETARG_OID(1);

    if (a == b)
        PG_RETURN_INT32(0);
    else if (enum_cmp_internal(a, b, fcinfo) > 0)
        PG_RETURN_INT32(1);
    else
        PG_RETURN_INT32(-1);
}

Datum enum_eq ( PG_FUNCTION_ARGS   ) 

Definition at line 231 of file enum.c.

References PG_GETARG_OID, and PG_RETURN_BOOL.

{
    Oid         a = PG_GETARG_OID(0);
    Oid         b = PG_GETARG_OID(1);

    PG_RETURN_BOOL(a == b);
}

Datum enum_first ( PG_FUNCTION_ARGS   ) 

Definition at line 343 of file enum.c.

References enum_endpoint(), ereport, errcode(), errmsg(), ERROR, format_type_be(), ForwardScanDirection, get_fn_expr_argtype(), InvalidOid, OidIsValid, and PG_RETURN_OID.

{
    Oid         enumtypoid;
    Oid         min;

    /*
     * We rely on being able to get the specific enum type from the calling
     * expression tree.  Notice that the actual value of the argument isn't
     * examined at all; in particular it might be NULL.
     */
    enumtypoid = get_fn_expr_argtype(fcinfo->flinfo, 0);
    if (enumtypoid == InvalidOid)
        ereport(ERROR,
                (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
                 errmsg("could not determine actual enum type")));

    /* Get the OID using the index */
    min = enum_endpoint(enumtypoid, ForwardScanDirection);

    if (!OidIsValid(min))
        ereport(ERROR,
                (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
                 errmsg("enum %s contains no values",
                        format_type_be(enumtypoid))));

    PG_RETURN_OID(min);
}

Datum enum_ge ( PG_FUNCTION_ARGS   ) 

Definition at line 249 of file enum.c.

References enum_cmp_internal(), PG_GETARG_OID, and PG_RETURN_BOOL.

{
    Oid         a = PG_GETARG_OID(0);
    Oid         b = PG_GETARG_OID(1);

    PG_RETURN_BOOL(enum_cmp_internal(a, b, fcinfo) >= 0);
}

Datum enum_gt ( PG_FUNCTION_ARGS   ) 

Definition at line 258 of file enum.c.

References enum_cmp_internal(), PG_GETARG_OID, and PG_RETURN_BOOL.

{
    Oid         a = PG_GETARG_OID(0);
    Oid         b = PG_GETARG_OID(1);

    PG_RETURN_BOOL(enum_cmp_internal(a, b, fcinfo) > 0);
}

Datum enum_in ( PG_FUNCTION_ARGS   ) 

Definition at line 37 of file enum.c.

References CStringGetDatum, ENUMTYPOIDNAME, ereport, errcode(), errmsg(), ERROR, format_type_be(), HeapTupleGetOid, HeapTupleIsValid, name, NAMEDATALEN, ObjectIdGetDatum, PG_GETARG_CSTRING, PG_GETARG_OID, PG_RETURN_OID, ReleaseSysCache(), and SearchSysCache2.

{
    char       *name = PG_GETARG_CSTRING(0);
    Oid         enumtypoid = PG_GETARG_OID(1);
    Oid         enumoid;
    HeapTuple   tup;

    /* must check length to prevent Assert failure within SearchSysCache */
    if (strlen(name) >= NAMEDATALEN)
        ereport(ERROR,
                (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
                 errmsg("invalid input value for enum %s: \"%s\"",
                        format_type_be(enumtypoid),
                        name)));

    tup = SearchSysCache2(ENUMTYPOIDNAME,
                          ObjectIdGetDatum(enumtypoid),
                          CStringGetDatum(name));
    if (!HeapTupleIsValid(tup))
        ereport(ERROR,
                (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
                 errmsg("invalid input value for enum %s: \"%s\"",
                        format_type_be(enumtypoid),
                        name)));

    /*
     * This comes from pg_enum.oid and stores system oids in user tables. This
     * oid must be preserved by binary upgrades.
     */
    enumoid = HeapTupleGetOid(tup);

    ReleaseSysCache(tup);

    PG_RETURN_OID(enumoid);
}

Datum enum_larger ( PG_FUNCTION_ARGS   ) 

Definition at line 276 of file enum.c.

References enum_cmp_internal(), PG_GETARG_OID, and PG_RETURN_OID.

{
    Oid         a = PG_GETARG_OID(0);
    Oid         b = PG_GETARG_OID(1);

    PG_RETURN_OID(enum_cmp_internal(a, b, fcinfo) > 0 ? a : b);
}

Datum enum_last ( PG_FUNCTION_ARGS   ) 

Definition at line 372 of file enum.c.

References BackwardScanDirection, enum_endpoint(), ereport, errcode(), errmsg(), ERROR, format_type_be(), get_fn_expr_argtype(), InvalidOid, OidIsValid, and PG_RETURN_OID.

{
    Oid         enumtypoid;
    Oid         max;

    /*
     * We rely on being able to get the specific enum type from the calling
     * expression tree.  Notice that the actual value of the argument isn't
     * examined at all; in particular it might be NULL.
     */
    enumtypoid = get_fn_expr_argtype(fcinfo->flinfo, 0);
    if (enumtypoid == InvalidOid)
        ereport(ERROR,
                (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
                 errmsg("could not determine actual enum type")));

    /* Get the OID using the index */
    max = enum_endpoint(enumtypoid, BackwardScanDirection);

    if (!OidIsValid(max))
        ereport(ERROR,
                (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
                 errmsg("enum %s contains no values",
                        format_type_be(enumtypoid))));

    PG_RETURN_OID(max);
}

Datum enum_le ( PG_FUNCTION_ARGS   ) 

Definition at line 222 of file enum.c.

References enum_cmp_internal(), PG_GETARG_OID, and PG_RETURN_BOOL.

{
    Oid         a = PG_GETARG_OID(0);
    Oid         b = PG_GETARG_OID(1);

    PG_RETURN_BOOL(enum_cmp_internal(a, b, fcinfo) <= 0);
}

Datum enum_lt ( PG_FUNCTION_ARGS   ) 

Definition at line 213 of file enum.c.

References enum_cmp_internal(), PG_GETARG_OID, and PG_RETURN_BOOL.

{
    Oid         a = PG_GETARG_OID(0);
    Oid         b = PG_GETARG_OID(1);

    PG_RETURN_BOOL(enum_cmp_internal(a, b, fcinfo) < 0);
}

Datum enum_ne ( PG_FUNCTION_ARGS   ) 

Definition at line 240 of file enum.c.

References PG_GETARG_OID, and PG_RETURN_BOOL.

{
    Oid         a = PG_GETARG_OID(0);
    Oid         b = PG_GETARG_OID(1);

    PG_RETURN_BOOL(a != b);
}

Datum enum_out ( PG_FUNCTION_ARGS   ) 

Definition at line 74 of file enum.c.

References ENUMOID, ereport, errcode(), errmsg(), ERROR, GETSTRUCT, HeapTupleIsValid, NameStr, ObjectIdGetDatum, PG_GETARG_OID, PG_RETURN_CSTRING, pstrdup(), ReleaseSysCache(), and SearchSysCache1.

Referenced by anyenum_out().

{
    Oid         enumval = PG_GETARG_OID(0);
    char       *result;
    HeapTuple   tup;
    Form_pg_enum en;

    tup = SearchSysCache1(ENUMOID, ObjectIdGetDatum(enumval));
    if (!HeapTupleIsValid(tup))
        ereport(ERROR,
                (errcode(ERRCODE_INVALID_BINARY_REPRESENTATION),
                 errmsg("invalid internal value for enum: %u",
                        enumval)));
    en = (Form_pg_enum) GETSTRUCT(tup);

    result = pstrdup(NameStr(en->enumlabel));

    ReleaseSysCache(tup);

    PG_RETURN_CSTRING(result);
}

Datum enum_range_all ( PG_FUNCTION_ARGS   ) 

Definition at line 433 of file enum.c.

References enum_range_internal(), ereport, errcode(), errmsg(), ERROR, get_fn_expr_argtype(), InvalidOid, and PG_RETURN_ARRAYTYPE_P.

{
    Oid         enumtypoid;

    /*
     * We rely on being able to get the specific enum type from the calling
     * expression tree.  Notice that the actual value of the argument isn't
     * examined at all; in particular it might be NULL.
     */
    enumtypoid = get_fn_expr_argtype(fcinfo->flinfo, 0);
    if (enumtypoid == InvalidOid)
        ereport(ERROR,
                (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
                 errmsg("could not determine actual enum type")));

    PG_RETURN_ARRAYTYPE_P(enum_range_internal(enumtypoid,
                                              InvalidOid, InvalidOid));
}

Datum enum_range_bounds ( PG_FUNCTION_ARGS   ) 

Definition at line 402 of file enum.c.

References enum_range_internal(), ereport, errcode(), errmsg(), ERROR, get_fn_expr_argtype(), InvalidOid, PG_ARGISNULL, PG_GETARG_OID, and PG_RETURN_ARRAYTYPE_P.

{
    Oid         lower;
    Oid         upper;
    Oid         enumtypoid;

    if (PG_ARGISNULL(0))
        lower = InvalidOid;
    else
        lower = PG_GETARG_OID(0);
    if (PG_ARGISNULL(1))
        upper = InvalidOid;
    else
        upper = PG_GETARG_OID(1);

    /*
     * We rely on being able to get the specific enum type from the calling
     * expression tree.  The generic type mechanism should have ensured that
     * both are of the same type.
     */
    enumtypoid = get_fn_expr_argtype(fcinfo->flinfo, 0);
    if (enumtypoid == InvalidOid)
        ereport(ERROR,
                (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
                 errmsg("could not determine actual enum type")));

    PG_RETURN_ARRAYTYPE_P(enum_range_internal(enumtypoid, lower, upper));
}

Datum enum_recv ( PG_FUNCTION_ARGS   ) 

Definition at line 98 of file enum.c.

References buf, CStringGetDatum, StringInfoData::cursor, ENUMTYPOIDNAME, ereport, errcode(), errmsg(), ERROR, format_type_be(), HeapTupleGetOid, HeapTupleIsValid, StringInfoData::len, name, NAMEDATALEN, ObjectIdGetDatum, pfree(), PG_GETARG_OID, PG_GETARG_POINTER, PG_RETURN_OID, pq_getmsgtext(), ReleaseSysCache(), and SearchSysCache2.

{
    StringInfo  buf = (StringInfo) PG_GETARG_POINTER(0);
    Oid         enumtypoid = PG_GETARG_OID(1);
    Oid         enumoid;
    HeapTuple   tup;
    char       *name;
    int         nbytes;

    name = pq_getmsgtext(buf, buf->len - buf->cursor, &nbytes);

    /* must check length to prevent Assert failure within SearchSysCache */
    if (strlen(name) >= NAMEDATALEN)
        ereport(ERROR,
                (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
                 errmsg("invalid input value for enum %s: \"%s\"",
                        format_type_be(enumtypoid),
                        name)));

    tup = SearchSysCache2(ENUMTYPOIDNAME,
                          ObjectIdGetDatum(enumtypoid),
                          CStringGetDatum(name));
    if (!HeapTupleIsValid(tup))
        ereport(ERROR,
                (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
                 errmsg("invalid input value for enum %s: \"%s\"",
                        format_type_be(enumtypoid),
                        name)));

    enumoid = HeapTupleGetOid(tup);

    ReleaseSysCache(tup);

    pfree(name);

    PG_RETURN_OID(enumoid);
}

Datum enum_send ( PG_FUNCTION_ARGS   ) 

Definition at line 137 of file enum.c.

References buf, ENUMOID, ereport, errcode(), errmsg(), ERROR, GETSTRUCT, HeapTupleIsValid, NameStr, ObjectIdGetDatum, PG_GETARG_OID, PG_RETURN_BYTEA_P, pq_begintypsend(), pq_endtypsend(), pq_sendtext(), ReleaseSysCache(), and SearchSysCache1.

{
    Oid         enumval = PG_GETARG_OID(0);
    StringInfoData buf;
    HeapTuple   tup;
    Form_pg_enum en;

    tup = SearchSysCache1(ENUMOID, ObjectIdGetDatum(enumval));
    if (!HeapTupleIsValid(tup))
        ereport(ERROR,
                (errcode(ERRCODE_INVALID_BINARY_REPRESENTATION),
                 errmsg("invalid internal value for enum: %u",
                        enumval)));
    en = (Form_pg_enum) GETSTRUCT(tup);

    pq_begintypsend(&buf);
    pq_sendtext(&buf, NameStr(en->enumlabel), strlen(NameStr(en->enumlabel)));

    ReleaseSysCache(tup);

    PG_RETURN_BYTEA_P(pq_endtypsend(&buf));
}

Datum enum_smaller ( PG_FUNCTION_ARGS   ) 

Definition at line 267 of file enum.c.

References enum_cmp_internal(), PG_GETARG_OID, and PG_RETURN_OID.

{
    Oid         a = PG_GETARG_OID(0);
    Oid         b = PG_GETARG_OID(1);

    PG_RETURN_OID(enum_cmp_internal(a, b, fcinfo) < 0 ? a : b);
}

int errdatatype ( Oid  datatypeOid  ) 

Definition at line 355 of file domains.c.

References elog, err_generic_string(), ERROR, get_namespace_name(), GETSTRUCT, HeapTupleIsValid, NameStr, ObjectIdGetDatum, PG_DIAG_DATATYPE_NAME, PG_DIAG_SCHEMA_NAME, ReleaseSysCache(), SearchSysCache1, and TYPEOID.

Referenced by domain_check_input(), errdomainconstraint(), and ExecEvalCoerceToDomain().

{
    HeapTuple   tup;
    Form_pg_type typtup;

    tup = SearchSysCache1(TYPEOID, ObjectIdGetDatum(datatypeOid));
    if (!HeapTupleIsValid(tup))
        elog(ERROR, "cache lookup failed for type %u", datatypeOid);
    typtup = (Form_pg_type) GETSTRUCT(tup);

    err_generic_string(PG_DIAG_SCHEMA_NAME,
                       get_namespace_name(typtup->typnamespace));
    err_generic_string(PG_DIAG_DATATYPE_NAME, NameStr(typtup->typname));

    ReleaseSysCache(tup);

    return 0;                   /* return value does not matter */
}

int errdomainconstraint ( Oid  datatypeOid,
const char *  conname 
)

Definition at line 379 of file domains.c.

References err_generic_string(), errdatatype(), and PG_DIAG_CONSTRAINT_NAME.

Referenced by domain_check_input(), and ExecEvalCoerceToDomain().

{
    errdatatype(datatypeOid);
    err_generic_string(PG_DIAG_CONSTRAINT_NAME, conname);

    return 0;                   /* return value does not matter */
}

Datum event_trigger_in ( PG_FUNCTION_ARGS   ) 

Definition at line 299 of file pseudotypes.c.

References ereport, errcode(), errmsg(), ERROR, and PG_RETURN_VOID.

{
    ereport(ERROR,
            (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
             errmsg("cannot accept a value of type event_trigger")));

    PG_RETURN_VOID();           /* keep compiler quiet */
}

Datum event_trigger_out ( PG_FUNCTION_ARGS   ) 

Definition at line 312 of file pseudotypes.c.

References ereport, errcode(), errmsg(), ERROR, and PG_RETURN_VOID.

{
    ereport(ERROR,
            (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
             errmsg("cannot display a value of type event_trigger")));

    PG_RETURN_VOID();           /* keep compiler quiet */
}

Datum fdw_handler_in ( PG_FUNCTION_ARGS   ) 

Definition at line 353 of file pseudotypes.c.

References ereport, errcode(), errmsg(), ERROR, and PG_RETURN_VOID.

{
    ereport(ERROR,
            (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
             errmsg("cannot accept a value of type fdw_handler")));

    PG_RETURN_VOID();           /* keep compiler quiet */
}

Datum fdw_handler_out ( PG_FUNCTION_ARGS   ) 

Definition at line 366 of file pseudotypes.c.

References ereport, errcode(), errmsg(), ERROR, and PG_RETURN_VOID.

{
    ereport(ERROR,
            (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
             errmsg("cannot display a value of type fdw_handler")));

    PG_RETURN_VOID();           /* keep compiler quiet */
}

Datum float48div ( PG_FUNCTION_ARGS   ) 

Definition at line 2522 of file float.c.

References CHECKFLOATVAL, ereport, errcode(), errmsg(), ERROR, isinf(), PG_GETARG_FLOAT4, PG_GETARG_FLOAT8, and PG_RETURN_FLOAT8.

{
    float4      arg1 = PG_GETARG_FLOAT4(0);
    float8      arg2 = PG_GETARG_FLOAT8(1);
    float8      result;

    if (arg2 == 0.0)
        ereport(ERROR,
                (errcode(ERRCODE_DIVISION_BY_ZERO),
                 errmsg("division by zero")));

    result = arg1 / arg2;
    CHECKFLOATVAL(result, isinf(arg1) || isinf(arg2), arg1 == 0);
    PG_RETURN_FLOAT8(result);
}

Datum float48eq ( PG_FUNCTION_ARGS   ) 

Definition at line 2612 of file float.c.

References float8_cmp_internal(), PG_GETARG_FLOAT4, PG_GETARG_FLOAT8, and PG_RETURN_BOOL.

Datum float48ge ( PG_FUNCTION_ARGS   ) 

Definition at line 2657 of file float.c.

References float8_cmp_internal(), PG_GETARG_FLOAT4, PG_GETARG_FLOAT8, and PG_RETURN_BOOL.

Datum float48gt ( PG_FUNCTION_ARGS   ) 

Definition at line 2648 of file float.c.

References float8_cmp_internal(), PG_GETARG_FLOAT4, PG_GETARG_FLOAT8, and PG_RETURN_BOOL.

Datum float48le ( PG_FUNCTION_ARGS   ) 

Definition at line 2639 of file float.c.

References float8_cmp_internal(), PG_GETARG_FLOAT4, PG_GETARG_FLOAT8, and PG_RETURN_BOOL.

Datum float48lt ( PG_FUNCTION_ARGS   ) 

Definition at line 2630 of file float.c.

References float8_cmp_internal(), PG_GETARG_FLOAT4, PG_GETARG_FLOAT8, and PG_RETURN_BOOL.

Datum float48mi ( PG_FUNCTION_ARGS   ) 

Definition at line 2497 of file float.c.

References CHECKFLOATVAL, isinf(), PG_GETARG_FLOAT4, PG_GETARG_FLOAT8, and PG_RETURN_FLOAT8.

{
    float4      arg1 = PG_GETARG_FLOAT4(0);
    float8      arg2 = PG_GETARG_FLOAT8(1);
    float8      result;

    result = arg1 - arg2;
    CHECKFLOATVAL(result, isinf(arg1) || isinf(arg2), true);
    PG_RETURN_FLOAT8(result);
}

Datum float48mul ( PG_FUNCTION_ARGS   ) 

Definition at line 2509 of file float.c.

References CHECKFLOATVAL, isinf(), PG_GETARG_FLOAT4, PG_GETARG_FLOAT8, and PG_RETURN_FLOAT8.

{
    float4      arg1 = PG_GETARG_FLOAT4(0);
    float8      arg2 = PG_GETARG_FLOAT8(1);
    float8      result;

    result = arg1 * arg2;
    CHECKFLOATVAL(result, isinf(arg1) || isinf(arg2),
                  arg1 == 0 || arg2 == 0);
    PG_RETURN_FLOAT8(result);
}

Datum float48ne ( PG_FUNCTION_ARGS   ) 

Definition at line 2621 of file float.c.

References float8_cmp_internal(), PG_GETARG_FLOAT4, PG_GETARG_FLOAT8, and PG_RETURN_BOOL.

Datum float48pl ( PG_FUNCTION_ARGS   ) 

Definition at line 2485 of file float.c.

References CHECKFLOATVAL, isinf(), PG_GETARG_FLOAT4, PG_GETARG_FLOAT8, and PG_RETURN_FLOAT8.

{
    float4      arg1 = PG_GETARG_FLOAT4(0);
    float8      arg2 = PG_GETARG_FLOAT8(1);
    float8      result;

    result = arg1 + arg2;
    CHECKFLOATVAL(result, isinf(arg1) || isinf(arg2), true);
    PG_RETURN_FLOAT8(result);
}

Datum float4_accum ( PG_FUNCTION_ARGS   ) 

Definition at line 1860 of file float.c.

References AggCheckCallContext(), check_float8_array(), CHECKFLOATVAL, construct_array(), Float8GetDatumFast, FLOAT8OID, isinf(), NULL, PG_GETARG_ARRAYTYPE_P, PG_GETARG_FLOAT4, and PG_RETURN_ARRAYTYPE_P.

{
    ArrayType  *transarray = PG_GETARG_ARRAYTYPE_P(0);

    /* do computations as float8 */
    float8      newval = PG_GETARG_FLOAT4(1);
    float8     *transvalues;
    float8      N,
                sumX,
                sumX2;

    transvalues = check_float8_array(transarray, "float4_accum", 3);
    N = transvalues[0];
    sumX = transvalues[1];
    sumX2 = transvalues[2];

    N += 1.0;
    sumX += newval;
    CHECKFLOATVAL(sumX, isinf(transvalues[1]) || isinf(newval), true);
    sumX2 += newval * newval;
    CHECKFLOATVAL(sumX2, isinf(transvalues[2]) || isinf(newval), true);

    /*
     * If we're invoked as an aggregate, we can cheat and modify our first
     * parameter in-place to reduce palloc overhead. Otherwise we construct a
     * new array with the updated transition data and return it.
     */
    if (AggCheckCallContext(fcinfo, NULL))
    {
        transvalues[0] = N;
        transvalues[1] = sumX;
        transvalues[2] = sumX2;

        PG_RETURN_ARRAYTYPE_P(transarray);
    }
    else
    {
        Datum       transdatums[3];
        ArrayType  *result;

        transdatums[0] = Float8GetDatumFast(N);
        transdatums[1] = Float8GetDatumFast(sumX);
        transdatums[2] = Float8GetDatumFast(sumX2);

        result = construct_array(transdatums, 3,
                                 FLOAT8OID,
                                 sizeof(float8), FLOAT8PASSBYVAL, 'd');

        PG_RETURN_ARRAYTYPE_P(result);
    }
}

Datum float4_numeric ( PG_FUNCTION_ARGS   ) 

Definition at line 2417 of file numeric.c.

References buf, free_var(), init_var, make_result(), PG_GETARG_FLOAT4, PG_RETURN_NUMERIC, set_var_from_str(), and val.

{
    float4      val = PG_GETARG_FLOAT4(0);
    Numeric     res;
    NumericVar  result;
    char        buf[FLT_DIG + 100];

    if (isnan(val))
        PG_RETURN_NUMERIC(make_result(&const_nan));

    sprintf(buf, "%.*g", FLT_DIG, val);

    init_var(&result);

    /* Assume we need not worry about leading/trailing spaces */
    (void) set_var_from_str(buf, buf, &result);

    res = make_result(&result);

    free_var(&result);

    PG_RETURN_NUMERIC(res);
}

Datum float4abs ( PG_FUNCTION_ARGS   ) 

Definition at line 598 of file float.c.

References PG_GETARG_FLOAT4, and PG_RETURN_FLOAT4.

{
    float4      arg1 = PG_GETARG_FLOAT4(0);

    PG_RETURN_FLOAT4((float4) fabs(arg1));
}

Datum float4div ( PG_FUNCTION_ARGS   ) 

Definition at line 780 of file float.c.

References CHECKFLOATVAL, ereport, errcode(), errmsg(), ERROR, isinf(), PG_GETARG_FLOAT4, and PG_RETURN_FLOAT4.

{
    float4      arg1 = PG_GETARG_FLOAT4(0);
    float4      arg2 = PG_GETARG_FLOAT4(1);
    float4      result;

    if (arg2 == 0.0)
        ereport(ERROR,
                (errcode(ERRCODE_DIVISION_BY_ZERO),
                 errmsg("division by zero")));

    result = arg1 / arg2;

    CHECKFLOATVAL(result, isinf(arg1) || isinf(arg2), arg1 == 0);
    PG_RETURN_FLOAT4(result);
}

Datum float4eq ( PG_FUNCTION_ARGS   ) 

Definition at line 902 of file float.c.

References float4_cmp_internal(), PG_GETARG_FLOAT4, and PG_RETURN_BOOL.

Datum float4ge ( PG_FUNCTION_ARGS   ) 

Definition at line 947 of file float.c.

References float4_cmp_internal(), PG_GETARG_FLOAT4, and PG_RETURN_BOOL.

Datum float4gt ( PG_FUNCTION_ARGS   ) 

Definition at line 938 of file float.c.

References float4_cmp_internal(), PG_GETARG_FLOAT4, and PG_RETURN_BOOL.

Datum float4in ( PG_FUNCTION_ARGS   ) 

Definition at line 186 of file float.c.

References CHECKFLOATVAL, ereport, errcode(), errmsg(), ERROR, get_float4_infinity(), get_float4_nan(), isinf(), PG_GETARG_CSTRING, PG_RETURN_FLOAT4, pg_strncasecmp(), and val.

Referenced by numeric_float4().

{
    char       *num = PG_GETARG_CSTRING(0);
    char       *orig_num;
    double      val;
    char       *endptr;

    /*
     * endptr points to the first character _after_ the sequence we recognized
     * as a valid floating point number. orig_num points to the original input
     * string.
     */
    orig_num = num;

    /*
     * Check for an empty-string input to begin with, to avoid the vagaries of
     * strtod() on different platforms.
     */
    if (*num == '\0')
        ereport(ERROR,
                (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
                 errmsg("invalid input syntax for type real: \"%s\"",
                        orig_num)));

    /* skip leading whitespace */
    while (*num != '\0' && isspace((unsigned char) *num))
        num++;

    errno = 0;
    val = strtod(num, &endptr);

    /* did we not see anything that looks like a double? */
    if (endptr == num || errno != 0)
    {
        int         save_errno = errno;

        /*
         * C99 requires that strtod() accept NaN and [-]Infinity, but not all
         * platforms support that yet (and some accept them but set ERANGE
         * anyway...)  Therefore, we check for these inputs ourselves.
         */
        if (pg_strncasecmp(num, "NaN", 3) == 0)
        {
            val = get_float4_nan();
            endptr = num + 3;
        }
        else if (pg_strncasecmp(num, "Infinity", 8) == 0)
        {
            val = get_float4_infinity();
            endptr = num + 8;
        }
        else if (pg_strncasecmp(num, "-Infinity", 9) == 0)
        {
            val = -get_float4_infinity();
            endptr = num + 9;
        }
        else if (save_errno == ERANGE)
        {
            /*
             * Some platforms return ERANGE for denormalized numbers (those
             * that are not zero, but are too close to zero to have full
             * precision).  We'd prefer not to throw error for that, so try to
             * detect whether it's a "real" out-of-range condition by checking
             * to see if the result is zero or huge.
             */
            if (val == 0.0 || val >= HUGE_VAL || val <= -HUGE_VAL)
                ereport(ERROR,
                        (errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
                         errmsg("\"%s\" is out of range for type real",
                                orig_num)));
        }
        else
            ereport(ERROR,
                    (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
                     errmsg("invalid input syntax for type real: \"%s\"",
                            orig_num)));
    }
#ifdef HAVE_BUGGY_SOLARIS_STRTOD
    else
    {
        /*
         * Many versions of Solaris have a bug wherein strtod sets endptr to
         * point one byte beyond the end of the string when given "inf" or
         * "infinity".
         */
        if (endptr != num && endptr[-1] == '\0')
            endptr--;
    }
#endif   /* HAVE_BUGGY_SOLARIS_STRTOD */

#ifdef HAVE_BUGGY_IRIX_STRTOD

    /*
     * In some IRIX versions, strtod() recognizes only "inf", so if the input
     * is "infinity" we have to skip over "inity".  Also, it may return
     * positive infinity for "-inf".
     */
    if (isinf(val))
    {
        if (pg_strncasecmp(num, "Infinity", 8) == 0)
        {
            val = get_float4_infinity();
            endptr = num + 8;
        }
        else if (pg_strncasecmp(num, "-Infinity", 9) == 0)
        {
            val = -get_float4_infinity();
            endptr = num + 9;
        }
        else if (pg_strncasecmp(num, "-inf", 4) == 0)
        {
            val = -get_float4_infinity();
            endptr = num + 4;
        }
    }
#endif   /* HAVE_BUGGY_IRIX_STRTOD */

    /* skip trailing whitespace */
    while (*endptr != '\0' && isspace((unsigned char) *endptr))
        endptr++;

    /* if there is any junk left at the end of the string, bail out */
    if (*endptr != '\0')
        ereport(ERROR,
                (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
                 errmsg("invalid input syntax for type real: \"%s\"",
                        orig_num)));

    /*
     * if we get here, we have a legal double, still need to check to see if
     * it's a legal float4
     */
    CHECKFLOATVAL((float4) val, isinf(val), val == 0);

    PG_RETURN_FLOAT4((float4) val);
}

Datum float4larger ( PG_FUNCTION_ARGS   ) 

Definition at line 627 of file float.c.

References float4_cmp_internal(), PG_GETARG_FLOAT4, and PG_RETURN_FLOAT4.

{
    float4      arg1 = PG_GETARG_FLOAT4(0);
    float4      arg2 = PG_GETARG_FLOAT4(1);
    float4      result;

    if (float4_cmp_internal(arg1, arg2) > 0)
        result = arg1;
    else
        result = arg2;
    PG_RETURN_FLOAT4(result);
}

Datum float4le ( PG_FUNCTION_ARGS   ) 

Definition at line 929 of file float.c.

References float4_cmp_internal(), PG_GETARG_FLOAT4, and PG_RETURN_BOOL.

Datum float4lt ( PG_FUNCTION_ARGS   ) 

Definition at line 920 of file float.c.

References float4_cmp_internal(), PG_GETARG_FLOAT4, and PG_RETURN_BOOL.

Datum float4mi ( PG_FUNCTION_ARGS   ) 

Definition at line 755 of file float.c.

References CHECKFLOATVAL, isinf(), PG_GETARG_FLOAT4, and PG_RETURN_FLOAT4.

{
    float4      arg1 = PG_GETARG_FLOAT4(0);
    float4      arg2 = PG_GETARG_FLOAT4(1);
    float4      result;

    result = arg1 - arg2;
    CHECKFLOATVAL(result, isinf(arg1) || isinf(arg2), true);
    PG_RETURN_FLOAT4(result);
}

Datum float4mul ( PG_FUNCTION_ARGS   ) 

Definition at line 767 of file float.c.

References CHECKFLOATVAL, isinf(), PG_GETARG_FLOAT4, and PG_RETURN_FLOAT4.

{
    float4      arg1 = PG_GETARG_FLOAT4(0);
    float4      arg2 = PG_GETARG_FLOAT4(1);
    float4      result;

    result = arg1 * arg2;
    CHECKFLOATVAL(result, isinf(arg1) || isinf(arg2),
                  arg1 == 0 || arg2 == 0);
    PG_RETURN_FLOAT4(result);
}

Datum float4ne ( PG_FUNCTION_ARGS   ) 

Definition at line 911 of file float.c.

References float4_cmp_internal(), PG_GETARG_FLOAT4, and PG_RETURN_BOOL.

Datum float4out ( PG_FUNCTION_ARGS   ) 

Definition at line 328 of file float.c.

References ascii(), extra_float_digits, is_infinite(), MAXFLOATWIDTH, palloc(), PG_GETARG_FLOAT4, PG_RETURN_CSTRING, and snprintf().

{
    float4      num = PG_GETARG_FLOAT4(0);
    char       *ascii = (char *) palloc(MAXFLOATWIDTH + 1);

    if (isnan(num))
        PG_RETURN_CSTRING(strcpy(ascii, "NaN"));

    switch (is_infinite(num))
    {
        case 1:
            strcpy(ascii, "Infinity");
            break;
        case -1:
            strcpy(ascii, "-Infinity");
            break;
        default:
            {
                int         ndig = FLT_DIG + extra_float_digits;

                if (ndig < 1)
                    ndig = 1;

                snprintf(ascii, MAXFLOATWIDTH + 1, "%.*g", ndig, num);
            }
    }

    PG_RETURN_CSTRING(ascii);
}

Datum float4pl ( PG_FUNCTION_ARGS   ) 

Definition at line 735 of file float.c.

References CHECKFLOATVAL, isinf(), PG_GETARG_FLOAT4, and PG_RETURN_FLOAT4.

{
    float4      arg1 = PG_GETARG_FLOAT4(0);
    float4      arg2 = PG_GETARG_FLOAT4(1);
    float4      result;

    result = arg1 + arg2;

    /*
     * There isn't any way to check for underflow of addition/subtraction
     * because numbers near the underflow value have already been rounded to
     * the point where we can't detect that the two values were originally
     * different, e.g. on x86, '1e-45'::float4 == '2e-45'::float4 ==
     * 1.4013e-45.
     */
    CHECKFLOATVAL(result, isinf(arg1) || isinf(arg2), true);
    PG_RETURN_FLOAT4(result);
}

Datum float4recv ( PG_FUNCTION_ARGS   ) 
Datum float4send ( PG_FUNCTION_ARGS   ) 
Datum float4smaller ( PG_FUNCTION_ARGS   ) 

Definition at line 641 of file float.c.

References float4_cmp_internal(), PG_GETARG_FLOAT4, and PG_RETURN_FLOAT4.

{
    float4      arg1 = PG_GETARG_FLOAT4(0);
    float4      arg2 = PG_GETARG_FLOAT4(1);
    float4      result;

    if (float4_cmp_internal(arg1, arg2) < 0)
        result = arg1;
    else
        result = arg2;
    PG_RETURN_FLOAT4(result);
}

Datum float4um ( PG_FUNCTION_ARGS   ) 

Definition at line 609 of file float.c.

References PG_GETARG_FLOAT4, and PG_RETURN_FLOAT4.

{
    float4      arg1 = PG_GETARG_FLOAT4(0);
    float4      result;

    result = -arg1;
    PG_RETURN_FLOAT4(result);
}

Datum float4up ( PG_FUNCTION_ARGS   ) 

Definition at line 619 of file float.c.

References arg, PG_GETARG_FLOAT4, and PG_RETURN_FLOAT4.

Datum float84div ( PG_FUNCTION_ARGS   ) 

Definition at line 2585 of file float.c.

References CHECKFLOATVAL, ereport, errcode(), errmsg(), ERROR, isinf(), PG_GETARG_FLOAT4, PG_GETARG_FLOAT8, and PG_RETURN_FLOAT8.

{
    float8      arg1 = PG_GETARG_FLOAT8(0);
    float4      arg2 = PG_GETARG_FLOAT4(1);
    float8      result;

    if (arg2 == 0.0)
        ereport(ERROR,
                (errcode(ERRCODE_DIVISION_BY_ZERO),
                 errmsg("division by zero")));

    result = arg1 / arg2;

    CHECKFLOATVAL(result, isinf(arg1) || isinf(arg2), arg1 == 0);
    PG_RETURN_FLOAT8(result);
}

Datum float84eq ( PG_FUNCTION_ARGS   ) 

Definition at line 2669 of file float.c.

References float8_cmp_internal(), PG_GETARG_FLOAT4, PG_GETARG_FLOAT8, and PG_RETURN_BOOL.

Datum float84ge ( PG_FUNCTION_ARGS   ) 

Definition at line 2714 of file float.c.

References float8_cmp_internal(), PG_GETARG_FLOAT4, PG_GETARG_FLOAT8, and PG_RETURN_BOOL.

Datum float84gt ( PG_FUNCTION_ARGS   ) 

Definition at line 2705 of file float.c.

References float8_cmp_internal(), PG_GETARG_FLOAT4, PG_GETARG_FLOAT8, and PG_RETURN_BOOL.

Datum float84le ( PG_FUNCTION_ARGS   ) 

Definition at line 2696 of file float.c.

References float8_cmp_internal(), PG_GETARG_FLOAT4, PG_GETARG_FLOAT8, and PG_RETURN_BOOL.

Datum float84lt ( PG_FUNCTION_ARGS   ) 

Definition at line 2687 of file float.c.

References float8_cmp_internal(), PG_GETARG_FLOAT4, PG_GETARG_FLOAT8, and PG_RETURN_BOOL.

Datum float84mi ( PG_FUNCTION_ARGS   ) 

Definition at line 2558 of file float.c.

References CHECKFLOATVAL, isinf(), PG_GETARG_FLOAT4, PG_GETARG_FLOAT8, and PG_RETURN_FLOAT8.

{
    float8      arg1 = PG_GETARG_FLOAT8(0);
    float4      arg2 = PG_GETARG_FLOAT4(1);
    float8      result;

    result = arg1 - arg2;

    CHECKFLOATVAL(result, isinf(arg1) || isinf(arg2), true);
    PG_RETURN_FLOAT8(result);
}

Datum float84mul ( PG_FUNCTION_ARGS   ) 

Definition at line 2571 of file float.c.

References CHECKFLOATVAL, isinf(), PG_GETARG_FLOAT4, PG_GETARG_FLOAT8, and PG_RETURN_FLOAT8.

{
    float8      arg1 = PG_GETARG_FLOAT8(0);
    float4      arg2 = PG_GETARG_FLOAT4(1);
    float8      result;

    result = arg1 * arg2;

    CHECKFLOATVAL(result, isinf(arg1) || isinf(arg2),
                  arg1 == 0 || arg2 == 0);
    PG_RETURN_FLOAT8(result);
}

Datum float84ne ( PG_FUNCTION_ARGS   ) 

Definition at line 2678 of file float.c.

References float8_cmp_internal(), PG_GETARG_FLOAT4, PG_GETARG_FLOAT8, and PG_RETURN_BOOL.

Datum float84pl ( PG_FUNCTION_ARGS   ) 

Definition at line 2545 of file float.c.

References CHECKFLOATVAL, isinf(), PG_GETARG_FLOAT4, PG_GETARG_FLOAT8, and PG_RETURN_FLOAT8.

{
    float8      arg1 = PG_GETARG_FLOAT8(0);
    float4      arg2 = PG_GETARG_FLOAT4(1);
    float8      result;

    result = arg1 + arg2;

    CHECKFLOATVAL(result, isinf(arg1) || isinf(arg2), true);
    PG_RETURN_FLOAT8(result);
}

Datum float8_accum ( PG_FUNCTION_ARGS   ) 

Definition at line 1809 of file float.c.

References AggCheckCallContext(), check_float8_array(), CHECKFLOATVAL, construct_array(), Float8GetDatumFast, FLOAT8OID, isinf(), NULL, PG_GETARG_ARRAYTYPE_P, PG_GETARG_FLOAT8, and PG_RETURN_ARRAYTYPE_P.

{
    ArrayType  *transarray = PG_GETARG_ARRAYTYPE_P(0);
    float8      newval = PG_GETARG_FLOAT8(1);
    float8     *transvalues;
    float8      N,
                sumX,
                sumX2;

    transvalues = check_float8_array(transarray, "float8_accum", 3);
    N = transvalues[0];
    sumX = transvalues[1];
    sumX2 = transvalues[2];

    N += 1.0;
    sumX += newval;
    CHECKFLOATVAL(sumX, isinf(transvalues[1]) || isinf(newval), true);
    sumX2 += newval * newval;
    CHECKFLOATVAL(sumX2, isinf(transvalues[2]) || isinf(newval), true);

    /*
     * If we're invoked as an aggregate, we can cheat and modify our first
     * parameter in-place to reduce palloc overhead. Otherwise we construct a
     * new array with the updated transition data and return it.
     */
    if (AggCheckCallContext(fcinfo, NULL))
    {
        transvalues[0] = N;
        transvalues[1] = sumX;
        transvalues[2] = sumX2;

        PG_RETURN_ARRAYTYPE_P(transarray);
    }
    else
    {
        Datum       transdatums[3];
        ArrayType  *result;

        transdatums[0] = Float8GetDatumFast(N);
        transdatums[1] = Float8GetDatumFast(sumX);
        transdatums[2] = Float8GetDatumFast(sumX2);

        result = construct_array(transdatums, 3,
                                 FLOAT8OID,
                                 sizeof(float8), FLOAT8PASSBYVAL, 'd');

        PG_RETURN_ARRAYTYPE_P(result);
    }
}

Datum float8_avg ( PG_FUNCTION_ARGS   ) 

Definition at line 1913 of file float.c.

References check_float8_array(), PG_GETARG_ARRAYTYPE_P, PG_RETURN_FLOAT8, and PG_RETURN_NULL.

{
    ArrayType  *transarray = PG_GETARG_ARRAYTYPE_P(0);
    float8     *transvalues;
    float8      N,
                sumX;

    transvalues = check_float8_array(transarray, "float8_avg", 3);
    N = transvalues[0];
    sumX = transvalues[1];
    /* ignore sumX2 */

    /* SQL defines AVG of no values to be NULL */
    if (N == 0.0)
        PG_RETURN_NULL();

    PG_RETURN_FLOAT8(sumX / N);
}

Datum float8_corr ( PG_FUNCTION_ARGS   ) 

Definition at line 2318 of file float.c.

References check_float8_array(), CHECKFLOATVAL, isinf(), PG_GETARG_ARRAYTYPE_P, PG_RETURN_FLOAT8, and PG_RETURN_NULL.

{
    ArrayType  *transarray = PG_GETARG_ARRAYTYPE_P(0);
    float8     *transvalues;
    float8      N,
                sumX,
                sumX2,
                sumY,
                sumY2,
                sumXY,
                numeratorX,
                numeratorY,
                numeratorXY;

    transvalues = check_float8_array(transarray, "float8_corr", 6);
    N = transvalues[0];
    sumX = transvalues[1];
    sumX2 = transvalues[2];
    sumY = transvalues[3];
    sumY2 = transvalues[4];
    sumXY = transvalues[5];

    /* if N is 0 we should return NULL */
    if (N < 1.0)
        PG_RETURN_NULL();

    numeratorX = N * sumX2 - sumX * sumX;
    CHECKFLOATVAL(numeratorX, isinf(sumX2) || isinf(sumX), true);
    numeratorY = N * sumY2 - sumY * sumY;
    CHECKFLOATVAL(numeratorY, isinf(sumY2) || isinf(sumY), true);
    numeratorXY = N * sumXY - sumX * sumY;
    CHECKFLOATVAL(numeratorXY, isinf(sumXY) || isinf(sumX) ||
                  isinf(sumY), true);
    if (numeratorX <= 0 || numeratorY <= 0)
        PG_RETURN_NULL();

    PG_RETURN_FLOAT8(numeratorXY / sqrt(numeratorX * numeratorY));
}

Datum float8_covar_pop ( PG_FUNCTION_ARGS   ) 

Definition at line 2262 of file float.c.

References check_float8_array(), CHECKFLOATVAL, isinf(), PG_GETARG_ARRAYTYPE_P, PG_RETURN_FLOAT8, and PG_RETURN_NULL.

{
    ArrayType  *transarray = PG_GETARG_ARRAYTYPE_P(0);
    float8     *transvalues;
    float8      N,
                sumX,
                sumY,
                sumXY,
                numerator;

    transvalues = check_float8_array(transarray, "float8_covar_pop", 6);
    N = transvalues[0];
    sumX = transvalues[1];
    sumY = transvalues[3];
    sumXY = transvalues[5];

    /* if N is 0 we should return NULL */
    if (N < 1.0)
        PG_RETURN_NULL();

    numerator = N * sumXY - sumX * sumY;
    CHECKFLOATVAL(numerator, isinf(sumXY) || isinf(sumX) ||
                  isinf(sumY), true);

    PG_RETURN_FLOAT8(numerator / (N * N));
}

Datum float8_covar_samp ( PG_FUNCTION_ARGS   ) 

Definition at line 2290 of file float.c.

References check_float8_array(), CHECKFLOATVAL, isinf(), PG_GETARG_ARRAYTYPE_P, PG_RETURN_FLOAT8, and PG_RETURN_NULL.

{
    ArrayType  *transarray = PG_GETARG_ARRAYTYPE_P(0);
    float8     *transvalues;
    float8      N,
                sumX,
                sumY,
                sumXY,
                numerator;

    transvalues = check_float8_array(transarray, "float8_covar_samp", 6);
    N = transvalues[0];
    sumX = transvalues[1];
    sumY = transvalues[3];
    sumXY = transvalues[5];

    /* if N is <= 1 we should return NULL */
    if (N < 2.0)
        PG_RETURN_NULL();

    numerator = N * sumXY - sumX * sumY;
    CHECKFLOATVAL(numerator, isinf(sumXY) || isinf(sumX) ||
                  isinf(sumY), true);

    PG_RETURN_FLOAT8(numerator / (N * (N - 1.0)));
}

Datum float8_numeric ( PG_FUNCTION_ARGS   ) 

Definition at line 2355 of file numeric.c.

References buf, free_var(), init_var, make_result(), PG_GETARG_FLOAT8, PG_RETURN_NUMERIC, set_var_from_str(), and val.

{
    float8      val = PG_GETARG_FLOAT8(0);
    Numeric     res;
    NumericVar  result;
    char        buf[DBL_DIG + 100];

    if (isnan(val))
        PG_RETURN_NUMERIC(make_result(&const_nan));

    sprintf(buf, "%.*g", DBL_DIG, val);

    init_var(&result);

    /* Assume we need not worry about leading/trailing spaces */
    (void) set_var_from_str(buf, buf, &result);

    res = make_result(&result);

    free_var(&result);

    PG_RETURN_NUMERIC(res);
}

Datum float8_regr_accum ( PG_FUNCTION_ARGS   ) 

Definition at line 2065 of file float.c.

References AggCheckCallContext(), check_float8_array(), CHECKFLOATVAL, construct_array(), Float8GetDatumFast, FLOAT8OID, isinf(), NULL, PG_GETARG_ARRAYTYPE_P, PG_GETARG_FLOAT8, and PG_RETURN_ARRAYTYPE_P.

{
    ArrayType  *transarray = PG_GETARG_ARRAYTYPE_P(0);
    float8      newvalY = PG_GETARG_FLOAT8(1);
    float8      newvalX = PG_GETARG_FLOAT8(2);
    float8     *transvalues;
    float8      N,
                sumX,
                sumX2,
                sumY,
                sumY2,
                sumXY;

    transvalues = check_float8_array(transarray, "float8_regr_accum", 6);
    N = transvalues[0];
    sumX = transvalues[1];
    sumX2 = transvalues[2];
    sumY = transvalues[3];
    sumY2 = transvalues[4];
    sumXY = transvalues[5];

    N += 1.0;
    sumX += newvalX;
    CHECKFLOATVAL(sumX, isinf(transvalues[1]) || isinf(newvalX), true);
    sumX2 += newvalX * newvalX;
    CHECKFLOATVAL(sumX2, isinf(transvalues[2]) || isinf(newvalX), true);
    sumY += newvalY;
    CHECKFLOATVAL(sumY, isinf(transvalues[3]) || isinf(newvalY), true);
    sumY2 += newvalY * newvalY;
    CHECKFLOATVAL(sumY2, isinf(transvalues[4]) || isinf(newvalY), true);
    sumXY += newvalX * newvalY;
    CHECKFLOATVAL(sumXY, isinf(transvalues[5]) || isinf(newvalX) ||
                  isinf(newvalY), true);

    /*
     * If we're invoked as an aggregate, we can cheat and modify our first
     * parameter in-place to reduce palloc overhead. Otherwise we construct a
     * new array with the updated transition data and return it.
     */
    if (AggCheckCallContext(fcinfo, NULL))
    {
        transvalues[0] = N;
        transvalues[1] = sumX;
        transvalues[2] = sumX2;
        transvalues[3] = sumY;
        transvalues[4] = sumY2;
        transvalues[5] = sumXY;

        PG_RETURN_ARRAYTYPE_P(transarray);
    }
    else
    {
        Datum       transdatums[6];
        ArrayType  *result;

        transdatums[0] = Float8GetDatumFast(N);
        transdatums[1] = Float8GetDatumFast(sumX);
        transdatums[2] = Float8GetDatumFast(sumX2);
        transdatums[3] = Float8GetDatumFast(sumY);
        transdatums[4] = Float8GetDatumFast(sumY2);
        transdatums[5] = Float8GetDatumFast(sumXY);

        result = construct_array(transdatums, 6,
                                 FLOAT8OID,
                                 sizeof(float8), FLOAT8PASSBYVAL, 'd');

        PG_RETURN_ARRAYTYPE_P(result);
    }
}

Datum float8_regr_avgx ( PG_FUNCTION_ARGS   ) 

Definition at line 2224 of file float.c.

References check_float8_array(), PG_GETARG_ARRAYTYPE_P, PG_RETURN_FLOAT8, and PG_RETURN_NULL.

{
    ArrayType  *transarray = PG_GETARG_ARRAYTYPE_P(0);
    float8     *transvalues;
    float8      N,
                sumX;

    transvalues = check_float8_array(transarray, "float8_regr_avgx", 6);
    N = transvalues[0];
    sumX = transvalues[1];

    /* if N is 0 we should return NULL */
    if (N < 1.0)
        PG_RETURN_NULL();

    PG_RETURN_FLOAT8(sumX / N);
}

Datum float8_regr_avgy ( PG_FUNCTION_ARGS   ) 

Definition at line 2243 of file float.c.

References check_float8_array(), PG_GETARG_ARRAYTYPE_P, PG_RETURN_FLOAT8, and PG_RETURN_NULL.

{
    ArrayType  *transarray = PG_GETARG_ARRAYTYPE_P(0);
    float8     *transvalues;
    float8      N,
                sumY;

    transvalues = check_float8_array(transarray, "float8_regr_avgy", 6);
    N = transvalues[0];
    sumY = transvalues[3];

    /* if N is 0 we should return NULL */
    if (N < 1.0)
        PG_RETURN_NULL();

    PG_RETURN_FLOAT8(sumY / N);
}

Datum float8_regr_intercept ( PG_FUNCTION_ARGS   ) 

Definition at line 2437 of file float.c.

References check_float8_array(), CHECKFLOATVAL, isinf(), PG_GETARG_ARRAYTYPE_P, PG_RETURN_FLOAT8, and PG_RETURN_NULL.

{
    ArrayType  *transarray = PG_GETARG_ARRAYTYPE_P(0);
    float8     *transvalues;
    float8      N,
                sumX,
                sumX2,
                sumY,
                sumXY,
                numeratorX,
                numeratorXXY;

    transvalues = check_float8_array(transarray, "float8_regr_intercept", 6);
    N = transvalues[0];
    sumX = transvalues[1];
    sumX2 = transvalues[2];
    sumY = transvalues[3];
    sumXY = transvalues[5];

    /* if N is 0 we should return NULL */
    if (N < 1.0)
        PG_RETURN_NULL();

    numeratorX = N * sumX2 - sumX * sumX;
    CHECKFLOATVAL(numeratorX, isinf(sumX2) || isinf(sumX), true);
    numeratorXXY = sumY * sumX2 - sumX * sumXY;
    CHECKFLOATVAL(numeratorXXY, isinf(sumY) || isinf(sumX2) ||
                  isinf(sumX) || isinf(sumXY), true);
    if (numeratorX <= 0)
        PG_RETURN_NULL();

    PG_RETURN_FLOAT8(numeratorXXY / numeratorX);
}

Datum float8_regr_r2 ( PG_FUNCTION_ARGS   ) 

Definition at line 2358 of file float.c.

References check_float8_array(), CHECKFLOATVAL, isinf(), PG_GETARG_ARRAYTYPE_P, PG_RETURN_FLOAT8, and PG_RETURN_NULL.

{
    ArrayType  *transarray = PG_GETARG_ARRAYTYPE_P(0);
    float8     *transvalues;
    float8      N,
                sumX,
                sumX2,
                sumY,
                sumY2,
                sumXY,
                numeratorX,
                numeratorY,
                numeratorXY;

    transvalues = check_float8_array(transarray, "float8_regr_r2", 6);
    N = transvalues[0];
    sumX = transvalues[1];
    sumX2 = transvalues[2];
    sumY = transvalues[3];
    sumY2 = transvalues[4];
    sumXY = transvalues[5];

    /* if N is 0 we should return NULL */
    if (N < 1.0)
        PG_RETURN_NULL();

    numeratorX = N * sumX2 - sumX * sumX;
    CHECKFLOATVAL(numeratorX, isinf(sumX2) || isinf(sumX), true);
    numeratorY = N * sumY2 - sumY * sumY;
    CHECKFLOATVAL(numeratorY, isinf(sumY2) || isinf(sumY), true);
    numeratorXY = N * sumXY - sumX * sumY;
    CHECKFLOATVAL(numeratorXY, isinf(sumXY) || isinf(sumX) ||
                  isinf(sumY), true);
    if (numeratorX <= 0)
        PG_RETURN_NULL();
    /* per spec, horizontal line produces 1.0 */
    if (numeratorY <= 0)
        PG_RETURN_FLOAT8(1.0);

    PG_RETURN_FLOAT8((numeratorXY * numeratorXY) /
                     (numeratorX * numeratorY));
}

Datum float8_regr_slope ( PG_FUNCTION_ARGS   ) 

Definition at line 2402 of file float.c.

References check_float8_array(), CHECKFLOATVAL, isinf(), PG_GETARG_ARRAYTYPE_P, PG_RETURN_FLOAT8, and PG_RETURN_NULL.

{
    ArrayType  *transarray = PG_GETARG_ARRAYTYPE_P(0);
    float8     *transvalues;
    float8      N,
                sumX,
                sumX2,
                sumY,
                sumXY,
                numeratorX,
                numeratorXY;

    transvalues = check_float8_array(transarray, "float8_regr_slope", 6);
    N = transvalues[0];
    sumX = transvalues[1];
    sumX2 = transvalues[2];
    sumY = transvalues[3];
    sumXY = transvalues[5];

    /* if N is 0 we should return NULL */
    if (N < 1.0)
        PG_RETURN_NULL();

    numeratorX = N * sumX2 - sumX * sumX;
    CHECKFLOATVAL(numeratorX, isinf(sumX2) || isinf(sumX), true);
    numeratorXY = N * sumXY - sumX * sumY;
    CHECKFLOATVAL(numeratorXY, isinf(sumXY) || isinf(sumX) ||
                  isinf(sumY), true);
    if (numeratorX <= 0)
        PG_RETURN_NULL();

    PG_RETURN_FLOAT8(numeratorXY / numeratorX);
}

Datum float8_regr_sxx ( PG_FUNCTION_ARGS   ) 

Definition at line 2136 of file float.c.

References check_float8_array(), CHECKFLOATVAL, isinf(), PG_GETARG_ARRAYTYPE_P, PG_RETURN_FLOAT8, and PG_RETURN_NULL.

{
    ArrayType  *transarray = PG_GETARG_ARRAYTYPE_P(0);
    float8     *transvalues;
    float8      N,
                sumX,
                sumX2,
                numerator;

    transvalues = check_float8_array(transarray, "float8_regr_sxx", 6);
    N = transvalues[0];
    sumX = transvalues[1];
    sumX2 = transvalues[2];

    /* if N is 0 we should return NULL */
    if (N < 1.0)
        PG_RETURN_NULL();

    numerator = N * sumX2 - sumX * sumX;
    CHECKFLOATVAL(numerator, isinf(sumX2) || isinf(sumX), true);

    /* Watch out for roundoff error producing a negative numerator */
    if (numerator <= 0.0)
        PG_RETURN_FLOAT8(0.0);

    PG_RETURN_FLOAT8(numerator / N);
}

Datum float8_regr_sxy ( PG_FUNCTION_ARGS   ) 

Definition at line 2194 of file float.c.

References check_float8_array(), CHECKFLOATVAL, isinf(), PG_GETARG_ARRAYTYPE_P, PG_RETURN_FLOAT8, and PG_RETURN_NULL.

{
    ArrayType  *transarray = PG_GETARG_ARRAYTYPE_P(0);
    float8     *transvalues;
    float8      N,
                sumX,
                sumY,
                sumXY,
                numerator;

    transvalues = check_float8_array(transarray, "float8_regr_sxy", 6);
    N = transvalues[0];
    sumX = transvalues[1];
    sumY = transvalues[3];
    sumXY = transvalues[5];

    /* if N is 0 we should return NULL */
    if (N < 1.0)
        PG_RETURN_NULL();

    numerator = N * sumXY - sumX * sumY;
    CHECKFLOATVAL(numerator, isinf(sumXY) || isinf(sumX) ||
                  isinf(sumY), true);

    /* A negative result is valid here */

    PG_RETURN_FLOAT8(numerator / N);
}

Datum float8_regr_syy ( PG_FUNCTION_ARGS   ) 

Definition at line 2165 of file float.c.

References check_float8_array(), CHECKFLOATVAL, isinf(), PG_GETARG_ARRAYTYPE_P, PG_RETURN_FLOAT8, and PG_RETURN_NULL.

{
    ArrayType  *transarray = PG_GETARG_ARRAYTYPE_P(0);
    float8     *transvalues;
    float8      N,
                sumY,
                sumY2,
                numerator;

    transvalues = check_float8_array(transarray, "float8_regr_syy", 6);
    N = transvalues[0];
    sumY = transvalues[3];
    sumY2 = transvalues[4];

    /* if N is 0 we should return NULL */
    if (N < 1.0)
        PG_RETURN_NULL();

    numerator = N * sumY2 - sumY * sumY;
    CHECKFLOATVAL(numerator, isinf(sumY2) || isinf(sumY), true);

    /* Watch out for roundoff error producing a negative numerator */
    if (numerator <= 0.0)
        PG_RETURN_FLOAT8(0.0);

    PG_RETURN_FLOAT8(numerator / N);
}

Datum float8_stddev_pop ( PG_FUNCTION_ARGS   ) 

Definition at line 1991 of file float.c.

References check_float8_array(), CHECKFLOATVAL, isinf(), PG_GETARG_ARRAYTYPE_P, PG_RETURN_FLOAT8, and PG_RETURN_NULL.

{
    ArrayType  *transarray = PG_GETARG_ARRAYTYPE_P(0);
    float8     *transvalues;
    float8      N,
                sumX,
                sumX2,
                numerator;

    transvalues = check_float8_array(transarray, "float8_stddev_pop", 3);
    N = transvalues[0];
    sumX = transvalues[1];
    sumX2 = transvalues[2];

    /* Population stddev is undefined when N is 0, so return NULL */
    if (N == 0.0)
        PG_RETURN_NULL();

    numerator = N * sumX2 - sumX * sumX;
    CHECKFLOATVAL(numerator, isinf(sumX2) || isinf(sumX), true);

    /* Watch out for roundoff error producing a negative numerator */
    if (numerator <= 0.0)
        PG_RETURN_FLOAT8(0.0);

    PG_RETURN_FLOAT8(sqrt(numerator / (N * N)));
}

Datum float8_stddev_samp ( PG_FUNCTION_ARGS   ) 

Definition at line 2020 of file float.c.

References check_float8_array(), CHECKFLOATVAL, isinf(), PG_GETARG_ARRAYTYPE_P, PG_RETURN_FLOAT8, and PG_RETURN_NULL.

{
    ArrayType  *transarray = PG_GETARG_ARRAYTYPE_P(0);
    float8     *transvalues;
    float8      N,
                sumX,
                sumX2,
                numerator;

    transvalues = check_float8_array(transarray, "float8_stddev_samp", 3);
    N = transvalues[0];
    sumX = transvalues[1];
    sumX2 = transvalues[2];

    /* Sample stddev is undefined when N is 0 or 1, so return NULL */
    if (N <= 1.0)
        PG_RETURN_NULL();

    numerator = N * sumX2 - sumX * sumX;
    CHECKFLOATVAL(numerator, isinf(sumX2) || isinf(sumX), true);

    /* Watch out for roundoff error producing a negative numerator */
    if (numerator <= 0.0)
        PG_RETURN_FLOAT8(0.0);

    PG_RETURN_FLOAT8(sqrt(numerator / (N * (N - 1.0))));
}

Datum float8_var_pop ( PG_FUNCTION_ARGS   ) 

Definition at line 1933 of file float.c.

References check_float8_array(), CHECKFLOATVAL, isinf(), PG_GETARG_ARRAYTYPE_P, PG_RETURN_FLOAT8, and PG_RETURN_NULL.

{
    ArrayType  *transarray = PG_GETARG_ARRAYTYPE_P(0);
    float8     *transvalues;
    float8      N,
                sumX,
                sumX2,
                numerator;

    transvalues = check_float8_array(transarray, "float8_var_pop", 3);
    N = transvalues[0];
    sumX = transvalues[1];
    sumX2 = transvalues[2];

    /* Population variance is undefined when N is 0, so return NULL */
    if (N == 0.0)
        PG_RETURN_NULL();

    numerator = N * sumX2 - sumX * sumX;
    CHECKFLOATVAL(numerator, isinf(sumX2) || isinf(sumX), true);

    /* Watch out for roundoff error producing a negative numerator */
    if (numerator <= 0.0)
        PG_RETURN_FLOAT8(0.0);

    PG_RETURN_FLOAT8(numerator / (N * N));
}

Datum float8_var_samp ( PG_FUNCTION_ARGS   ) 

Definition at line 1962 of file float.c.

References check_float8_array(), CHECKFLOATVAL, isinf(), PG_GETARG_ARRAYTYPE_P, PG_RETURN_FLOAT8, and PG_RETURN_NULL.

{
    ArrayType  *transarray = PG_GETARG_ARRAYTYPE_P(0);
    float8     *transvalues;
    float8      N,
                sumX,
                sumX2,
                numerator;

    transvalues = check_float8_array(transarray, "float8_var_samp", 3);
    N = transvalues[0];
    sumX = transvalues[1];
    sumX2 = transvalues[2];

    /* Sample variance is undefined when N is 0 or 1, so return NULL */
    if (N <= 1.0)
        PG_RETURN_NULL();

    numerator = N * sumX2 - sumX * sumX;
    CHECKFLOATVAL(numerator, isinf(sumX2) || isinf(sumX), true);

    /* Watch out for roundoff error producing a negative numerator */
    if (numerator <= 0.0)
        PG_RETURN_FLOAT8(0.0);

    PG_RETURN_FLOAT8(numerator / (N * (N - 1.0)));
}

Datum float8abs ( PG_FUNCTION_ARGS   ) 

Definition at line 664 of file float.c.

References PG_GETARG_FLOAT8, and PG_RETURN_FLOAT8.

{
    float8      arg1 = PG_GETARG_FLOAT8(0);

    PG_RETURN_FLOAT8(fabs(arg1));
}

Datum float8div ( PG_FUNCTION_ARGS   ) 

Definition at line 844 of file float.c.

References CHECKFLOATVAL, ereport, errcode(), errmsg(), ERROR, isinf(), PG_GETARG_FLOAT8, and PG_RETURN_FLOAT8.

{
    float8      arg1 = PG_GETARG_FLOAT8(0);
    float8      arg2 = PG_GETARG_FLOAT8(1);
    float8      result;

    if (arg2 == 0.0)
        ereport(ERROR,
                (errcode(ERRCODE_DIVISION_BY_ZERO),
                 errmsg("division by zero")));

    result = arg1 / arg2;

    CHECKFLOATVAL(result, isinf(arg1) || isinf(arg2), arg1 == 0);
    PG_RETURN_FLOAT8(result);
}

Datum float8eq ( PG_FUNCTION_ARGS   ) 

Definition at line 1016 of file float.c.

References float8_cmp_internal(), PG_GETARG_FLOAT8, and PG_RETURN_BOOL.

Datum float8ge ( PG_FUNCTION_ARGS   ) 

Definition at line 1061 of file float.c.

References float8_cmp_internal(), PG_GETARG_FLOAT8, and PG_RETURN_BOOL.

Datum float8gt ( PG_FUNCTION_ARGS   ) 

Definition at line 1052 of file float.c.

References float8_cmp_internal(), PG_GETARG_FLOAT8, and PG_RETURN_BOOL.

Datum float8in ( PG_FUNCTION_ARGS   ) 

Definition at line 391 of file float.c.

References CHECKFLOATVAL, ereport, errcode(), errmsg(), ERROR, get_float8_infinity(), get_float8_nan(), isinf(), PG_GETARG_CSTRING, PG_RETURN_FLOAT8, pg_strncasecmp(), and val.

Referenced by numeric_float8().

{
    char       *num = PG_GETARG_CSTRING(0);
    char       *orig_num;
    double      val;
    char       *endptr;

    /*
     * endptr points to the first character _after_ the sequence we recognized
     * as a valid floating point number. orig_num points to the original input
     * string.
     */
    orig_num = num;

    /*
     * Check for an empty-string input to begin with, to avoid the vagaries of
     * strtod() on different platforms.
     */
    if (*num == '\0')
        ereport(ERROR,
                (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
             errmsg("invalid input syntax for type double precision: \"%s\"",
                    orig_num)));

    /* skip leading whitespace */
    while (*num != '\0' && isspace((unsigned char) *num))
        num++;

    errno = 0;
    val = strtod(num, &endptr);

    /* did we not see anything that looks like a double? */
    if (endptr == num || errno != 0)
    {
        int         save_errno = errno;

        /*
         * C99 requires that strtod() accept NaN and [-]Infinity, but not all
         * platforms support that yet (and some accept them but set ERANGE
         * anyway...)  Therefore, we check for these inputs ourselves.
         */
        if (pg_strncasecmp(num, "NaN", 3) == 0)
        {
            val = get_float8_nan();
            endptr = num + 3;
        }
        else if (pg_strncasecmp(num, "Infinity", 8) == 0)
        {
            val = get_float8_infinity();
            endptr = num + 8;
        }
        else if (pg_strncasecmp(num, "-Infinity", 9) == 0)
        {
            val = -get_float8_infinity();
            endptr = num + 9;
        }
        else if (save_errno == ERANGE)
        {
            /*
             * Some platforms return ERANGE for denormalized numbers (those
             * that are not zero, but are too close to zero to have full
             * precision).  We'd prefer not to throw error for that, so try to
             * detect whether it's a "real" out-of-range condition by checking
             * to see if the result is zero or huge.
             */
            if (val == 0.0 || val >= HUGE_VAL || val <= -HUGE_VAL)
                ereport(ERROR,
                        (errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
                   errmsg("\"%s\" is out of range for type double precision",
                          orig_num)));
        }
        else
            ereport(ERROR,
                    (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
             errmsg("invalid input syntax for type double precision: \"%s\"",
                    orig_num)));
    }
#ifdef HAVE_BUGGY_SOLARIS_STRTOD
    else
    {
        /*
         * Many versions of Solaris have a bug wherein strtod sets endptr to
         * point one byte beyond the end of the string when given "inf" or
         * "infinity".
         */
        if (endptr != num && endptr[-1] == '\0')
            endptr--;
    }
#endif   /* HAVE_BUGGY_SOLARIS_STRTOD */

#ifdef HAVE_BUGGY_IRIX_STRTOD

    /*
     * In some IRIX versions, strtod() recognizes only "inf", so if the input
     * is "infinity" we have to skip over "inity".  Also, it may return
     * positive infinity for "-inf".
     */
    if (isinf(val))
    {
        if (pg_strncasecmp(num, "Infinity", 8) == 0)
        {
            val = get_float8_infinity();
            endptr = num + 8;
        }
        else if (pg_strncasecmp(num, "-Infinity", 9) == 0)
        {
            val = -get_float8_infinity();
            endptr = num + 9;
        }
        else if (pg_strncasecmp(num, "-inf", 4) == 0)
        {
            val = -get_float8_infinity();
            endptr = num + 4;
        }
    }
#endif   /* HAVE_BUGGY_IRIX_STRTOD */

    /* skip trailing whitespace */
    while (*endptr != '\0' && isspace((unsigned char) *endptr))
        endptr++;

    /* if there is any junk left at the end of the string, bail out */
    if (*endptr != '\0')
        ereport(ERROR,
                (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
             errmsg("invalid input syntax for type double precision: \"%s\"",
                    orig_num)));

    CHECKFLOATVAL(val, true, true);

    PG_RETURN_FLOAT8(val);
}

Datum float8larger ( PG_FUNCTION_ARGS   ) 

Definition at line 694 of file float.c.

References float8_cmp_internal(), PG_GETARG_FLOAT8, and PG_RETURN_FLOAT8.

{
    float8      arg1 = PG_GETARG_FLOAT8(0);
    float8      arg2 = PG_GETARG_FLOAT8(1);
    float8      result;

    if (float8_cmp_internal(arg1, arg2) > 0)
        result = arg1;
    else
        result = arg2;
    PG_RETURN_FLOAT8(result);
}

Datum float8le ( PG_FUNCTION_ARGS   ) 

Definition at line 1043 of file float.c.

References float8_cmp_internal(), PG_GETARG_FLOAT8, and PG_RETURN_BOOL.

Datum float8lt ( PG_FUNCTION_ARGS   ) 

Definition at line 1034 of file float.c.

References float8_cmp_internal(), PG_GETARG_FLOAT8, and PG_RETURN_BOOL.

Datum float8mi ( PG_FUNCTION_ARGS   ) 

Definition at line 817 of file float.c.

References CHECKFLOATVAL, isinf(), PG_GETARG_FLOAT8, and PG_RETURN_FLOAT8.

{
    float8      arg1 = PG_GETARG_FLOAT8(0);
    float8      arg2 = PG_GETARG_FLOAT8(1);
    float8      result;

    result = arg1 - arg2;

    CHECKFLOATVAL(result, isinf(arg1) || isinf(arg2), true);
    PG_RETURN_FLOAT8(result);
}

Datum float8mul ( PG_FUNCTION_ARGS   ) 

Definition at line 830 of file float.c.

References CHECKFLOATVAL, isinf(), PG_GETARG_FLOAT8, and PG_RETURN_FLOAT8.

{
    float8      arg1 = PG_GETARG_FLOAT8(0);
    float8      arg2 = PG_GETARG_FLOAT8(1);
    float8      result;

    result = arg1 * arg2;

    CHECKFLOATVAL(result, isinf(arg1) || isinf(arg2),
                  arg1 == 0 || arg2 == 0);
    PG_RETURN_FLOAT8(result);
}

Datum float8ne ( PG_FUNCTION_ARGS   ) 

Definition at line 1025 of file float.c.

References float8_cmp_internal(), PG_GETARG_FLOAT8, and PG_RETURN_BOOL.

Datum float8out ( PG_FUNCTION_ARGS   ) 

Definition at line 529 of file float.c.

References ascii(), extra_float_digits, is_infinite(), MAXDOUBLEWIDTH, palloc(), PG_GETARG_FLOAT8, PG_RETURN_CSTRING, and snprintf().

{
    float8      num = PG_GETARG_FLOAT8(0);
    char       *ascii = (char *) palloc(MAXDOUBLEWIDTH + 1);

    if (isnan(num))
        PG_RETURN_CSTRING(strcpy(ascii, "NaN"));

    switch (is_infinite(num))
    {
        case 1:
            strcpy(ascii, "Infinity");
            break;
        case -1:
            strcpy(ascii, "-Infinity");
            break;
        default:
            {
                int         ndig = DBL_DIG + extra_float_digits;

                if (ndig < 1)
                    ndig = 1;

                snprintf(ascii, MAXDOUBLEWIDTH + 1, "%.*g", ndig, num);
            }
    }

    PG_RETURN_CSTRING(ascii);
}

Datum float8pl ( PG_FUNCTION_ARGS   ) 

Definition at line 804 of file float.c.

References CHECKFLOATVAL, isinf(), PG_GETARG_FLOAT8, and PG_RETURN_FLOAT8.

{
    float8      arg1 = PG_GETARG_FLOAT8(0);
    float8      arg2 = PG_GETARG_FLOAT8(1);
    float8      result;

    result = arg1 + arg2;

    CHECKFLOATVAL(result, isinf(arg1) || isinf(arg2), true);
    PG_RETURN_FLOAT8(result);
}

Datum float8recv ( PG_FUNCTION_ARGS   ) 
Datum float8send ( PG_FUNCTION_ARGS   ) 
Datum float8smaller ( PG_FUNCTION_ARGS   ) 

Definition at line 708 of file float.c.

References float8_cmp_internal(), PG_GETARG_FLOAT8, and PG_RETURN_FLOAT8.

{
    float8      arg1 = PG_GETARG_FLOAT8(0);
    float8      arg2 = PG_GETARG_FLOAT8(1);
    float8      result;

    if (float8_cmp_internal(arg1, arg2) < 0)
        result = arg1;
    else
        result = arg2;
    PG_RETURN_FLOAT8(result);
}

Datum float8um ( PG_FUNCTION_ARGS   ) 

Definition at line 676 of file float.c.

References PG_GETARG_FLOAT8, and PG_RETURN_FLOAT8.

{
    float8      arg1 = PG_GETARG_FLOAT8(0);
    float8      result;

    result = -arg1;
    PG_RETURN_FLOAT8(result);
}

Datum float8up ( PG_FUNCTION_ARGS   ) 

Definition at line 686 of file float.c.

References arg, PG_GETARG_FLOAT8, and PG_RETURN_FLOAT8.

char* format_operator ( Oid  operator_oid  ) 

Definition at line 745 of file regproc.c.

References format_operator_internal().

Referenced by ComputeIndexAttrs(), getObjectDescription(), and regoperatorout().

{
    return format_operator_internal(operator_oid, false);
}

char* format_operator_qualified ( Oid  operator_oid  ) 

Definition at line 751 of file regproc.c.

References format_operator_internal().

Referenced by getObjectIdentity().

{
    return format_operator_internal(operator_oid, true);
}

char* format_procedure ( Oid  procedure_oid  ) 

Definition at line 307 of file regproc.c.

References format_procedure_internal().

Referenced by do_compile(), getObjectDescription(), ProcedureCreate(), and regprocedureout().

{
    return format_procedure_internal(procedure_oid, false);
}

char* format_procedure_qualified ( Oid  procedure_oid  ) 

Definition at line 313 of file regproc.c.

References format_procedure_internal().

Referenced by getObjectIdentity().

{
    return format_procedure_internal(procedure_oid, true);
}

Datum format_type ( PG_FUNCTION_ARGS   ) 

Definition at line 68 of file format_type.c.

References cstring_to_text(), format_type_internal(), PG_ARGISNULL, PG_GETARG_INT32, PG_GETARG_OID, PG_RETURN_NULL, and PG_RETURN_TEXT_P.

{
    Oid         type_oid;
    int32       typemod;
    char       *result;

    /* Since this function is not strict, we must test for null args */
    if (PG_ARGISNULL(0))
        PG_RETURN_NULL();

    type_oid = PG_GETARG_OID(0);

    if (PG_ARGISNULL(1))
        result = format_type_internal(type_oid, -1, false, true, false);
    else
    {
        typemod = PG_GETARG_INT32(1);
        result = format_type_internal(type_oid, typemod, true, true, false);
    }

    PG_RETURN_TEXT_P(cstring_to_text(result));
}

char* format_type_be ( Oid  type_oid  ) 

Definition at line 98 of file format_type.c.

References format_type_internal().

Referenced by aclcheck_error_type(), addFamilyMember(), addRangeTableEntryForFunction(), AggregateCreate(), AlterTypeNamespace(), AlterTypeNamespace_oid(), AlterTypeNamespaceInternal(), AlterTypeOwner(), appendTypeNameToBuffer(), array_cat(), array_cmp(), array_contain_compare(), array_eq(), array_recv(), array_replace_internal(), array_send(), ATAddForeignKeyConstraint(), ATExecAlterColumnType(), ATExecSetStorage(), ATPrepAlterColumnType(), build_column_default(), build_subplan(), check_object_ownership(), check_of_type(), check_sql_fn_retval(), CheckAttributeType(), checkDomainOwner(), checkEnumOwner(), coerce_record_to_complex(), coerce_to_boolean(), coerce_to_common_type(), coerce_to_specific_type(), coerce_type(), compare_values_of_enum(), compile_plperl_function(), compile_pltcl_function(), ComputeIndexAttrs(), convert_tuples_by_name(), cookDefault(), CreateCast(), CreateFunction(), DefineAggregate(), DefineDomain(), DefineRange(), DefineType(), do_compile(), does_not_exist_skipping(), domain_check_input(), domain_state_setup(), dropOperators(), dropProcedures(), enforce_generic_type_consistency(), enum_first(), enum_in(), enum_last(), enum_recv(), EvaluateParams(), exec_stmt_foreach_a(), ExecCheckPlanOutput(), ExecEvalArray(), ExecEvalCoerceToDomain(), ExecEvalFieldSelect(), ExecEvalParamExtern(), ExecEvalScalarVar(), ExecEvalWholeRowVar(), ExecInitExpr(), exprType(), fetch_cursor_param_value(), findRangeSubOpclass(), findTypeOutputFunction(), fmgr_sql_validator(), format_operator_internal(), format_procedure_internal(), funcname_signature_string(), get_cast_oid(), get_domain_constraint_oid(), get_range_io_data(), get_rels_with_domain(), get_sort_group_operators(), get_ts_parser_func(), get_ts_template_func(), GetColumnDefCollation(), GetDefaultOpClass(), GetIndexOpClass(), getObjectDescription(), getTypeBinaryInputInfo(), getTypeBinaryOutputInfo(), getTypeInputInfo(), getTypeOutputInfo(), hash_array(), hash_range(), init_sql_fcache(), internal_get_result_type(), intorel_startup(), load_enum_cache_data(), lookup_rowtype_tupdesc_internal(), LookupTypeName(), make_row_comparison_op(), make_scalar_array_op(), MergeAttributes(), op_signature_string(), ParseFuncOrColumn(), pg_collation_for(), plperl_array_to_datum(), plperl_sv_to_datum(), plperl_validator(), plpgsql_build_variable(), plpgsql_validator(), PLy_output_datum_func2(), PLy_procedure_create(), prepare_sql_fn_parse_info(), print_function_arguments(), print_function_rettype(), ProcedureCreate(), processIndirection(), record_cmp(), record_eq(), regtypeout(), RenameConstraintById(), RenameType(), resolve_generic_type(), ri_HashCompareOp(), select_common_type(), storeOperators(), storeProcedures(), transformAggregateCall(), transformArrayExpr(), transformArraySubscripts(), transformArrayType(), transformAssignedExpr(), transformAssignmentIndirection(), transformAssignmentSubscripts(), transformCollateClause(), transformColumnType(), transformTypeCast(), transformXmlSerialize(), tupledesc_match(), unknown_attribute(), validateConnectbyTupleDesc(), and variable_coerce_param_hook().

{
    return format_type_internal(type_oid, -1, false, false, false);
}

char* format_type_be_qualified ( Oid  type_oid  ) 

Definition at line 104 of file format_type.c.

References format_type_internal().

Referenced by format_operator_internal(), format_procedure_internal(), and getObjectIdentity().

{
    return format_type_internal(type_oid, -1, false, false, true);
}

char* format_type_with_typemod ( Oid  type_oid,
int32  typemod 
)
Datum ftod ( PG_FUNCTION_ARGS   ) 

Definition at line 1127 of file float.c.

References PG_GETARG_FLOAT4, and PG_RETURN_FLOAT8.

Datum ftoi2 ( PG_FUNCTION_ARGS   ) 

Definition at line 1231 of file float.c.

References ereport, errcode(), errmsg(), ERROR, PG_GETARG_FLOAT4, PG_RETURN_INT16, and rint().

{
    float4      num = PG_GETARG_FLOAT4(0);

    if (num < SHRT_MIN || num > SHRT_MAX || isnan(num))
        ereport(ERROR,
                (errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
                 errmsg("smallint out of range")));

    PG_RETURN_INT16((int16) rint(num));
}

Datum ftoi4 ( PG_FUNCTION_ARGS   ) 

Definition at line 1214 of file float.c.

References ereport, errcode(), errmsg(), ERROR, PG_GETARG_FLOAT4, PG_RETURN_INT32, and rint().

{
    float4      num = PG_GETARG_FLOAT4(0);

    if (num < INT_MIN || num > INT_MAX || isnan(num))
        ereport(ERROR,
                (errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
                 errmsg("integer out of range")));

    PG_RETURN_INT32((int32) rint(num));
}

char* generate_collation_name ( Oid  collid  )