Skip to main content

Crate rupg_func

Crate rupg_func 

Source
Expand description

The built-in functions: the input and output functions of the types, and the kernels of the functions, the operators and the casts of pg_proc.

A kernel is found by the prosrc of the function, as the fmgr of PostgreSQL finds the C function of an internal function. Many functions of the same kind, such as the comparisons and the arithmetic of the number types, share one kernel that reads the types of the call. A function that has no kernel here is an error 0A000 when the executor compiles the query, so a query never gives a wrong answer for a function that the engine does not have.

Structs§

AdvisoryKey
The key of an advisory lock, the fields 2 to 4 of its tag: the two halves of a bigint key with kind 1, or two integer keys with kind 2. The database of the session is the field 1.
AdvisoryLock
A request for an advisory lock: the key, the mode, which is ShareLock when share is true and ExclusiveLock when it is false, and the level, which is the session when session is true and the transaction when it is false.
AuthMatch
A match of auth_search.
Backend
A row of the table of the sessions, PgBackendStatus.
Call
A call of a function.
IntervalSum
IntervalAggState: the state of sum and avg of interval. The infinite values do not count in count and sum.
PathVar
A value of the PASSING clause of a SQL/JSON query function: its name, its type and its value.
Randomness
The random state of a session: the generator of random, and the last time of uuidv7 in nanoseconds since 1970-01-01.
RelationCounts
The counters of a relation in the statistics of the server, the part of PgStat_StatTabEntry that rupg keeps.
Sequences
The cache of the sequences of a session, seqhashtab and last_used_seq of sequence.c.
Ssl
The TLS of a session, PgBackendSSLStatus. An empty text of the client certificate is null, as for a session with no client certificate.
Writes
The rows that a transaction inserted, updated and deleted in one relation, as pgstat_count_heap_insert, pgstat_count_heap_update and pgstat_count_heap_delete count them.

Enums§

BackendState
The state of a session, BackendState of backend_status.h.
Client
An end of the connection of a session.
SqlJsonItem
An item that a SQL/JSON query function finds.
XactState
The state of a transaction for pg_xact_status, as TransactionIdIsInProgress and TransactionIdDidCommit give it.

Constants§

HASH_PARTITION_SEED
HASH_PARTITION_SEED: the seed of the hashes of the keys of PARTITION BY HASH.

Traits§

Session
The state of the session that the functions read.

Functions§

