gotqn
gotqn

Reputation: 43666

Where is the default constraint name preserved?

In the context of SQL Server the default constraints are objects that can be queried via system views. I am migrating a table from T-SQL to Postgres and end up with the following definition:

CREATE TABLE public.EntitiesSQLObjectNamesMapping
(
    RecordGuid UUID  NOT NULL,
    IsInterfaceView BIT NOT NULL CONSTRAINT DF_EntitiesSQLObjectNamesMapping_IsInterfaceView DEFAULT (0::bit)
);

As you can see I am allowed to set a name to the default constraint, but I can't find the system view which is holding this name:

SELECT *
FROM pg_catalog.pg_constraint;

select *
from information_schema.columns col
where col.column_default is not null
      and col.table_schema not in('information_schema', 'pg_catalog')
order by col.column_name;

Also, in the docs I even can see no information about this and the syntax itself.

Can anyone point me where this info is available?

Upvotes: 0

Views: 89

Answers (0)

Related Questions