RE: Some questions about PLpgSql - Mailing list pgsql-sql

From Sondaar Roelof
Subject RE: Some questions about PLpgSql
Date
Msg-id F28A2B83DFE0D411A7B3006097487147468FDC@sv7007.scania.se
Whole thread Raw
In response to Some questions about PLpgSql  ("datactrl" <quals@bigfoot.com>)
List pgsql-sql
Hello jack,

To check if a table exists you could use:
select tablename from pg_tables;
For instance:
dhcp=# select count(*) from pg_tables where tablename='dhcp_subnet';count
-------    1
(1 row)
dhcp=# select count(*) from pg_tables where tablename='dhcp_subnetaa';count
-------    0
(1 row)

To see the system tables use \dS


The second I don't really know what you would like to see.
Perhaps a trigger could do this after the insert/update/delete ?

Best regards,
Roelof

> -----Original Message-----
> From:    datactrl [SMTP:quals@bigfoot.com]
> Sent:    15 March 2001 12:04
> To:    pgsql-sql@postgresql.org
> Subject:    [SQL] Some questions about PLpgSql
> 
> Hi, all
> 
> By using 'PLpgsql', is that possible to
> 
> 1) check if a specific table exists?
> 2) check if an INSERT/UPDATE/ DELETE has done successfully?
> 
> 
> Is there some more documents or samples for PLpgsql except  USER GUIDE and
> PostgreSQL Introduction & concept?
> 
> THANK YOU
> 
> JACK
> 
> 
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
> 
> http://www.postgresql.org/users-lounge/docs/faq.html


pgsql-sql by date:

Previous
From: Sondaar Roelof
Date:
Subject: How to cast text to cidr/inet
Next
From: Tom Lane
Date:
Subject: Re: Help with UPDATE syntax