Adding an extra boolean column to "information_schema.columns" or "pg_attribute"

From: GPT <gptmailinglists(at)gmail(dot)com>
To: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Adding an extra boolean column to "information_schema.columns" or "pg_attribute"
Date: 2017-12-30 19:17:34
Message-ID: CADep2PN8vide36zQe5X+kTh5BFKkCudKTOM+C_J2KUSDnN5L7Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I would like to add an extra boolean attribute to table columns,
something like NULL. Unfortunately Pg does not support such a feature:

ADD ATTRIBUTE <attribute_name> TYPE <type_of_attribute> TO COLUMN
<schema.table.column_name>;

For example:

ADD ATTRIBUTE is_displayed TYPE boolean TO COLUMN world.human.feature;

so that I can write:

SELECT column_name FROM information_schema.columns
WHERE table_schema = world AND table_name = 'human' AND is_displayed = 'Yes';

Please let me know if there would be any failure of an internal part
or other real technical problem in case I add this extra column by
hand and all relevant stuffs (index, maybe constraint) to either
"information_schema.columns" or "pg_attribute".

I have already been suggested to use VIEW or dynamic SQL but I am
looking something different.

Tia

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Karsten Hilbert 2017-12-30 19:23:10 Re: Adding an extra boolean column to "information_schema.columns" or "pg_attribute"
Previous Message Melvin Davidson 2017-12-30 16:19:24 Re: Does PostgreSQL check database integrity at startup?