Le Wed, 7 Jul 2010 22:16:09 +0100,
Thom Brown <thombrown@gmail.com> a écrit :
...
> Given your example, this would return:
>
> table_name | constraint_name | constraint
> ------------+------------------------+------------------------------------------
> tstfld | tstfld_fieldtype_check | CHECK
> (char_length(fieldtype::text) > 2) (1 row)
>
> I just aliased the columns to clarify what each contained. The
> constraint_name is the object name of the constraint that was created
> when you created the table. The constraint is the actual constraint.
>
> However, this might not be what you're after. Could you clarify what
> you're trying to do?
Ok, I tried it but it returned an empty line.
My purpose is to be able to "add" field(s) to existing tables in an
OLAP/ROLAP manner (the article said so), so I've got 5 tables:
1) knows every tables in DB (ie: 'myschema.mytable'),
2) describes the field (the 1st one I talked about):
type ie: VARCHAR(16)
lenght ie: 16
chk ie: a string representing the constraint I want to apply to
the 'type' field,
3) gives a readeable name to the field (ie: 'Choose age') to be used by an
external pgm that'll read it and display in a window,
4) (optional) gives options (ie: '21-30','31-40')
5) contains data of the field and an IR toward the original table's row
number.
This way, I'll be able to easily add any number of fields to any table,
an original table's row that don't have a value in data table (5) means
it is NULL.
(well, re-reading myself I don't know if I used the right words:)
--
I'm not laughing with you, I'm laughing at you.