views.ts15 lines · main
1import { safeSql } from '../pg-format'
2
3export const VIEWS_SQL = /* SQL */ safeSql`
4SELECT
5 c.oid :: int8 AS id,
6 n.nspname AS schema,
7 c.relname AS name,
8 (pg_relation_is_updatable(c.oid, false) & 20) = 20 AS is_updatable,
9 obj_description(c.oid) AS comment
10FROM
11 pg_class c
12 JOIN pg_namespace n ON n.oid = c.relnamespace
13WHERE
14 c.relkind = 'v'
15`