Skip site navigation (1) Skip section navigation (2)

Peripheral Links

Header And Logo

PostgreSQL
| The world's most advanced open source database.

Site Navigation

Search for
  Advanced Search

Re: Testen, ob Spalte vorhanden ist



Martin Spott schrob:

> => select count(pg_class.relname) from pg_class, pg_attribute
>    where pg_attribute.attname = 'nam'
>    and pg_class.oid = pg_attribute.attrelid
>    and pg_class.relname = '<Zieltabelle>';
>
>
> Dann weiss ich sicher, ob ich die Spalte "nam" mitkopieren darf oder
> nicht - geht das eigentlich auch einfacher ?  :-)

Ja, mit der Sicht information_schema.columns:

<http://www.postgresql.org/docs/8.1/static/information-schema.html>

> Es geht mir nicht um die Laufzeit des Konstruktes, das wird nur alle
> paar Jahrhunderte aufgerufen. Vielmehr frage ich mich, ob es sowas
> schon vorgefertigt gibt - vielleicht in einer Form, die nicht
> ausschliesslich auf unserer bevorzuten DB laeuft.

Das information_schema ist AFAIR seit 1999 im SQL-Standard.

Gruß
Andreas



Home | Main Index | Thread Index

Privacy Policy | PostgreSQL Archives hosted by Command Prompt, Inc. | Designed by tinysofa
Copyright © 1996 – 2008 PostgreSQL Global Development Group