-
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.
parallelism for 9.6
- Loading branch information
Showing
6 changed files
with
435 additions
and
4 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,8 +1,8 @@ | ||
{ | ||
"name": "language", | ||
"abstract": "Enumerable type for languages", | ||
"version": "0.0.1", | ||
"maintainer": [ "Chris Travers <christravers@adjust.com>", "Manuel Kniep <[email protected]>" ], | ||
"version": "0.0.2", | ||
"maintainer": [ "Chris Travers <chris.travers@adjust.com>", "Manuel Kniep <[email protected]>" ], | ||
"license": { | ||
"PostgreSQL": "http://www.postgresql.org/about/licence" | ||
}, | ||
|
@@ -17,7 +17,7 @@ | |
"version": "1.0.0", | ||
"url": "http://pgxn.org/meta/spec.txt" | ||
}, | ||
"description": "This extnesion offers a one-byte storage type that works as an enum for major languages.", | ||
"description": "This extension offers a fixed-byte storage type that works as an enum for major languages.", | ||
"prereqs": { | ||
"runtime": { | ||
"requires": { | ||
|
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.1' | ||
default_version = '0.0.2' | ||
relocatable = true | ||
requires = '' |
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,23 @@ | ||
|
||
|
||
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 |
---|---|---|
@@ -0,0 +1,181 @@ | ||
|
||
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 BOOL | ||
AS '$libdir/language.so' | ||
LANGUAGE C IMMUTABLE STRICT; | ||
|
||
COMMENT ON FUNCTION language_lt(language, language) IS 'implementation of < operator'; | ||
|
||
CREATE FUNCTION language_le(language, language) | ||
RETURNS BOOL | ||
AS '$libdir/language.so' | ||
LANGUAGE C IMMUTABLE STRICT; | ||
|
||
COMMENT ON FUNCTION language_le(language, language) IS 'implementation of <= operator'; | ||
|
||
CREATE FUNCTION language_eq(language, language) | ||
RETURNS BOOL | ||
AS '$libdir/language.so' | ||
LANGUAGE C IMMUTABLE STRICT; | ||
|
||
COMMENT ON FUNCTION language_eq(language, language) IS 'implementation of = operator'; | ||
|
||
CREATE FUNCTION language_neq(language, language) | ||
RETURNS BOOL | ||
AS '$libdir/language.so' | ||
LANGUAGE C IMMUTABLE STRICT; | ||
|
||
COMMENT ON FUNCTION language_neq(language, language) IS 'implementation of <> operator'; | ||
|
||
CREATE FUNCTION language_ge(language, language) | ||
RETURNS BOOL | ||
AS '$libdir/language.so' | ||
LANGUAGE C IMMUTABLE STRICT; | ||
|
||
COMMENT ON FUNCTION language_ge(language, language) IS 'implementation of >= operator'; | ||
|
||
CREATE FUNCTION language_gt(language, language) | ||
RETURNS BOOL | ||
AS '$libdir/language.so' | ||
LANGUAGE C IMMUTABLE STRICT; | ||
|
||
COMMENT ON FUNCTION language_gt(language, language) IS 'implementation of > operator'; | ||
|
||
CREATE FUNCTION hash_language(language) | ||
RETURNS integer | ||
AS '$libdir/language.so' | ||
LANGUAGE C IMMUTABLE STRICT; | ||
|
||
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 int4 | ||
AS '$libdir/language.so' | ||
LANGUAGE C IMMUTABLE STRICT; | ||
|
||
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); |
Oops, something went wrong.