You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
BigInt is appeared in v8 not so long ago. In plv8 it is supported from 3.0.0. If sql query contains bigint columns, values are converted correctly after plv8.execute. But if function returns JSONB, bigint json fields are converted to text. Example:
CREATE OR REPLACE function plv8.test_count(
"tableName" text)
RETURNS jsonb AS $$
const data = plv8.execute(`SELECT COUNT(*) AS "count" FROM ${tableName}`);
return data[0]
$$ LANGUAGE plv8;
SELECT * FROM plv8.test_count('my_table');
-- returns: {"count": "9"}
Value of count is text value. Totally unexpected behaviour, hope for soon fix.
p.s. In plv8 v 2.x.x this function works correct (if count value fits into int).
The text was updated successfully, but these errors were encountered:
BigInt is not serializable in v8 (or in the spec) as JSON, and after much previous discussion it was decided that by default plv8 will follow with this decision in v8 and the spec.
if you feel that you must break the spec, you can look at https://github.com/plv8/plv8/blob/v3.1.2/Makefile#L77-L79 which allows you to tell plv8 to ignore the spec and try to do a "best guess" at how to figure out how to serialize/deserialize a BigInt, probably making mistakes as it goes.
BigInt is appeared in v8 not so long ago. In plv8 it is supported from 3.0.0. If sql query contains bigint columns, values are converted correctly after plv8.execute. But if function returns JSONB, bigint json fields are converted to text. Example:
Value of count is text value. Totally unexpected behaviour, hope for soon fix.
p.s. In plv8 v 2.x.x this function works correct (if count value fits into int).
The text was updated successfully, but these errors were encountered: