在 Postgres 的物化视图中的 WITH 子句中创建的对象的名称是什么?

What Is the Name of an Object Created in a WITH Clause in a Materialized View in Postgres?

我很难通过 PostgreSQL 文档搜索以找到与 table/view 在 MATERIALIZED VIEWWITH 子句中创建相关联的正确术语。

对于下面的matview(AS WITH子句是重点):

CREATE MATERIALIZED VIEW my_big_fat_payments_matview AS WITH
  some_structure_representing_records_paid AS
    (
      SELECT polymorphic_fk_id, polymorphic_fk_type, amount, transaction_time
      FROM my_big_fat_billing_table
      WHERE some_condition = 'A First Condition'
        AND some_other_condition IS NOT NULL
   ),
  some_structure_representing_records_discounted AS
    (
      SELECT polymorphic_fk_id, polymorphic_fk_type, amount, transaction_time
      FROM my_big_fat_billing_table
      WHERE some_condition = 'A Second Condition'
        AND some_other_condition IS NOT NULL
   ),
  some_structure_representing_records_misc AS
    (
      SELECT polymorphic_fk_id, polymorphic_fk_type, amount, transaction_time
      FROM my_big_fat_billing_table
      WHERE some_condition = 'A Threeved Condition'
        AND some_other_condition IS NOT NULL
   )
SELECT
  thetable.column_a  AS column_a,
  thetable.column_x  AS column_x,
  thetable.amount    AS amount,
  secondtable.amount AS second_amount,
  thirdtable.amount  AS third_amount,
  fourthtable.amount AS fourth_amount
FROM my_big_fat_billing_table AS thetable
LEFT JOIN some_structure_representing_records_paid AS secondtable
  ON thetable.polymorphic_fk_id = secondtable.polymorphic_fk_id
LEFT JOIN some_structure_representing_records_discounted AS thirdtable
  ON thetable.polymorphic_fk_id = thirdtable.polymorphic_fk_id
LEFT JOIN some_structure_representing_records_misc AS fourthtable
  ON thetable.polymorphic_fk_id = fourthtable.polymorphic_fk_id
WHERE thetable.type = 'Some Type'

查询中 some_structure_representing_records_paidsome_structure_representing_records_discountedsome_structure_representing_records_misc 对象的名称是什么?他们是观点吗?我一直不经意地将它们称为 matview 的 "sub-views",但我似乎无法深入了解此 matview 的 WITH 子句的文档以确定这种行话是否合适。如果它们不是视图,那它们是什么?他们会是同义词吗?它们是仅用于选择数据和创建 matview 的临时表吗?

注意:我的 matview 比这复杂得多,所以我不是要对 structure/format/use/etc.

提出批评

感谢@AaronLS :

使用 MATERIALIZED VIEWWITH 子句创建的 "temp table" 称为 "Common Table Expression" 或 CTE。

可在此处找到完整文档:https://www.postgresql.org/docs/9.3/static/queries-with.html