Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'r3.0alpha' of https://github.com/JerrySievert/plv8 into…
… r3.0alpha
- Loading branch information
Showing
19 changed files
with
236 additions
and
98 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
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
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
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
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
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
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,26 @@ | ||
-- BigInt precedures | ||
-- a BigInt that will work on any value | ||
CREATE OR REPLACE FUNCTION bigint_working(val BIGINT) | ||
RETURNS BIGINT AS $$ | ||
return val - 1n; | ||
$$ LANGUAGE plv8 STABLE STRICT; | ||
SELECT bigint_working(9223372036854775807); | ||
bigint_working | ||
--------------------- | ||
9223372036854775806 | ||
(1 row) | ||
|
||
SELECT bigint_working(32); | ||
bigint_working | ||
---------------- | ||
31 | ||
(1 row) | ||
|
||
-- a BigInt that will fail on any value | ||
CREATE OR REPLACE FUNCTION bigint_failing(val BIGINT) | ||
RETURNS BIGINT AS $$ | ||
return val - 1; | ||
$$ LANGUAGE plv8 STABLE STRICT; | ||
SELECT bigint_failing(9223372036854775807); | ||
ERROR: TypeError: Cannot mix BigInt and other types, use explicit conversions | ||
CONTEXT: bigint_failing() LINE 2: return val - 1; |
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,31 @@ | ||
-- BigInt precedures | ||
-- a BigInt that will work on BigInt | ||
CREATE OR REPLACE FUNCTION bigint_graceful1(val BIGINT) | ||
RETURNS BIGINT AS $$ | ||
return val - 1n; | ||
$$ LANGUAGE plv8 STABLE STRICT; | ||
SELECT bigint_graceful1(9223372036854775807); | ||
bigint_graceful1 | ||
--------------------- | ||
9223372036854775806 | ||
(1 row) | ||
|
||
-- this will fail | ||
SELECT bigint_graceful1(32); | ||
ERROR: TypeError: Cannot mix BigInt and other types, use explicit conversions | ||
CONTEXT: bigint_graceful1() LINE 2: return val - 1n; | ||
-- a BigInt that will fail on BigInt | ||
CREATE OR REPLACE FUNCTION bigint_graceful2(val BIGINT) | ||
RETURNS BIGINT AS $$ | ||
return val - 1; | ||
$$ LANGUAGE plv8 STABLE STRICT; | ||
SELECT bigint_graceful2(32); | ||
bigint_graceful2 | ||
------------------ | ||
31 | ||
(1 row) | ||
|
||
-- this will fail | ||
SELECT bigint_graceful2(9223372036854775807); | ||
ERROR: TypeError: Cannot mix BigInt and other types, use explicit conversions | ||
CONTEXT: bigint_graceful2() LINE 2: return val - 1; |
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
Oops, something went wrong.