On Thu, 12 Jun 2008, krishtpt wrote:
1. I am trying to disable constraints from a particular table in postgresql.
But I couldn't get the alter command for the same.
The documentation is generally pretty good, if you know what you're
looking for. At what point in reading
http://www.postgresql.org/docs/8.3/interactive/sql-altertable.html
do you get confused?
2. I am trying to fetch all the constraints from a specific table using a
select query. I am using 'select * from pg_constraint'. If I execute this
query I am able to get all the constraints from all the tables. But I
couldn't find which constraint is for what table. How can I get this data.
3. I am also trying to fetch all the triggers for a specific table using a
select query. How can I get this data?
In psql, you can issue a command like:
\d <tablename>
...which will give you all the columns, their types, any indices, foreign
keys, triggers, etc. for <tablename>. This sounds like what you're looking
for?
4. I also would like to know how can I execute an sql file from windows
command prompt in postgresql.
Again, psql is probably your friend. I'm not familiar with windows, but I
believe it allows redirection in the command prompt. In unix, you would:
psql <connection args> < file.sql
... and everything in file.sql would be executed as if you had typed it in
yourself.