pg.ddx.io pgsql-bugs@postgresql.org mailing list archive
help / color / mirror / Atom feedBUG #18520: Different results when analyze a relation with UDT.
2+ messages / 2 participants
[nested] [flat]
* BUG #18520: Different results when analyze a relation with UDT.
@ 2024-06-24 10:10 PG Bug reporting form <noreply@postgresql.org>
2024-06-24 14:57 ` Re: BUG #18520: Different results when analyze a relation with UDT. Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 2+ messages in thread
From: PG Bug reporting form @ 2024-06-24 10:10 UTC (permalink / raw)
To: pgsql-bugs@lists.postgresql.org; +Cc: 2467882606@qq.com
The following bug has been logged on the website:
Bug reference: 18520
Logged by: zhou zhanghua
Email address: 2467882606@qq.com
PostgreSQL version: 17beta1
Operating system: Ubuntu 22.04
Description:
When analyzing a relation with UDT, an error will be encountered if there is
a join before the analyze stmts. Error message is "ERROR: missing support
function 1(16386,16386) in opfamily 16392".
to reproduce:
```
create type foo_type as (a float8, b float8);
CREATE FUNCTION foo_type_less(foo_type, foo_type) RETURNS bool
AS
$$
SELECT true::boolean;
$$ LANGUAGE SQL IMMUTABLE STRICT;
CREATE OPERATOR < (
leftarg = foo_type, rightarg = foo_type,
procedure = foo_type_less,
commutator = >=
);
CREATE FUNCTION foo_type_eq(foo_type, foo_type) RETURNS bool
AS
$$
SELECT false::boolean;
$$ LANGUAGE SQL IMMUTABLE STRICT;
CREATE OPERATOR = (
leftarg = foo_type, rightarg = foo_type,
procedure = foo_type_eq,
commutator = =
);
CREATE OPERATOR CLASS foo_type_btreeopclass
DEFAULT FOR TYPE foo_type using btree as
OPERATOR 1 <;
CREATE FUNCTION foo_type_hash(foo_type) RETURNS int4
AS
$$
SELECT 1;
$$ LANGUAGE SQL IMMUTABLE STRICT;
CREATE OPERATOR CLASS foo_type_hashopclass
DEFAULT FOR TYPE foo_type using hash as
operator 1 = ,
function 1 foo_type_hash(foo_type);
create table foo_type_table(a foo_type);
insert into foo_type_table values ((1,2)),((3,4)),((5,6));
-- ERROR: missing support function BTORDER_PROC(foo_type,foo_type) in
opfamily foo_type_btreeopclass
select * from foo_type_table a, foo_type_table b where a.a = b.a;
analyze foo_type_table;
-- another session
-- success
analyze foo_type_table;
```
I tried to debug this different behavior, compute_scalar_stats is used when
execute join before analyze, compute_trivial_stats is used when no join
before analyze. This may because of the hash join load some thing into type
cache, leading std_typanalyze choose different functions.
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: BUG #18520: Different results when analyze a relation with UDT.
2024-06-24 10:10 BUG #18520: Different results when analyze a relation with UDT. PG Bug reporting form <noreply@postgresql.org>
@ 2024-06-24 14:57 ` Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 0 replies; 2+ messages in thread
From: Tom Lane @ 2024-06-24 14:57 UTC (permalink / raw)
To: 2467882606@qq.com; +Cc: pgsql-bugs@lists.postgresql.org
PG Bug reporting form <noreply@postgresql.org> writes:
> When analyzing a relation with UDT, an error will be encountered if there is
> a join before the analyze stmts. Error message is "ERROR: missing support
> function 1(16386,16386) in opfamily 16392".
What your example shows is a buggy (very incomplete) operator class.
This is not a Postgres bug.
regards, tom lane
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2024-06-24 14:57 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2024-06-24 10:10 BUG #18520: Different results when analyze a relation with UDT. PG Bug reporting form <noreply@postgresql.org>
2024-06-24 14:57 ` Tom Lane <tgl@sss.pgh.pa.us>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox