Project

General

Profile

« Previous | Next » 

Revision 14256

bugfix: schemas/util.sql: check_constraint view: can't use consrc because this doesn't get auto-updated with column renames

View differences:

trunk/schemas/util.sql
6202 6202
    ROW(ROW((s.table_)::regclass, (s.name)::text), s.def)::check_constraint_def AS constraint_
6203 6203
   FROM ( SELECT pg_constraint.conrelid AS table_,
6204 6204
            pg_constraint.conname AS name,
6205
            trim_parens(pg_constraint.consrc) AS def
6205
            trim_parens(pg_get_expr(pg_constraint.conbin, pg_constraint.conrelid, false)) AS def
6206 6206
           FROM pg_constraint
6207 6207
          WHERE (pg_constraint.contype = 'c'::"char")) s;
6208 6208

  
......
6214 6214
COMMENT ON VIEW check_constraint IS '
6215 6215
conrelid: don''t cast to regclass so can use index scan
6216 6216

  
6217
consrc:
6218
**IMPORTANT**: need to remove the enclosing () to be consistent everywhere.
6219
*don''t* use `pg_get_expr(conbin, conrelid, /*pretty-print:*/true)`,
6220
because this format does not match util.canon_sql().
6217
pg_get_expr(conbin, conrelid, /*pretty-print:*/false):
6218
can''t use consrc because this doesn''t get auto-updated with column renames.
6219
*don''t* use pretty-print, because this format does not match util.canon_sql().
6220
need to remove the enclosing () to be consistent everywhere.
6221 6221
';
6222 6222

  
6223 6223

  

Also available in: Unified diff