pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andrus <kobruleht2@hot.ee>
To: David G. Johnston <david.g.johnston@gmail.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Adrian Klaver <adrian.klaver@aklaver.com>
Cc: pgsql-general <pgsql-general@postgresql.org>
Subject: Re: How to return argument data type from sql function
Date: Sat, 15 Oct 2022 00:56:33 +0300
Message-ID: <b6519a3e-76f3-85d5-c9aa-c79c5d119524@hot.ee> (raw)
In-Reply-To: <CAKFQuwZnDQgnBba2hw=ZQAkifoGa5L61avLf8S8KP+1oTnaQpg@mail.gmail.com>
References: <86fe1ce7-3d6f-b723-b0fc-0eb796100588@hot.ee>
	<1185464.1665759357@sss.pgh.pa.us>
	<12a74d8c-58ac-f14c-39c7-3730362e08e7@hot.ee>
	<CAKFQuwZnDQgnBba2hw=ZQAkifoGa5L61avLf8S8KP+1oTnaQpg@mail.gmail.com>

 > Adrian Klaver recommends in
>
>     https://stackoverflow.com/questions/74061290/how-to-return-argument-datatype-from-sql-function#comme...
>
>     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.

view thread (9+ messages)  latest in thread

Message-ID: <b6519a3e-76f3-85d5-c9aa-c79c5d119524@hot.ee>
Permalink:  ../b6519a3e-76f3-85d5-c9aa-c79c5d119524@hot.ee/
Also on:    postgresql.org/message-id/b6519a3e-76f3-85d5-c9aa-c79c5d119524@hot.ee

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: kobruleht2@hot.ee, david.g.johnston@gmail.com, tgl@sss.pgh.pa.us, adrian.klaver@aklaver.com
  Subject: Re: How to return argument data type from sql function
  In-Reply-To: <b6519a3e-76f3-85d5-c9aa-c79c5d119524@hot.ee>
  References: <86fe1ce7-3d6f-b723-b0fc-0eb796100588@hot.ee> <1185464.1665759357@sss.pgh.pa.us> <12a74d8c-58ac-f14c-39c7-3730362e08e7@hot.ee> <CAKFQuwZnDQgnBba2hw=ZQAkifoGa5L61avLf8S8KP+1oTnaQpg@mail.gmail.com> <b6519a3e-76f3-85d5-c9aa-c79c5d119524@hot.ee>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox