Re: Converting to identity columns with domains on PK columns

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: PegoraroF10 <marcos(at)f10(dot)com(dot)br>, pgsql-general(at)postgresql(dot)org
Subject: Re: Converting to identity columns with domains on PK columns
Date: 2019-07-05 20:55:48
Message-ID: 70ed1dae-5697-e7cf-5158-cbf231339c40@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 7/5/19 1:49 PM, PegoraroF10 wrote:
> Sorry, the example I was thinking was this one, which works on Firebird,
> using its way of writing, obviously.
>
> create function myproc(id integer) returns I32 language sql as 'select $1';
>
> On postgres ERROR: return type mismatch in function declared to return i32
>
> What I mean is that Firebird sees I32 and integer as the same, Postgres
> doesn´t.

Yeah, but if you reverse the casting you did in your first example it works:

create function myproc(id integer) returns I32 language sql as 'select
$1::i32';
CREATE FUNCTION

test_(aklaver)> select myproc(5);
myproc
--------
5
(1 row)

test_(aklaver)> select pg_typeof(myproc(5));
pg_typeof
-----------
i32
(1 row)

>
>
>
> --
> Sent from: http://www.postgresql-archive.org/PostgreSQL-general-f1843780.html
>
>

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2019-07-05 21:10:52 Re: Converting to identity columns with domains on PK columns
Previous Message PegoraroF10 2019-07-05 20:55:35 Re: Converting to identity columns with domains on PK columns