From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | jj-kim(at)github(dot)github(dot)io |
Cc: | pgsql-bugs(at)lists(dot)postgresql(dot)org |
Subject: | Re: BUG #15956: Server closed unexpectedly for user-defined base type LIKE char |
Date: | 2019-08-13 21:48:20 |
Message-ID: | 5890.1565732900@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
PG Bug reporting form <noreply(at)postgresql(dot)org> writes:
> The following causes the server to close unexpectedly.
> CREATE TYPE char_type;
> CREATE FUNCTION char_type_in(cstring) RETURNS char_type
> LANGUAGE internal IMMUTABLE STRICT AS 'charin';
> CREATE FUNCTION char_type_out(char_type) RETURNS cstring
> LANGUAGE internal IMMUTABLE STRICT AS 'charout';
> CREATE TYPE char_type (
> INPUT = char_type_in,
> OUTPUT = char_type_out,
> LIKE = char
> );
> CREATE TABLE char_table (t char_type);
> INSERT INTO char_table (t)
> VALUES ('t');
This is pilot error, not a server bug: you created a type that's
not compatible with the I/O functions you provided for it.
Admittedly, it's a bit of a gotcha: "LIKE = char" interprets
char as bpchar, a/k/a the SQL CHAR(n) type. But the internal
charin and charout functions are for the single-byte "char"
type. If we didn't have a couple decades worth of backward
compatibility to think about, we'd likely rename the latter
type, since it's a Postgres-ism not standard.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | PG Bug reporting form | 2019-08-13 22:36:49 | BUG #15957: Connection event listener not called during close() |
Previous Message | PG Bug reporting form | 2019-08-13 21:35:03 | BUG #15956: Server closed unexpectedly for user-defined base type LIKE char |