pgsql-server/src/backend/utils/adt ruleutils.c - Mailing list pgsql-committers

From momjian@svr1.postgresql.org (Bruce Momjian)
Subject pgsql-server/src/backend/utils/adt ruleutils.c
Date
Msg-id 20030929185556.B4644D1B4E6@svr1.postgresql.org
Whole thread Raw
List pgsql-committers
CVSROOT:    /cvsroot
Module name:    pgsql-server
Changes by:    momjian@svr1.postgresql.org    03/09/29 15:55:56

Modified files:
    src/backend/utils/adt: ruleutils.c

Log message:
    The brackets aren't put on the CHECK constraints properly.

    Before patch:

    test=# select pg_get_constraintdef(oid) from pg_constraint;
    pg_get_constraintdef
    -------------------------------------------------------------------------------------------------
    CHECK (VALUE >= 0)
    CHECK ((((a)::text = 'asdf'::text) OR ((a)::text = 'fdsa'::text)) OR
    ((a)::text = 'dfd'::text))
    PRIMARY KEY (b)
    FOREIGN KEY (a) REFERENCES test2(b)
    UNIQUE (b)
    (5 rows)

    test=# select pg_get_constraintdef(oid, true) from pg_constraint;
    pg_get_constraintdef
    -----------------------------------------------------------------------------------
    CHECK VALUE >= 0
    CHECK a::text = 'asdf'::text OR a::text = 'fdsa'::text OR a::text =
    'dfd'::text
    PRIMARY KEY (b)
    FOREIGN KEY (a) REFERENCES test2(b)
    UNIQUE (b)
    (5 rows)

    After patch:

    test=# select pg_get_constraintdef(oid) from pg_constraint;
    pg_get_constraintdef
    -------------------------------------------------------------------------------------------------
    CHECK (VALUE >= 0)
    CHECK ((((a)::text = 'asdf'::text) OR ((a)::text = 'fdsa'::text)) OR
    ((a)::text = 'dfd'::text))
    PRIMARY KEY (b)
    FOREIGN KEY (a) REFERENCES test2(b)
    UNIQUE (b)
    (5 rows)

    test=# select pg_get_constraintdef(oid, true) from pg_constraint;
    pg_get_constraintdef
    -----------------------------------------------------------------------------------
    CHECK (VALUE >= 0)

    `  CHECK (a::text = 'asdf'::text OR a::text = 'fdsa'::text OR a::text =
    'dfd'::text)
    PRIMARY KEY (b)
    FOREIGN KEY (a) REFERENCES test2(b)
    UNIQUE (b)
    (5 rows)

    It's important that those brackets are there to (a) match all other
    constraints and (b) so that people can just copy and paste them and it
    will work as SQL.

    Christopher Kings-Lynne


pgsql-committers by date:

Previous
From: momjian@svr1.postgresql.org (Bruce Momjian)
Date:
Subject: pgsql-server/contrib/tsearch2 ts_cfg.c snowbal ...
Next
From: momjian@svr1.postgresql.org (Bruce Momjian)
Date:
Subject: pgsql-server/doc TODO