Project

General

Profile

« Previous | Next » 

Revision 14151

fix: schemas/util.sql: check_constraint view: def: use pg_get_expr() with pretty-print, to avoid extra () that complicate parsing

View differences:

trunk/schemas/util.sql
1497 1497
CREATE FUNCTION derived_col_expr_from_check_constraint(check_constraint_def check_constraint_def) RETURNS text
1498 1498
    LANGUAGE sql IMMUTABLE
1499 1499
    AS $_$
1500
SELECT util.extract_str($$(NOT ($$||quote_ident(
1500
SELECT util.extract_str($$NOT $$||quote_ident(
1501 1501
(check_constraint_def).constraint_.name)||$$ IS DISTINCT FROM $$,
1502
$$))$$, check_constraint_def.expr)
1502
'', check_constraint_def.expr)
1503 1503
$_$;
1504 1504

  
1505 1505

  
......
5401 5401
    ROW(ROW(s.table_, (s.name)::text), s.def)::check_constraint_def AS constraint_
5402 5402
   FROM ( SELECT (pg_constraint.conrelid)::regclass AS table_,
5403 5403
            pg_constraint.conname AS name,
5404
            pg_constraint.consrc AS def
5404
            pg_get_expr(pg_constraint.conbin, pg_constraint.conrelid, true) AS def
5405 5405
           FROM pg_constraint
5406 5406
          WHERE (pg_constraint.contype = 'c'::"char")) s;
5407 5407

  
5408 5408

  
5409 5409
--
5410
-- Name: VIEW check_constraint; Type: COMMENT; Schema: util; Owner: -
5411
--
5412

  
5413
COMMENT ON VIEW check_constraint IS '
5414
pg_get_expr(): pg_get_expr(__, /*pretty-print, to avoid extra () :*/true)
5415
';
5416

  
5417

  
5418
--
5410 5419
-- Name: map; Type: TABLE; Schema: util; Owner: -; Tablespace: 
5411 5420
--
5412 5421

  

Also available in: Unified diff