Re: how to extract and use a string like a constraint?

From: "Jean-Yves F(dot) Barbier" <12ukwn(at)gmail(dot)com>
To: Thom Brown <thombrown(at)gmail(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: how to extract and use a string like a constraint?
Date: 2010-07-07 21:43:26
Message-ID: 20100707234326.1f815fea@anubis.defcon1
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Le Wed, 7 Jul 2010 22:16:09 +0100,
Thom Brown <thombrown(at)gmail(dot)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.

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Atif Jung 2010-07-08 09:51:28 Returning more than one value from a stored procedure
Previous Message Thom Brown 2010-07-07 21:16:09 Re: how to extract and use a string like a constraint?