Skip to content

pg_get_functiondef

Get function’s definition

ivorysql · Get function’s definition

Overview

IDExtensionPackageVersionCategoryLicenseLanguage
9170pg_get_functiondefivorysql1.0SIMApache-2.0C
AttributeHas BinaryHas LibraryNeed LoadHas DDLRelocatableTrusted
--s-dt-NoYesNoYesnoyes

Packages

TypeRepoVersionPG Major CompatibilityPackage PatternDependencies
EXTPIGSTY1.019 18 17 16 15ivorysql-
RPMPIGSTY6.019 18 17 16 15ivorysql-$v-
DEBPIGSTY6.019 18 17 16 15ivorysql-$v-
Linux / PGPG19PG18PG17PG16PG15
el8.x86_64PIGSTY 6.0PIGSTY 5.6N/AN/AN/A
el8.aarch64PIGSTY 6.0PIGSTY 5.6N/AN/AN/A
el9.x86_64PIGSTY 6.0PIGSTY 5.6N/AN/AN/A
el9.aarch64PIGSTY 6.0PIGSTY 5.6N/AN/AN/A
el10.x86_64PIGSTY 6.0PIGSTY 5.6N/AN/AN/A
el10.aarch64PIGSTY 6.0PIGSTY 5.6N/AN/AN/A
d12.x86_64PIGSTY 6.0PIGSTY 5.6N/AN/AN/A
d12.aarch64PIGSTY 6.0PIGSTY 5.6N/AN/AN/A
d13.x86_64PIGSTY 6.0PIGSTY 5.6N/AN/AN/A
d13.aarch64PIGSTY 6.0PIGSTY 5.6N/AN/AN/A
u22.x86_64PIGSTY 6.0PIGSTY 5.6N/AN/AN/A
u22.aarch64PIGSTY 6.0PIGSTY 5.6N/AN/AN/A
u24.x86_64PIGSTY 6.0PIGSTY 5.6N/AN/AN/A
u24.aarch64PIGSTY 6.0PIGSTY 5.6N/AN/AN/A
u26.x86_64PIGSTY 6.0PIGSTY 5.6N/AN/AN/A
u26.aarch64PIGSTY 6.0PIGSTY 5.6N/AN/AN/A

Source

github.com/IvorySQL/IvorySQL/tree/2269591ea327cbf99e7db6f518ec6ecf67cdadee/contrib/pg_get_functiondef

pig build pkg ivorysql;		# build rpm/deb

Install

Make sure PGDG and PIGSTY repo available:

pig repo add pgsql -u   # add both repo and update cache

Install this extension with pig:

pig install ivorysql;		# install by package name
pig install pg_get_functiondef;		# install by extension name

pig install pg_get_functiondef -v 19;   # install for PG 19
pig install pg_get_functiondef -v 18;   # install for PG 18

Create this extension with:

CREATE EXTENSION pg_get_functiondef;

Usage

Sources:

The extension adds overloads of pg_get_functiondef that can look up several function names or OIDs in one call. The text overload returns a name and its definition for each result.

IvorySQL 6.0 is based on PostgreSQL 19.0 and ships pg_get_functiondef at SQL version 1.0. The PG18 package uses IvorySQL 5.6.

The following query uses the variadic text overload installed by the extension.

CREATE EXTENSION IF NOT EXISTS pg_get_functiondef;
SELECT * FROM pg_get_functiondef('char_length', 'substring');

For OIDs, the extension also installs pg_get_functiondef(oid, VARIADIC oid[]). The zero-argument overload reports an error asking for a name or OID. PostgreSQL already provides a single-OID function.

Table reader