exec-ddl
CREATE TABLE xyzs (x INT PRIMARY KEY, y INT, z FLOAT NOT NULL, s STRING, UNIQUE (s DESC, z))
----

exec-ddl
CREATE TABLE kuv (k INT PRIMARY KEY, u FLOAT, v STRING)
----

exec-ddl
CREATE TABLE abc (
  a INT PRIMARY KEY,
  b INT,
  c INT
)
----

build
SELECT * FROM xyzs WHERE (SELECT v FROM kuv) = 'foo'
----
project
 ├── columns: x:1(int!null) y:2(int) z:3(float!null) s:4(string)
 ├── key: (1)
 ├── fd: (1)-->(2-4), (3,4)~~>(1,2)
 ├── prune: (1-4)
 ├── interesting orderings: (+1) (-4,+3,+1)
 └── select
      ├── columns: x:1(int!null) y:2(int) z:3(float!null) s:4(string) xyzs.crdb_internal_mvcc_timestamp:5(decimal) xyzs.tableoid:6(oid)
      ├── key: (1)
      ├── fd: (1)-->(2-6), (3,4)~~>(1,2,5,6)
      ├── prune: (1-6)
      ├── interesting orderings: (+1) (-4,+3,+1)
      ├── scan xyzs
      │    ├── columns: x:1(int!null) y:2(int) z:3(float!null) s:4(string) xyzs.crdb_internal_mvcc_timestamp:5(decimal) xyzs.tableoid:6(oid)
      │    ├── key: (1)
      │    ├── fd: (1)-->(2-6), (3,4)~~>(1,2,5,6)
      │    ├── prune: (1-6)
      │    └── interesting orderings: (+1) (-4,+3,+1)
      └── filters
           └── eq [type=bool, subquery]
                ├── subquery [type=string]
                │    └── max1-row
                │         ├── columns: v:9(string)
                │         ├── error: "more than one row returned by a subquery used as an expression"
                │         ├── cardinality: [0 - 1]
                │         ├── key: ()
                │         ├── fd: ()-->(9)
                │         └── project
                │              ├── columns: v:9(string)
                │              ├── prune: (9)
                │              └── scan kuv
                │                   ├── columns: k:7(int!null) u:8(float) v:9(string) kuv.crdb_internal_mvcc_timestamp:10(decimal) kuv.tableoid:11(oid)
                │                   ├── key: (7)
                │                   ├── fd: (7)-->(8-11)
                │                   ├── prune: (7-11)
                │                   └── interesting orderings: (+7)
                └── const: 'foo' [type=string]

# MakeMax1Row retains equivalence dependencies of the FD set.
norm
SELECT a, b, c FROM abc WHERE a = 10 AND b = c
----
select
 ├── columns: a:1(int!null) b:2(int!null) c:3(int!null)
 ├── cardinality: [0 - 1]
 ├── key: ()
 ├── fd: ()-->(1-3), (2)==(3), (3)==(2)
 ├── scan abc
 │    ├── columns: a:1(int!null) b:2(int) c:3(int)
 │    ├── key: (1)
 │    ├── fd: (1)-->(2,3)
 │    ├── prune: (1-3)
 │    └── interesting orderings: (+1)
 └── filters
      ├── eq [type=bool, outer=(1), constraints=(/1: [/10 - /10]; tight), fd=()-->(1)]
      │    ├── variable: a:1 [type=int]
      │    └── const: 10 [type=int]
      └── eq [type=bool, outer=(2,3), constraints=(/2: (/NULL - ]; /3: (/NULL - ]), fd=(2)==(3), (3)==(2)]
           ├── variable: b:2 [type=int]
           └── variable: c:3 [type=int]
