Re: Using types in an inappropriate way causes crash of backend
В списке pgsql-bugs по дате отправления:
| От | Thomas Lockhart |
|---|---|
| Тема | Re: Using types in an inappropriate way causes crash of backend |
| Дата | |
| Msg-id | 3AB152F1.546278E1@alumni.caltech.edu обсуждение |
| Ответ на | Using types in an inappropriate way causes crash of backend (pgsql-bugs@postgresql.org) |
| Список | 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
В списке pgsql-bugs по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера