Thread: Few questions

Few questions

From
Joep deVocht
Date:
Hi,

I have a few questions. I read through the docs but didn't
seem to find the answers.

SQL:

- Is it possible to check whether a table exists?
  (I have a script in which I need to delete tables when they exist.
   And I don't want the error-message when I simply delete it)

- Id there a call to retrieve all table names?

Interface:

- I'm using large objects. What I see is that if I create a large object
  and then delete it again later (which will happen often), the large
object id
  (loid) keeps increasing. This worries me a bit since I don't know
what's going to
   happen when that variable hit MAXINT or something similar.
  Is there a way to reset the loid?

Many thanx in advance.

Joep de Vocht.

Re: Few questions

From
Oliver Elphick
Date:
On Fri, 2002-02-01 at 21:28, Joep deVocht wrote:
>
> Hi,
>
> I have a few questions. I read through the docs but didn't
> seem to find the answers.
>
> SQL:
>
> - Is it possible to check whether a table exists?
>   (I have a script in which I need to delete tables when they exist.
>    And I don't want the error-message when I simply delete it)

  SELECT * FROM pg_tables WHERE tablename = 'your_table_name';

> - Id there a call to retrieve all table names?

  SELECT tablename FROM pg_tables;

(pg_tables is a view of pg_class.)

> Interface:
>
> - I'm using large objects. What I see is that if I create a large object
>   and then delete it again later (which will happen often), the large
> object id
>   (loid) keeps increasing. This worries me a bit since I don't know
> what's going to
>    happen when that variable hit MAXINT or something similar.
>   Is there a way to reset the loid?

I don't know that one.

--
Oliver Elphick                                Oliver.Elphick@lfix.co.uk
Isle of Wight                              http://www.lfix.co.uk/oliver
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839  932A 614D 4C34 3E1D 0C1C

     "And be not conformed to this world; but be ye
      transformed by the renewing of your mind, that ye may
      prove what is that good, and acceptable, and perfect,
      will of God."             Romans 12:2

Attachment

Re: Few questions

From
Darren Ferguson
Date:
SQL: You can make a SELECT tablename FROM pg_tables
                    WHERE tablename = 'YOUR TABLE NAME';

INTERFACE: I don't know that one

Darren

Darren Ferguson
Software Engineer
Openband

On Fri, 1 Feb 2002, Joep deVocht wrote:

>
> Hi,
>
> I have a few questions. I read through the docs but didn't
> seem to find the answers.
>
> SQL:
>
> - Is it possible to check whether a table exists?
>   (I have a script in which I need to delete tables when they exist.
>    And I don't want the error-message when I simply delete it)
>
> - Id there a call to retrieve all table names?
>
> Interface:
>
> - I'm using large objects. What I see is that if I create a large object
>   and then delete it again later (which will happen often), the large
> object id
>   (loid) keeps increasing. This worries me a bit since I don't know
> what's going to
>    happen when that variable hit MAXINT or something similar.
>   Is there a way to reset the loid?
>
> Many thanx in advance.
>
> Joep de Vocht.
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
>     (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
>


Re: Few questions

From
"PG Explorer"
Date:
Is sounds to me that you want to create Temp Tables.

CREATE [ TEMPORARY | TEMP ] TABLE table [ (column [, ...] ) ]
     AS select_clause

TEMPORARY or TEMP
If specified, the table is created only within this session, and is
automatically dropped on session exit. Existing permanent tables with the
same name are not visible (in this session) while the temporary table
exists. Any indexes created on a temporary table are automatically temporary
as well.


http://www.pgexplorer.com
GUI tool for Postgres


----- Original Message -----
From: "Joep deVocht" <joep@masktools.com>
To: <pgsql-general@postgresql.org>
Sent: Friday, February 01, 2002 11:28 PM
Subject: [GENERAL] Few questions


>
> Hi,
>
> I have a few questions. I read through the docs but didn't
> seem to find the answers.
>
> SQL:
>
> - Is it possible to check whether a table exists?
>   (I have a script in which I need to delete tables when they exist.
>    And I don't want the error-message when I simply delete it)
>
> - Id there a call to retrieve all table names?
>
> Interface:
>
> - I'm using large objects. What I see is that if I create a large object
>   and then delete it again later (which will happen often), the large
> object id
>   (loid) keeps increasing. This worries me a bit since I don't know
> what's going to
>    happen when that variable hit MAXINT or something similar.
>   Is there a way to reset the loid?
>
> Many thanx in advance.
>
> Joep de Vocht.
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
>     (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)