f29984950c72a952ff6cf271868e157ea39b61f1
[mdref/mdref-pq-gateway] / Identity.md
1 # class pq\Gateway\Table\Identity implements Countable, ITeratorAggregate
2
3 The primary key of a table.
4
5 ## Query:
6
7 The following query is executed by the current executor of the table to retrieve the primary key columns:
8
9 select
10 a.attname as column
11 from pg_class c
12 join pg_index i on c.oid = i.indrelid
13 join pg_attribute a on c.oid = a.attrelid
14 where
15 c.relname = \$1
16 and a.attnum = any(i.indkey)
17 and i.indisprimary
18 order by
19 a.attnum
20
21 ## Cache:
22
23 The result of this query is cached in the metadata cache under the following key, where $table is converted to a string by pq\Gateway\Table::__toString():
24
25 "$table:identity"
26
27 ## Properties:
28
29 * protected array $columns
30 The columns making up the primary key of the table.
31