Skip site navigation (1) Skip section navigation (2)

Re: Using types in an inappropriate way causes crash of backend

From: Thomas Lockhart <lockhart(at)alumni(dot)caltech(dot)edu>
To: boris(at)i3(dot)informatik(dot)rwth-aachen(dot)de, pgsql-bugs(at)postgresql(dot)org
Subject: Re: Using types in an inappropriate way causes crash of backend
Date: 2001-03-15 23:40:33
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-bugs
>   ERROR:  Attribute 'a' is of type 'f' but expression is of type 'int4'
>         You will need to rewrite or cast the expression
> Then I tried the next insert statement and the backend crashed.
> Sample Code
> create type f (input = int4in, output=int4out, internallength=4);
> create table z (a f);
> insert into z values(1);
> insert into z values('1');

The first case threw an error because you did not declare any conversion
functions between int4 and your type "f". You will need to provide a
noop, which can be as simple as (ymmv; I'm doing this from scratch):

create function f(int4) returns f as ...

where the conversion function must be, afaik, compiled code (our SQL
embedded language is too smart to let you pass it through unchanged).

Otherwise, you need to use the second, quoted, style for data entry.

                    - Thomas

In response to

pgsql-bugs by date

Next:From: pgsql-bugsDate: 2001-03-16 04:57:22
Subject: Doucumentation bug in libpq > Asynchronous Query Processing
Previous:From: pgsql-bugsDate: 2001-03-15 20:40:30
Subject: Problem with JDBC Driver / Statement.executeQuery()

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group