clkao / plv8js-migrated

Automatically exported from code.google.com/p/plv8js
Other
0 stars 0 forks source link

domain gets cast to a string type when passed into plv8 #109

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

CREATE SCHEMA IF NOT EXISTS plv8;
CREATE FUNCTION valid_real(r real) RETURNS boolean
LANGUAGE plv8 IMMUTABLE STRICT
AS $$
  return true;
$$;

CREATE DOMAIN plv8.real AS real
        CONSTRAINT real_check CHECK (valid_real(VALUE));

CREATE FUNCTION get_real(r plv8.real) RETURNS plv8.real
LANGUAGE plv8 IMMUTABLE STRICT
AS $$
  plv8.elog(NOTICE, "getkey on "+r+" type: "+typeof r);
  return r;
$$;

CREATE TABLE realonly (
    data plv8.real
);

COPY realonly (data) FROM stdin;
1.0
\.

SELECT get_real(data) FROM realonly;

What is the expected output? What do you see instead?

NOTICE:  getkey on 1 type: real
 get_real 
----------
        1
(1 row)

NOTICE:  getkey on 1 type: string
 get_real 
----------
        1
(1 row)

What version of the product are you using? On what operating system?

commit 7eb9f31b5717bfa6d3cddcea1772bd8a36f676f5
using postgres 9.4.1 on ubuntu trusty 14.04

Please provide any additional information below.

Original issue reported on code.google.com by istas...@gmail.com on 16 Feb 2015 at 12:18

GoogleCodeExporter commented 9 years ago
This is the same issue as #82

Original comment by AMDuns...@gmail.com on 17 Feb 2015 at 9:16