From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Peter Eisentraut <peter_e(at)gmx(dot)net> |
Cc: | PostgreSQL Development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Something's not (de)compressing right... |
Date: | 2000-07-08 04:30:12 |
Message-ID: | 23668.963030612@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Peter Eisentraut <peter_e(at)gmx(dot)net> writes:
> When using psql's \dd command, the backend crashes with a segfault.
The new query \dd is issuing is tickling a longstanding UNION bug.
For now I'd suggest that you work around the problem by explicitly
coercing the result of format_type() to NAME:
...
UNION ALL
SELECT DISTINCT format_type(t.oid, NULL)::name as "Name", 'type'::text as "Object", d.description as "Description"
...
The crash occurs because text_lt is used to sort a column of NAME values
--- the result of format_type is coerced to NAME so that it can be
union'd with the NAME results of the other sub-selects, but by the time
that happens we've already chosen the sort operator for the DISTINCT,
and what we chose was text_lt :-(. If you do the coercion explicitly
then name_lt gets chosen for DISTINCT and everything works.
Actually, given that the result of format_type might well exceed 32
characters, you might think it better to coerce the results of all the
sub-selects to "text". But the point is you can't rely on UNION's auto-
coercion to do the right thing when a sub-select requires its own sort.
I have a list of about two dozen UNION/INTERSECT/EXCEPT bugs (including
this one) that I don't think can be fixed without a querytree redesign.
So hold your nose and coerce explicitly until 7.2 ...
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Philip Warner | 2000-07-08 04:44:39 | 'errno' undefined? |
Previous Message | Chris Bitmead | 2000-07-08 03:02:39 | Re: libpq / SQL3 |