Re: create type- similar char

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Mohsen SM <mohsensoodkhah(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: create type- similar char
Date: 2014-03-16 14:02:06
Message-ID: CAFj8pRC=AfJouOzV8gVO4rzkVZQYtPKjwZjWWxc_2PkRSUDL9A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello

I don't know where is a problem, but I can put a two advices

a) start by extending some known extension

b) look to source code, where and why a exception was raised. Verbose mode
can help

[pavel(at)localhost ~]$ psql postgres
psql (9.4devel)
Type "help" for help.

postgres=# \set VERBOSITY verbose
postgres=# SELECT 10/0;
ERROR: 22012: division by zero
LOCATION: int4div, int.c:719
postgres=#

Regards

Pavel

2014-03-16 14:41 GMT+01:00 Mohsen SM <mohsensoodkhah(at)gmail(dot)com>:

> I create one new type with CREATE TYPE command.
> for my type its INTERNALLENGTH is VARIABLE .
> but I want to my type behavior similar to char and when I type this query:
> CREATE TABLE tbl (col1 NEWTYPE);
> then when I write this query, so it get an error for it's length:
> insert into tbl values('dd');
> its error is :
> ERROR: value too long for type character(1)
> but my NEWTYPE don't get this error and work similar to varchar.
> how I can do it?
> I check for char type the bpchar() function. when I work with char type
> and want to insert one word longest one character so, bpchar() called.
> but for my NEWTYPE don't call the newtype() function.
> how can I correct this problem?
>
>

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Yuri Levinsky 2014-03-16 14:06:19 Re: requested shared memory size overflows size_t
Previous Message Mohsen SM 2014-03-16 13:41:54 create type- similar char