typmod is always -1

From: Chapman Flack <chap(at)anastigmatix(dot)net>
To: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Subject: typmod is always -1
Date: 2016-03-17 04:39:35
Message-ID: 56EA3507.6090701@anastigmatix.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

nothing like resurrecting a really old thread ...

> Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> writes:
>> I have a problem - every call of mvarcharin is with typmod = -1.

2009/3/17 Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>:
> Also, there are a bunch of scenarios where we rely on a cast function to
> apply the typmod rather than passing it to the input function initially.
> I'm not sure if the particular case you're checking here falls into that
> category,

Is it possible to name any case that *does not* fall into that category?

I'm in the same boat ... I have an input function I want to test, and so
far I have failed to think of *any* sql construct that causes it to be
invoked with other than -1 for the typmod.

> but you definitely should have a "length conversion cast"
> function in pg_cast if you expect to do anything useful with typmod.

Ok, that's good to know (and I didn't until now). But back to the
input and recv functions, which are both documented to have 3-arg
forms that get typmods ... how would one test them? Is there any
sql syntax that can be written to make them get passed a typmod?

If I just write them with assert(typmod == -1), will anyone ever
see a failure?

-Chap

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Pavel Stehule 2016-03-17 04:43:53 Re: plpgsql - DECLARE - cannot to use %TYPE or %ROWTYPE for composite types
Previous Message Kouhei Kaigai 2016-03-17 04:13:05 Re: WIP: Upper planner pathification