Re: DESC - Mailing list pgsql-novice

From Rynell Wesson
Subject Re: DESC
Date
Msg-id Pine.LNX.4.21.0011221611480.20947-100000@isle-of-jura.cs.utexas.edu
Whole thread Raw
In response to Re: DESC  (Mike Castle <dalgoda@ix.netcom.com>)
List pgsql-novice
See comments below.

On Wed, 22 Nov 2000, Mike Castle wrote:

> On Wed, Nov 22, 2000 at 06:38:15PM +0100, Albert REINER wrote:
> > And if you start psql with option -E you will see the actual
> > SQL-queries used by \d.
>
> That's nifty.  I've read through all of the pgsql documentation before
> starting everything, but I think I'm suffering a bit from information
> overload.  I knew this information was somewhere, I just couldn't remember
> where.
>
> So, thanks to all who pointed me to \d.
>
> Ok then.  It looks to me like both "DESC" and "DESCRIBE" are SQL keywords.
> DESC apparently is meant for descending, so I'm guessing that Oracle's
> sqlplus usage of DESC is an extension.  Is that correct?

DESC and ASC are SQL keywords used with the ORDER BY keywords for
listing values in descending and ascending order,
respectively.  DESC(RIBE) within an Oracle sqlplus session does not
conflict with the SQL DESC keyword.  DESC when used within an sqlplus
session will display a specified table's definition.  One version of
DESC is used within SQL DML statements, like SELECT <statement>, and the
other is used as a utility within an sqlplus session, just like any
utility found within a Unix shell (e.g. ls, find, echo, etc.).

>
> If so, is "DESCRIBE" the ANSI command that should do what \d does or does
> it serve another purpose in ANSI?  (A pointer as to where to find this
> explicitly would be nice; will eventually purchase the standard myself).
>

This version of DESCRIBE is for use within embedded SQL programs (C/C++).
More specifically, it is used with dynamic SQL select statements within
embedded SQL programs and it must be used after the dynamic SQL statement
has been compiled using the PREPARE statement.

> If DESCRIBE is supposed to do that, is there any reason that pgsql doesn't
> do that outside of "\d works, so no one has bothered to implement it."
>

I haven't written any embedded SQL programs using the traditional EXEC SQL
formats (I usually use libpq/libpq++ or JDBC) within PostgreSQL, but
PostgreSQL should be able to handle the DESCRIBE statement within embedded
SQL programs if it adhered to the embedded SQL specfications for C
utilizing EXEC SQL syntax.

I hope that I interpreted your questions correctly and I haven't stated
too much or too little in answering them and that all of this will give
you a better understanding.

Thanks.

Rynell Wesson



pgsql-novice by date:

Previous
From: Kiss Zoltán
Date:
Subject: nowait
Next
From: GH
Date:
Subject: PHP and persistent connections