typmod is always -1
От
Pavel Stehule
Тема
typmod is always -1
Дата
Msg-id
162867790903161317q178e11e6ie276d1254c279dd1@mail.gmail.com
Список
Дерево обсуждения
typmod is always -1 Pavel Stehule <pavel.stehule@gmail.com>
Re: typmod is always -1 Tom Lane <tgl@sss.pgh.pa.us>
Re: typmod is always -1 Pavel Stehule <pavel.stehule@gmail.com>
typmod is always -1 Chapman Flack <chap@anastigmatix.net>
Re: typmod is always -1 Tom Lane <tgl@sss.pgh.pa.us>
Re: typmod is always -1 Chapman Flack <chap@anastigmatix.net>
Re: typmod is always -1 Tom Lane <tgl@sss.pgh.pa.us>
Re: typmod is always -1 Jim Nasby <Jim.Nasby@BlueTreble.com>
Hello
I am playing with custom typmod. I did simple wrapper over varchar type.
PG_FUNCTION_INFO_V1(mvarcharin);
Datum
mvarcharin(PG_FUNCTION_ARGS)
{
elog(NOTICE, ">>>>>>>>%d", PG_GETARG_INT32(2)); return DirectFunctionCall3(varchar, DirectFunctionCall3(varcharin,
PG_GETARG_DATUM(0),
PG_GETARG_DATUM(1),
Int32GetDatum(-1)), PG_GETARG_DATUM(2),/* original typmod */ BoolGetDatum(true));/* explit casting, quite truncate */
}
CREATE TYPE mvarchar ( INPUT = mvarcharin, OUTPUT = mvarcharout, LIKE = pg_catalog.varchar, typmod_in = pg_catalog.varchartypmodin, typmod_out = pg_catalog.varchartypmodout
);
I have a problem - every call of mvarcharin is with typmod = -1.
postgres=# create table x(a mvarchar(3));
CREATE TABLE
Time: 29,930 ms
postgres=# \d x Table "public.x"
┌────────┬─────────────┬───────────┐
│ Column │ Type │ Modifiers │
├────────┴─────────────┴───────────┤
│ a │ mvarchar(3) │ │
└──────────────────────────────────┘
postgres=# INSERT INTO x values('abcdef');
NOTICE: >>>>>>>>-1
INSERT 0 1
Time: 2,244 ms
postgres=#
can somebody navigate me?
regards
Pavel Stehule
В списке pgsql-hackers по дате отправления
От: Jonah H. Harris
Дата: