Re: How to return argument data type from sql function

From: Andrus <kobruleht2(at)hot(dot)ee>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>, pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: How to return argument data type from sql function
Date: 2022-10-14 21:56:33
Message-ID: b6519a3e-76f3-85d5-c9aa-c79c5d119524@hot.ee
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> Adrian Klaver recommends in
>
> https://stackoverflow.com/questions/74061290/how-to-return-argument-datatype-from-sql-function#comment130780708_74061290
>
> at this worked. In this best solution?
>
> Padding a text typed output with actual significant spaces "works"? It
> is not equivalent to a bpchar with insignificant padding spaces...

You are right. I need char(n) type and this is not working.  How to use
expression in cast, like

select torus(charcol) :: CHAR( ColWidth('public', 'test', 'charcol')  )
from test

This throws error in Postgres. ColWidth is immutable and called with
constant arguments so it should work. How to fix postgres to allow
constant ColWidth() expression in cast ?

Andrus.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message David G. Johnston 2022-10-14 22:14:05 Re: How to return argument data type from sql function
Previous Message Andrus 2022-10-14 21:48:35 Re: How to return argument data type from sql function