2015-07-16 18:34:42 +00:00
|
|
|
-- complain if script is sourced in psql, rather than via CREATE EXTENSION
|
|
|
|
\echo Use "CREATE EXTENSION pg_libphonenumber" to load this file. \quit
|
|
|
|
|
|
|
|
CREATE TYPE phone_number;
|
|
|
|
|
|
|
|
CREATE FUNCTION phone_number_in(cstring) RETURNS phone_number
|
|
|
|
LANGUAGE c IMMUTABLE STRICT
|
|
|
|
AS 'pg_libphonenumber', 'phone_number_in';
|
|
|
|
|
2015-07-16 19:56:23 +00:00
|
|
|
CREATE FUNCTION parse_phone_number(cstring, cstring) RETURNS phone_number
|
|
|
|
LANGUAGE c IMMUTABLE STRICT
|
|
|
|
AS 'pg_libphonenumber', 'parse_phone_number';
|
|
|
|
|
2015-07-16 18:34:42 +00:00
|
|
|
CREATE FUNCTION phone_number_out(phone_number) RETURNS cstring
|
|
|
|
LANGUAGE c IMMUTABLE STRICT
|
|
|
|
AS 'pg_libphonenumber', 'phone_number_out';
|
|
|
|
|
|
|
|
CREATE FUNCTION phone_number_recv(internal) RETURNS phone_number
|
|
|
|
LANGUAGE c IMMUTABLE STRICT
|
|
|
|
AS 'pg_libphonenumber', 'phone_number_recv';
|
|
|
|
|
|
|
|
CREATE FUNCTION phone_number_send(phone_number) RETURNS bytea
|
|
|
|
LANGUAGE c IMMUTABLE STRICT
|
|
|
|
AS 'pg_libphonenumber', 'phone_number_send';
|
|
|
|
|
2015-07-16 19:03:05 +00:00
|
|
|
--SIZEOF_PHONE_NUMBER is replaced when generating the "real" script.
|
2015-07-16 18:34:42 +00:00
|
|
|
CREATE TYPE phone_number (
|
2015-07-16 19:03:05 +00:00
|
|
|
INTERNALLENGTH = SIZEOF_PHONE_NUMBER,
|
2015-07-16 18:34:42 +00:00
|
|
|
INPUT = phone_number_in,
|
|
|
|
OUTPUT = phone_number_out,
|
|
|
|
RECEIVE = phone_number_recv,
|
|
|
|
SEND = phone_number_send,
|
|
|
|
ALIGNMENT = double,
|
|
|
|
STORAGE = plain
|
|
|
|
);
|
|
|
|
|
2015-07-16 19:56:23 +00:00
|
|
|
-- vim:syntax=sql
|