auth_compile
regcomp_auth_token: compile a regular expression of pg_hba.conf or pg_ident.conf with the flags REG_ADVANCED.
auth_search
regexec_auth_token: find the regular expression pattern of auth_compile in s. The result is None when the pattern does not match.
base_type
The type that holds the values of a type: the base type of a domain, or the type itself.
char_to_encoding
pg_char_to_encoding: the number of an encoding name or alias, or -1.
check_execute
The EXECUTE checks of ExecInitFunc and ExecInitAgg: an error for the first function that the current user cannot call. A superuser can call each function, and a function that does not exist is not checked.
check_percentile
The check of a percentile of percentile_disc and percentile_cont, as percentile_disc_final and setup_pct_info do it.
check_permissions
ExecCheckPermissions: an error for the first relation that the statement uses without the privileges that it needs. A relation of the query of a view counts as the owner of the view. A superuser has each privilege, and a relation that does not exist is not checked.
compare
The order of two values that are not null. left and right are their types: a bpchar value compares without its trailing spaces.
deparse_constant
The text of a stored constant, as get_const_expr with showtype -1 shows it, for the detail of an error on the bound of a partition.
deparse_expression
deparse_expression of a stored expression that has no column, such as the default of a domain in typdefault.
deparse_relation_expression
deparse_expression of a stored expression of the relation relid, with the names of its columns, as pg_get_expr gives it. The relation 0 gives an expression with no columns, such as the check of a domain.
describe
getObjectDescription with missing_ok: the description of the object, or None when it does not exist.
encoding
pg_char_to_encoding with the name of the encoding: the canonical name of an encoding name or alias, without regard to case and to the characters that are not letters or digits.
encoding_to_char
pg_encoding_to_char: the name of an encoding by its number, or an empty string for a number that has no encoding.
equal
True when two values that are not null are equal.
explain
The output of EXPLAIN for a plan, with the names and the expressions that the session shows.
extended_hash
The extended hash of a value of the type ty with the seed, as the support function 2 of the default hash operator class of the type gives it.
function_body
The body of a function in SQL of the catalog of the session, as the analyzer reads it for a call with arguments of the types inputs, with $1 as the first argument. None for a function that is not in the catalog of the session.
hash_combine64
hash_combine64: the hash row with the hash one added to it.
index_key_columns
pg_get_indexdef_columns(oid, true): the key columns and the expressions of the key of an index, as the detail of an error of a duplicate key shows them.
input
The text input function of the type, with the typmod of the target.
input_soft
The text input function of the type, as InputFunctionCallSafe calls it. The outer error is a hard error, such as a type that has no input function. The inner error is a soft error of the input function for a bad value, which pg_input_is_valid reports as false. The checks of a domain are not part of the input.
input_supported
True when the engine has the text input function of the type.
insert_allowed
ExecCheckOneRelPerms for INSERT into the columns attnums: true when the role has INSERT on the table, or on each of the columns. With no columns, INSERT on any column is enough.
interval_lerp
interval_lerp of orderedsetaggs.c: the interval at the fraction pct of the way from lo to hi, for percentile_cont.
is_json
ExecEvalJsonIsPredicate: true when the value is JSON of the kind of the predicate. base_type is text, json or jsonb. The first token of a text or a json value gives its kind, and only a text value or a check of the keys parses all of the value.
is_row_type
True for record and for the row type of a system catalog, which record_out and record_send show. The output of each field needs the output of its type, which the engine checks when it shows the row.
json_ctor_array
json_build_array_worker and jsonb_build_array_worker for JSON_ARRAY: an array of the values. ABSENT ON NULL skips the null values.
json_ctor_object
json_build_object_worker and jsonb_build_object_worker for JSON_OBJECT: an object of the keys and the values, one after the other.
json_ctor_parse
JSON with WITH UNIQUE KEYS: the json or jsonb value of a text that has no object with a key two times, as json_validate and jsonb_from_text check it.
json_ctor_scalar
datum_to_json and datum_to_jsonb for JSON_SCALAR: the JSON value of a SQL value, or null for null.
json_structured
True when the category of the type is an array or a composite, after which json_agg puts a new line between the values.
json_value
The text of a value, as datum_to_json_internal writes it. A key is always a string, and a key of an array, a composite or a json type is an error.
kernel
The kernel of the function with this pg_proc OID, or None if the engine does not have it.
local_time
The local time of the session for an instant in microseconds since 2000-01-01 UTC, and the offset east of UTC in seconds of the zone at that instant.
lock_table_allowed
LockTableAclCheck: true when role can lock the relation relid in the lock mode mode, where AccessShareLock is 1. MAINTAIN, UPDATE, DELETE and TRUNCATE allow each mode, SELECT allows ACCESS SHARE, and INSERT allows the modes up to ROW EXCLUSIVE.
output
The text output function of the type.
output_supported
True when the engine has the output and the send function of the type.
partition_hash
compute_partition_hash_value: the hash of the key of a row of a table that PARTITION BY HASH partitions. Each value that is not null gets the extended hash of its type with the seed HASH_PARTITION_SEED, and hash_combine64 adds it to the hash. A row goes in the partition whose remainder is this hash modulo its modulus.
partition_key_columns
pg_get_partkeydef_columns(oid, true): the columns and the expressions of the partition key of a partitioned table, with no strategy, collations or operator classes, as the detail of an error of tuple routing shows them.
quote_identifier
quote_identifier of ruleutils.c: the name in double quotes unless it is a simple name in lower case that is not a key word, or that is an unreserved key word.
range_agg
range_agg_finalfn: the multirange of the type multirange that has the values of the ranges. No range gives null.
receive
The binary input function of the type. number is the number of the parameter, from 1, for the error of bytes that are left over.
sample_rows
BeginSampleScan of the two methods and the choice of the rows: the numbers of the rows, of count, that the sample keeps. seed is the value of REPEATABLE. With None, the seed comes from pg_global_prng_state, as in tablesample_init.
send
The binary output function of the type.
set_kernel
The set kernel of the function with this pg_proc OID, or None if the engine does not have it.
sql_json_path
executeJsonPath for JSON_EXISTS, JSON_QUERY and JSON_VALUE: whether the path on the jsonb value finds an item, and the items when want is true. The result is None for an error of the path when throw is false. The casts of the datetime values can use the zone of the session.
to_text
The cast of a value to text: the output function, with the casts of pg_cast that differ from it. bool gives true and false, and bpchar loses its trailing spaces.
ts_config_setting
check_default_text_search_config: the value that default_text_search_config keeps for the configuration with the name in text. The value is the name with its schema, so a later change of search_path does not change the configuration. None when no configuration has the name.
type_error
The error of a type function as the session sends it.
type_message_name
format_type_be: the name of a type for a message, with its schema when the search path does not find it.
view_statement
The text of a CREATE VIEW statement that makes the view name again with the query and the names of its columns, as pg_get_viewdef_worker gives the query. The catalog keeps the text of a view, and the text names the objects that the query reads, so ALTER ... RENAME writes the text again from the query of the old names.
with_datatype
errdatatype: the error with the schema and the name of the type ty as the names of its object.
with_domain_constraint
errdomainconstraint: with_datatype for the domain and the name of the constraint.
with_table
errtable: the error with the schema and the name of the relation rel as the names of its object. An error for a relation that is not in the catalog does not change.
with_table_column
errtablecol: with_table and the name of the column.
with_table_constraint
errtableconstraint: with_table and the name of the constraint.
xml_expr
ExecEvalXmlExpr: the value of a SQL/XML function from the values of its named arguments and of its other arguments, in the order of XmlExpr::children.
xml_value
map_sql_value_to_xml_value: the text of a value that is not null in XML. An array gives an element for each element that is not null. A boolean, a date, a timestamp and a bytea have the forms of XML Schema. The other types give their output, which has the special characters escaped when escape is true, except for xml.

Type Aliases§

Kernel
The code of a function. It gets the values of the arguments. A strict function does not get a null value, because the executor gives null without the call.
SetKernel
The code of a set-returning function. It gets the values of the arguments and gives the rows of the result. A strict function does not get a null value, because the executor gives no rows without the call.