Thread: showing rules/triggers with psql

showing rules/triggers with psql

From
"Metzidis, Anthony"
Date:
hey,
kind of a simple question. How can you show the rules/triggers on a database
using psql. Even better: how can you show all rules/triggers/constrains/etc
that pertain to a given table?

as always...thanks.

--tony

-----Original Message-----
From: Peter Eisentraut [mailto:peter_e@gmx.net]
Sent: Thursday, March 01, 2001 11:06 AM
To: Anthony Metzidis
Cc: pgsql-general@postgresql.org
Subject: Re: [GENERAL] PG_PWD and PG_PASSWORD Security


Anthony Metzidis writes:

> Is there any way to keep postgres from saving the passwords in plain
> text?

No.

> This seems to be a huge security hole.

No, because the directory that contains these files shouldn't be world
readable.  The issue has been noted though, but no one has implemented a
better solution yet.

> I thought that passwords were to be saved in PG_SHADOW. What is
> PG_SHADOW for anyway?

Pg_shadow is the system catalog table that stores the user information,
such as user name and password.  The pg_pwd file is a plain text dump of
pg_shadow, which is necessary because at the time the password is needed
(during the connection attempt), the system can't read the pg_shadow table
yet (because it's not connected yet, sort of).

--
Peter Eisentraut      peter_e@gmx.net       http://yi.org/peter-e/

Re: showing rules/triggers with psql

From
"Richard Huxton"
Date:
From: "Metzidis, Anthony" <Metzidis@mednet.ucla.edu>


> hey,
> kind of a simple question. How can you show the rules/triggers on a
database
> using psql. Even better: how can you show all
rules/triggers/constrains/etc
> that pertain to a given table?
>
> as always...thanks.
>
> --tony

The 7.1 docs have some useful info on system tables, but here's something
from my notes. The RI_Constraint... triggers are automatically generated.

You might want to make this into a view if you use it frequently.


richardh=> select cl.relname,tr.tgname as triggername, tr.tgenabled,
fn.proname as func_name from pg_trigger as tr, pg_class as cl,
pg_proc as fn where tr.tgrelid=cl.oid and tr.tgfoid=fn.oid and cl.relname ~
'^';

  relname  |         triggername         | tgenabled |      func_name
-----------+-----------------------------+-----------+----------------------
 pg_shadow | pg_sync_pg_pwd              | t         | update_pg_pwd
 company   | RI_ConstraintTrigger_121307 | t         | RI_FKey_check_ins
 e_country | RI_ConstraintTrigger_121309 | t         | RI_FKey_noaction_del
 e_country | RI_ConstraintTrigger_121311 | t         | RI_FKey_noaction_upd
 person    | RI_ConstraintTrigger_121389 | t         | RI_FKey_check_ins
 company   | RI_ConstraintTrigger_121391 | t         | RI_FKey_noaction_del
 company   | RI_ConstraintTrigger_121393 | t         | RI_FKey_noaction_upd
 foo       | foo_c_lctrig                | t         | foo_c_lcupdate
(8 rows)

- Richard Huxton