From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | PegoraroF10 <marcos(at)f10(dot)com(dot)br> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Converting to identity columns with domains on PK columns |
Date: | 2019-07-05 20:16:20 |
Message-ID: | 25356.1562357780@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
PegoraroF10 <marcos(at)f10(dot)com(dot)br> writes:
> Adrian, on Firebird if you create a table or procedure with fields or params
> declared with domains, they can be used with those domains or with their
> base type. On Postgres I32 is not equal to integer.
> create procedure myproc(id i32) returns(x i32) as ...
> select * from myproc(cast(5 as integer)) -- works on firebird. On Postgres
> it doesn´t because that procedure or function expects for a I32 and not a
> integer.
Really?
regression=# create domain i32 as int;
CREATE DOMAIN
regression=# create function myproc(id i32) returns i32
language sql as 'select $1';
CREATE FUNCTION
regression=# select myproc(cast(5 as integer));
myproc
--------
5
(1 row)
I think the primary reason we don't allow domains over int for identity
columns is that it's not clear how domain constraints ought to interact
with the identity-value-generating behavior.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Adrian Klaver | 2019-07-05 20:22:34 | Re: Converting to identity columns with domains on PK columns |
Previous Message | PegoraroF10 | 2019-07-05 20:01:00 | Re: Converting to identity columns with domains on PK columns |