Project

General

Profile

« Previous | Next » 

Revision 14214

schemas/util.sql: typeof(expr text, table_ regtype): use simpler util.eval2val() instead of EXECUTE

View differences:

util.sql
5599 5599
--
5600 5600

  
5601 5601
CREATE FUNCTION typeof(expr text, table_ regtype DEFAULT NULL::regtype) RETURNS regtype
5602
    LANGUAGE plpgsql STABLE
5602
    LANGUAGE sql STABLE
5603 5603
    AS $_$
5604
DECLARE
5605
    type regtype;
5606
BEGIN
5607
    EXECUTE $$SELECT pg_typeof($$||expr||$$)$$||
5608
COALESCE($$ FROM (SELECT (NULL::$$||table_||$$).*) _s$$, '') INTO STRICT type;
5609
    RETURN type;
5610
END;
5604
SELECT util.eval2val($$SELECT pg_typeof($$||expr||$$)$$||
5605
COALESCE($$ FROM (SELECT (NULL::$$||table_||$$).*) _s$$, ''), NULL::regtype)
5611 5606
$_$;
5612 5607

  
5613 5608

  

Also available in: Unified diff