pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Porting MySQL's DESCRIBE and ENUM features
3+ messages / 3 participants
[nested] [flat]

* Porting MySQL's DESCRIBE and ENUM features
@ 1999-11-13 16:33  Mark Stosberg <mark@summersault.com>
  0 siblings, 1 reply; 3+ messages in thread

From: Mark Stosberg @ 1999-11-13 16:33 UTC (permalink / raw)
  To: pgsql-sql


Hello,

  I'm helping to port some somewhere from MySQL to Postgres, and am
looking for an equivalent to MySQL's DESCRIBE function. Do you know of
one for Postgres?
  Specifically, one way DESCRIBE is used in this software is to get the
values from ENUM, where a MySQL column declaration might look like this:

ReceiveMail        ENUM ('Yes', 'No') NOT NULL DEFAULT 'Yes',

  I can get the same functionality in Postgres like this, but what can
use to get the values back of what's being checked? Thanks!

ReceiveMail        CHAR(3) check(ReceiveMail in ('Yes', 'No')) NOT NULL
DEFAULT 'Yes',

     -mark
  <<-------------------------------------------------------------->>
personal website                <    Summersault Website Design
   http://mark.stosberg.com/     >       http://www.summersault.com/



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: [SQL] Porting MySQL's DESCRIBE and ENUM features
@ 1999-11-13 17:04  Peter Eisentraut <e99re41@DoCS.UU.SE>
  parent: Mark Stosberg <mark@summersault.com>
  0 siblings, 1 reply; 3+ messages in thread

From: Peter Eisentraut @ 1999-11-13 17:04 UTC (permalink / raw)
  To: Mark Stosberg <mark@summersault.com>; +Cc: pgsql-sql

I would myself be interested to see how the check constraints are stored,
so I can put this into the psql \d command.

mySQL's DESCRIBE is the same as the \d command in psql (Note: psql !=
Pgsql). There is no backend-level command doing this, but you are free to
query the system catalogues similar to how psql does it.

So it seems like there is no need to do a whole lot of work here. As soon
as I get the word on the contraints, I'll implement them.

	-Peter

On Sat, 13 Nov 1999, Mark Stosberg wrote:

> 
> Hello,
> 
>   I'm helping to port some somewhere from MySQL to Postgres, and am
> looking for an equivalent to MySQL's DESCRIBE function. Do you know of
> one for Postgres?
>   Specifically, one way DESCRIBE is used in this software is to get the
> values from ENUM, where a MySQL column declaration might look like this:
> 
> ReceiveMail        ENUM ('Yes', 'No') NOT NULL DEFAULT 'Yes',
> 
>   I can get the same functionality in Postgres like this, but what can
> use to get the values back of what's being checked? Thanks!
> 
> ReceiveMail        CHAR(3) check(ReceiveMail in ('Yes', 'No')) NOT NULL
> DEFAULT 'Yes',
> 
>      -mark
>   <<-------------------------------------------------------------->>
> personal website                <    Summersault Website Design
>    http://mark.stosberg.com/     >       http://www.summersault.com/
> 
> ************
> 
> 

-- 
Peter Eisentraut                  Sernanders vaeg 10:115
peter_e@gmx.net                   75262 Uppsala
http://yi.org/peter-e/            Sweden




^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: [SQL] Porting MySQL's DESCRIBE and ENUM features
@ 1999-11-13 19:41  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Peter Eisentraut <e99re41@DoCS.UU.SE>
  0 siblings, 0 replies; 3+ messages in thread

From: Tom Lane @ 1999-11-13 19:41 UTC (permalink / raw)
  To: Peter Eisentraut <peter_e@gmx.net>; +Cc: Mark Stosberg <mark@summersault.com>; pgsql-sql

Peter Eisentraut <e99re41@DoCS.UU.SE> writes:
> I would myself be interested to see how the check constraints are stored,
> so I can put this into the psql \d command.

You want the rcsrc column of pg_relcheck.  See getTables() in pg_dump.c
for an example of retrieving constraint conditions.

IIRC, specialized constraints such as NOT NULL are recorded someplace
else, but you probably know about those already.

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~1999-11-13 19:41 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
1999-11-13 16:33 Porting MySQL's DESCRIBE and ENUM features Mark Stosberg <mark@summersault.com>
1999-11-13 17:04 ` Peter Eisentraut <e99re41@DoCS.UU.SE>
1999-11-13 19:41   ` Tom Lane <tgl@sss.pgh.pa.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox