pg_prepared_statements

列出所有可用预处理语句的系统视图

pg_prepared_statements 是一个列出当前会话中所有可用预处理语句的系统目录视图。

pg_prepared_statementsPostgreSQL 8.2中添加。

按PostgreSQL版本定义

pg_prepared_statements (PostgreSQL 17)

                  View "pg_catalog.pg_prepared_statements"
     Column      |           Type           | Collation | Nullable | Default 
-----------------+--------------------------+-----------+----------+---------
 name            | text                     |           |          | 
 statement       | text                     |           |          | 
 prepare_time    | timestamp with time zone |           |          | 
 parameter_types | regtype[]                |           |          | 
 result_types    | regtype[]                |           |          | 
 from_sql        | boolean                  |           |          | 
 generic_plans   | bigint                   |           |          | 
 custom_plans    | bigint                   |           |          |
    

文档: pg_prepared_statements

pg_prepared_statements (PostgreSQL 16)

                  View "pg_catalog.pg_prepared_statements"
     Column      |           Type           | Collation | Nullable | Default 
-----------------+--------------------------+-----------+----------+---------
 name            | text                     |           |          | 
 statement       | text                     |           |          | 
 prepare_time    | timestamp with time zone |           |          | 
 parameter_types | regtype[]                |           |          | 
 result_types    | regtype[]                |           |          | 
 from_sql        | boolean                  |           |          | 
 generic_plans   | bigint                   |           |          | 
 custom_plans    | bigint                   |           |          |
    

文档: pg_prepared_statements

pg_prepared_statements (PostgreSQL 15)

                  View "pg_catalog.pg_prepared_statements"
     Column      |           Type           | Collation | Nullable | Default 
-----------------+--------------------------+-----------+----------+---------
 name            | text                     |           |          | 
 statement       | text                     |           |          | 
 prepare_time    | timestamp with time zone |           |          | 
 parameter_types | regtype[]                |           |          | 
 from_sql        | boolean                  |           |          | 
 generic_plans   | bigint                   |           |          | 
 custom_plans    | bigint                   |           |          |
    

文档: pg_prepared_statements

pg_prepared_statements (PostgreSQL 14)

                  View "pg_catalog.pg_prepared_statements"
     Column      |           Type           | Collation | Nullable | Default 
-----------------+--------------------------+-----------+----------+---------
 name            | text                     |           |          | 
 statement       | text                     |           |          | 
 prepare_time    | timestamp with time zone |           |          | 
 parameter_types | regtype[]                |           |          | 
 from_sql        | boolean                  |           |          | 
 generic_plans   | bigint                   |           |          | 
 custom_plans    | bigint                   |           |          |
    

文档: pg_prepared_statements

pg_prepared_statements (PostgreSQL 13)

                  View "pg_catalog.pg_prepared_statements"
     Column      |           Type           | Collation | Nullable | Default 
-----------------+--------------------------+-----------+----------+---------
 name            | text                     |           |          | 
 statement       | text                     |           |          | 
 prepare_time    | timestamp with time zone |           |          | 
 parameter_types | regtype[]                |           |          | 
 from_sql        | boolean                  |           |          |
    

文档: pg_prepared_statements

pg_prepared_statements (PostgreSQL 12)

                  View "pg_catalog.pg_prepared_statements"
     Column      |           Type           | Collation | Nullable | Default 
-----------------+--------------------------+-----------+----------+---------
 name            | text                     |           |          | 
 statement       | text                     |           |          | 
 prepare_time    | timestamp with time zone |           |          | 
 parameter_types | regtype[]                |           |          | 
 from_sql        | boolean                  |           |          |
    

文档: pg_prepared_statements

pg_prepared_statements (PostgreSQL 11)

                  View "pg_catalog.pg_prepared_statements"
     Column      |           Type           | Collation | Nullable | Default 
-----------------+--------------------------+-----------+----------+---------
 name            | text                     |           |          | 
 statement       | text                     |           |          | 
 prepare_time    | timestamp with time zone |           |          | 
 parameter_types | regtype[]                |           |          | 
 from_sql        | boolean                  |           |          |
    

文档: pg_prepared_statements

pg_prepared_statements (PostgreSQL 10)

                  View "pg_catalog.pg_prepared_statements"
     Column      |           Type           | Collation | Nullable | Default 
-----------------+--------------------------+-----------+----------+---------
 name            | text                     |           |          | 
 statement       | text                     |           |          | 
 prepare_time    | timestamp with time zone |           |          | 
 parameter_types | regtype[]                |           |          | 
 from_sql        | boolean                  |           |          |
    

文档: pg_prepared_statements

pg_prepared_statements (PostgreSQL 9.6)

        View "pg_catalog.pg_prepared_statements"
     Column      |           Type           | Modifiers 
-----------------+--------------------------+-----------
 name            | text                     | 
 statement       | text                     | 
 prepare_time    | timestamp with time zone | 
 parameter_types | regtype[]                | 
 from_sql        | boolean                  |
    

文档: pg_prepared_statements

pg_prepared_statements (PostgreSQL 9.5)

        View "pg_catalog.pg_prepared_statements"
     Column      |           Type           | Modifiers 
-----------------+--------------------------+-----------
 name            | text                     | 
 statement       | text                     | 
 prepare_time    | timestamp with time zone | 
 parameter_types | regtype[]                | 
 from_sql        | boolean                  |
    

文档: pg_prepared_statements

pg_prepared_statements (PostgreSQL 9.4)

        View "pg_catalog.pg_prepared_statements"
     Column      |           Type           | Modifiers 
-----------------+--------------------------+-----------
 name            | text                     | 
 statement       | text                     | 
 prepare_time    | timestamp with time zone | 
 parameter_types | regtype[]                | 
 from_sql        | boolean                  |
    

文档: pg_prepared_statements

pg_prepared_statements (PostgreSQL 9.3)

        View "pg_catalog.pg_prepared_statements"
     Column      |           Type           | Modifiers 
-----------------+--------------------------+-----------
 name            | text                     | 
 statement       | text                     | 
 prepare_time    | timestamp with time zone | 
 parameter_types | regtype[]                | 
 from_sql        | boolean                  |
    

文档: pg_prepared_statements

pg_prepared_statements (PostgreSQL 9.2)

        View "pg_catalog.pg_prepared_statements"
     Column      |           Type           | Modifiers 
-----------------+--------------------------+-----------
 name            | text                     | 
 statement       | text                     | 
 prepare_time    | timestamp with time zone | 
 parameter_types | regtype[]                | 
 from_sql        | boolean                  |
    

文档: pg_prepared_statements

pg_prepared_statements (PostgreSQL 9.1)

        View "pg_catalog.pg_prepared_statements"
     Column      |           Type           | Modifiers 
-----------------+--------------------------+-----------
 name            | text                     | 
 statement       | text                     | 
 prepare_time    | timestamp with time zone | 
 parameter_types | regtype[]                | 
 from_sql        | boolean                  |
    

文档: pg_prepared_statements

pg_prepared_statements (PostgreSQL 9.0)

        View "pg_catalog.pg_prepared_statements"
     Column      |           Type           | Modifiers 
-----------------+--------------------------+-----------
 name            | text                     | 
 statement       | text                     | 
 prepare_time    | timestamp with time zone | 
 parameter_types | regtype[]                | 
 from_sql        | boolean                  |
    

文档: pg_prepared_statements

pg_prepared_statements (PostgreSQL 8.4)

        View "pg_catalog.pg_prepared_statements"
     Column      |           Type           | Modifiers 
-----------------+--------------------------+-----------
 name            | text                     | 
 statement       | text                     | 
 prepare_time    | timestamp with time zone | 
 parameter_types | regtype[]                | 
 from_sql        | boolean                  | 
View definition:
 SELECT p.name, p.statement, p.prepare_time, p.parameter_types, p.from_sql
   FROM pg_prepared_statement() p(name, statement, prepare_time, parameter_types, from_sql);
    

文档: pg_prepared_statements

pg_prepared_statements (PostgreSQL 8.3)

        View "pg_catalog.pg_prepared_statements"
     Column      |           Type           | Modifiers 
-----------------+--------------------------+-----------
 name            | text                     | 
 statement       | text                     | 
 prepare_time    | timestamp with time zone | 
 parameter_types | regtype[]                | 
 from_sql        | boolean                  | 
View definition:
 SELECT p.name, p.statement, p.prepare_time, p.parameter_types, p.from_sql
   FROM pg_prepared_statement() p(name text, statement text, prepare_time timestamp with time zone, parameter_types regtype[], from_sql boolean);
    

文档: pg_prepared_statements

pg_prepared_statements (PostgreSQL 8.2)

        View "pg_catalog.pg_prepared_statements"
     Column      |           Type           | Modifiers 
-----------------+--------------------------+-----------
 name            | text                     | 
 statement       | text                     | 
 prepare_time    | timestamp with time zone | 
 parameter_types | regtype[]                | 
 from_sql        | boolean                  | 
View definition:
 SELECT p.name, p."statement", p.prepare_time, p.parameter_types, p.from_sql
   FROM pg_prepared_statement() p(name text, "statement" text, prepare_time timestamp with time zone, parameter_types regtype[], from_sql boolean);
    

文档: pg_prepared_statements

更改历史记录

示例

来自pg_prepared_statements的示例行

postgres=# PREPARE fooplan (int, text) AS
    INSERT INTO foo VALUES($1, $2);

postgres=# SELECT * FROM pg_prepared_statements\gx
-[ RECORD 1 ]---+-------------------------------
name            | fooplan
statement       | PREPARE fooplan (int, text) AS+
                |     SELECT $1, $2 FROM foo;
prepare_time    | 2022-05-01 08:12:58.982591+01
parameter_types | {integer,text}
from_sql        | t
generic_plans   | 0
custom_plans    | 0

分类

事务

反馈

提交任何关于"pg_prepared_statements"的评论、建议或更正 此处