Help with table definitions 
Author Message
 Help with table definitions


I need help creating a new table, using an old table as a template.
The problem is that i would like to alter the table, adding a field
with a constraint, using SQL. This is not supported by ALTER TABLE.

On the net, I found this:
SELECT  a.attname, format_type(a.atttypid, a.atttypmod)  FROM  
pg_class c, pg_attribute a   WHERE   c.relname = 'bilde' AND  
a.attnum > 0 AND     a.attrelid = c.oid;

that returns:
  attname  |  format_type  
 bid       | smallint
 tittel    | character(100)
 motiv     | character(250)
 storrelse | character(20)
 teknikk   | character(20)
 farve     | character(5)
 fotoaar   | character(20)

this does not give me information about constraints (for example Check

If I had this information, I could recreate the column desctiptions,
and recreate the table with an insert select, adding the new column Im
interested in.

Is there a possibility to use a SELECT INTO in this manner? I dont
think so..

Thanks for any help


Sat, 24 Jul 2004 22:34:14 GMT
 [ 1 post ] 

 Relevant Pages 

1. Help with Table Definitions

2. Definition of Intersection table (cross reference table, linked table)

3. HELP! Changing Table definition

4. Help - How do I print paradox table definitions???

5. Help changing table (column size) definition

6. Help - How do I print paradox table definitions???

7. Help: How to print table definitions

8. Copy Table Definition To New Table

9. Finding all tables and table definitions

10. Table definitions output to a table, like Access Documentor wizard

11. Copying table definition to create new table

12. Finding all tables and table definitions.

Powered by phpBB® Forum Software