-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
due to botched 0.0.3 release, releasing 0.0.4 release instead
- Loading branch information
Showing
4 changed files
with
207 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
{ | ||
"name": "language", | ||
"abstract": "Enumerable type for languages", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"maintainer": [ "Chris Travers <[email protected]>", "Manuel Kniep <[email protected]>" ], | ||
"license": { | ||
"PostgreSQL": "http://www.postgresql.org/about/licence" | ||
}, | ||
"provides": { | ||
"language": { | ||
"file": "sql/pg-language.sql", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"abstract": "Enumerable language. Stored in one byte." | ||
} | ||
}, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
CREATE OR REPLACE FUNCTION language_lt(language, language) | ||
RETURNS boolean LANGUAGE internal IMMUTABLE AS 'charlt'; | ||
CREATE OR REPLACE FUNCTION language_le(language, language) | ||
RETURNS boolean LANGUAGE internal IMMUTABLE AS 'charle'; | ||
CREATE OR REPLACE FUNCTION language_eq(language, language) | ||
RETURNS boolean LANGUAGE internal IMMUTABLE AS 'chareq'; | ||
CREATE OR REPLACE FUNCTION language_neq(language, language) | ||
RETURNS boolean LANGUAGE internal IMMUTABLE AS 'charne'; | ||
CREATE OR REPLACE FUNCTION language_ge(language, language) | ||
RETURNS boolean LANGUAGE internal IMMUTABLE AS 'charge'; | ||
CREATE OR REPLACE FUNCTION language_gt(language, language) | ||
RETURNS boolean LANGUAGE internal IMMUTABLE AS 'chargt'; | ||
CREATE OR REPLACE FUNCTION hash_language(language) | ||
RETURNS integer LANGUAGE internal IMMUTABLE AS 'hashchar'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,190 @@ | ||
-- complain if script is sourced in psql, rather than via CREATE EXTENSION | ||
\echo Use "CREATE EXTENSION language" to load this file. \quit | ||
|
||
CREATE TYPE language; | ||
|
||
CREATE FUNCTION supported_languages() | ||
RETURNS SETOF language | ||
AS '$libdir/language.so' | ||
LANGUAGE C IMMUTABLE STRICT; | ||
|
||
CREATE FUNCTION language_in(cstring) | ||
RETURNS language | ||
AS '$libdir/language.so' | ||
LANGUAGE C IMMUTABLE STRICT; | ||
|
||
CREATE FUNCTION language_out(language) | ||
RETURNS cstring | ||
AS '$libdir/language.so' | ||
LANGUAGE C IMMUTABLE STRICT; | ||
|
||
CREATE FUNCTION language_recv(internal) | ||
RETURNS language | ||
AS '$libdir/language.so' | ||
LANGUAGE C IMMUTABLE STRICT; | ||
|
||
CREATE FUNCTION language_send(language) | ||
RETURNS bytea | ||
AS '$libdir/language.so' | ||
LANGUAGE C IMMUTABLE STRICT; | ||
|
||
CREATE TYPE language ( | ||
internallength = 1, | ||
input = language_in, | ||
output = language_out, | ||
send = language_send, | ||
receive = language_recv, | ||
alignment = char, | ||
PASSEDBYVALUE | ||
); | ||
|
||
COMMENT ON TYPE language | ||
IS '1-byte adjust-specific Language Code'; | ||
|
||
CREATE FUNCTION language_lt(language, language) | ||
RETURNS boolean LANGUAGE internal IMMUTABLE AS 'charlt'; | ||
|
||
COMMENT ON FUNCTION language_lt(language, language) IS 'implementation of < operator'; | ||
|
||
CREATE FUNCTION language_le(language, language) | ||
RETURNS boolean LANGUAGE internal IMMUTABLE AS 'charle'; | ||
|
||
COMMENT ON FUNCTION language_le(language, language) IS 'implementation of <= operator'; | ||
|
||
CREATE FUNCTION language_eq(language, language) | ||
RETURNS boolean LANGUAGE internal IMMUTABLE AS 'chareq'; | ||
|
||
COMMENT ON FUNCTION language_eq(language, language) IS 'implementation of = operator'; | ||
|
||
CREATE FUNCTION language_neq(language, language) | ||
RETURNS boolean LANGUAGE internal IMMUTABLE AS 'charne'; | ||
|
||
COMMENT ON FUNCTION language_neq(language, language) IS 'implementation of <> operator'; | ||
|
||
CREATE FUNCTION language_ge(language, language) | ||
RETURNS boolean LANGUAGE internal IMMUTABLE AS 'charge'; | ||
|
||
COMMENT ON FUNCTION language_ge(language, language) IS 'implementation of >= operator'; | ||
|
||
CREATE FUNCTION language_gt(language, language) | ||
RETURNS boolean LANGUAGE internal IMMUTABLE AS 'chargt'; | ||
|
||
COMMENT ON FUNCTION language_gt(language, language) IS 'implementation of > operator'; | ||
|
||
CREATE FUNCTION hash_language(language) | ||
RETURNS integer LANGUAGE internal IMMUTABLE AS 'hashchar'; | ||
|
||
COMMENT ON FUNCTION hash_language(language) IS 'hash'; | ||
|
||
CREATE OPERATOR < ( | ||
leftarg = language, | ||
rightarg = language, | ||
procedure = language_lt, | ||
commutator = >, | ||
negator = >=, | ||
restrict = scalarltsel, | ||
join = scalarltjoinsel | ||
); | ||
|
||
COMMENT ON OPERATOR <(language, language) IS 'less than'; | ||
|
||
CREATE OPERATOR <= ( | ||
leftarg = language, | ||
rightarg = language, | ||
procedure = language_le, | ||
commutator = >=, | ||
negator = >, | ||
restrict = scalarltsel, | ||
join = scalarltjoinsel | ||
); | ||
|
||
COMMENT ON OPERATOR <=(language, language) IS 'less than or equal'; | ||
|
||
CREATE OPERATOR = ( | ||
leftarg = language, | ||
rightarg = language, | ||
procedure = language_eq, | ||
commutator = =, | ||
negator = <>, | ||
restrict = eqsel, | ||
join = eqjoinsel, | ||
HASHES, MERGES | ||
); | ||
|
||
COMMENT ON OPERATOR =(language, language) IS 'equal'; | ||
|
||
CREATE OPERATOR >= ( | ||
leftarg = language, | ||
rightarg = language, | ||
procedure = language_ge, | ||
commutator = <=, | ||
negator = <, | ||
restrict = scalargtsel, | ||
join = scalargtjoinsel | ||
); | ||
|
||
COMMENT ON OPERATOR >=(language, language) IS 'greater than or equal'; | ||
|
||
CREATE OPERATOR > ( | ||
leftarg = language, | ||
rightarg = language, | ||
procedure = language_gt, | ||
commutator = <, | ||
negator = <=, | ||
restrict = scalargtsel, | ||
join = scalargtjoinsel | ||
); | ||
|
||
COMMENT ON OPERATOR >(language, language) IS 'greater than'; | ||
|
||
CREATE OPERATOR <> ( | ||
leftarg = language, | ||
rightarg = language, | ||
procedure = language_neq, | ||
commutator = <>, | ||
negator = =, | ||
restrict = neqsel, | ||
join = neqjoinsel | ||
); | ||
|
||
COMMENT ON OPERATOR <>(language, language) IS 'not equal'; | ||
|
||
CREATE FUNCTION language_cmp(language, language) | ||
RETURNS integer LANGUAGE internal IMMUTABLE AS 'btcharcmp'; | ||
|
||
CREATE OPERATOR CLASS language_ops | ||
DEFAULT FOR TYPE language USING btree AS | ||
OPERATOR 1 < , | ||
OPERATOR 2 <= , | ||
OPERATOR 3 = , | ||
OPERATOR 4 >= , | ||
OPERATOR 5 > , | ||
FUNCTION 1 language_cmp(language, language); | ||
|
||
CREATE OPERATOR CLASS language_ops | ||
DEFAULT FOR TYPE language USING hash AS | ||
OPERATOR 1 = , | ||
FUNCTION 1 hash_language(language); | ||
|
||
|
||
DO $$ | ||
DECLARE version_num integer; | ||
BEGIN | ||
SELECT current_setting('server_version_num') INTO STRICT version_num; | ||
IF version_num > 90600 THEN | ||
EXECUTE $E$ ALTER FUNCTION language_in(cstring) PARALLEL SAFE $E$; | ||
EXECUTE $E$ ALTER FUNCTION language_out(language) PARALLEL SAFE $E$; | ||
EXECUTE $E$ ALTER FUNCTION language_recv(internal) PARALLEL SAFE $E$; | ||
EXECUTE $E$ ALTER FUNCTION language_send(language) PARALLEL SAFE $E$; | ||
EXECUTE $E$ ALTER FUNCTION language_eq(language, language) PARALLEL SAFE $E$; | ||
EXECUTE $E$ ALTER FUNCTION language_neq(language, language) PARALLEL SAFE $E$; | ||
EXECUTE $E$ ALTER FUNCTION language_lt(language, language) PARALLEL SAFE $E$; | ||
EXECUTE $E$ ALTER FUNCTION language_le(language, language) PARALLEL SAFE $E$; | ||
EXECUTE $E$ ALTER FUNCTION language_gt(language, language) PARALLEL SAFE $E$; | ||
EXECUTE $E$ ALTER FUNCTION language_ge(language, language) PARALLEL SAFE $E$; | ||
EXECUTE $E$ ALTER FUNCTION language_cmp(language, language) PARALLEL SAFE $E$; | ||
EXECUTE $E$ ALTER FUNCTION hash_language(language) PARALLEL SAFE $E$; | ||
END IF; | ||
END; | ||
$$; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
# currency extension | ||
comment = 'Custom PostgreSQL language enumeration type' | ||
default_version = '0.0.3' | ||
default_version = '0.0.4' | ||
relocatable = true | ||
requires = '' |