[Chicago-talk] Suppressing "NOTICE:" in postgres

Michael Potter michael at potter.name
Mon Mar 23 19:36:24 PDT 2009

Chicago Perl Crew,

When I do this :
   $sql = qq{ DROP TABLE "terminalXgroup" CASCADE };

I get this message:
NOTICE:  drop cascades to constraint terminalXgroup_group_fkey on
table "terminalXgroup"

a) What are the ways to suppress this message?
b) Is there a convenient way to capture this message in a variable
rather than letting it go to the terminal?
c) Is there a way to drop all constraints on a table without knowing
their names?

for c) I could drop the constraints before I drop the table; that way
the notice message would not be active.  I know how to drop a single
constraint by name, but I can not find how to get the list of
constraints in postgres.

My goal is the drop a set of tables and not have a bunch of messages
come out that I do not care about.  Even if I do a) or b) I think I
still want to do c).

I am not willing to name all my constraints; I think I would rather
live with the notice messages.

Michael Potter

More information about the Chicago-talk mailing list