Skip to content

[pg] Join by columns with different types #2962

@rekby

Description

@rekby

Run with ydb-local https://github.com/ydb-platform/ydb/wiki/Local-run-postgres-tests

echo "
  DROP TABLE IF EXISTS t1;
  DROP TABLE IF EXISTS t2;
  CREATE TABLE t1 (id1 int4, PRIMARY KEY(id1));
  CREATE TABLE t2 (id2 int8, PRIMARY KEY(id2));
  SELECT * FROM t1 JOIN t2 ON (id1=id2);
  " | psql postgres://root:1234@localhost:5432/local

Result:

DROP TABLE
DROP TABLE
CREATE TABLE
CREATE TABLE
Status: GENERIC_ERROR
Issues:
<main>: Error: Type annotation, code: 1030
    <main>:1:1: Error: At function: AssumeColumnOrder, At function: PgReplaceUnknown, At function: OrderedMap, At function: OrderedMap, At function: EquiJoin
        <main>:1:1: Error: Cannot compare key columns (a._alias_t1.id1 has type: pgint4, b._alias_t2.id2 has type: pgint8)

Expected result:

DROP TABLE
DROP TABLE
CREATE TABLE
CREATE TABLE
 id1 | id2
-----+-----
(0 rows)

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions