Re: Re: proposal: schema variables
Pavel Stehule <pavel.stehule@gmail.com>
Commits
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Move WAL sequence code into its own file
- a87987cafca6 19 (unreleased) cited
-
Add ExplainState argument to pg_plan_query() and planner().
- c83ac02ec730 19 (unreleased) cited
-
Don't include access/htup_details.h in executor/tuptable.h
- 1a8b5b11e48a 19 (unreleased) cited
-
Refactor to avoid code duplication in transformPLAssignStmt.
- b0fb2c6aa5a4 19 (unreleased) cited
-
Avoid including commands/dbcommands.h in so many places
- 325fc0ab14d1 19 (unreleased) cited
-
Restrict psql meta-commands in plain-text dumps.
- 71ea0d679543 19 (unreleased) cited
-
Split func.sgml into more manageable pieces
- 4e23c9ef65ac 19 (unreleased) cited
-
Fix squashing algorithm for query texts
- 0f65f3eec478 18.0 cited
-
EXPLAIN: Always use two fractional digits for row counts.
- 95dbd827f2ed 18.0 cited
-
Preliminary refactoring of plpgsql expression construction.
- a654af21ae52 18.0 cited
-
plpgsql: pure parser and reentrant scanner
- 7b27f5fd36cb 18.0 cited
-
Add some sanity checks in executor for query ID reporting
- 24f520594809 18.0 cited
-
Fix misleading error message context
- 4af123ad45bd 18.0 cited
-
Add macros for looping through a List without a ListCell.
- 14dd0f27d7cd 17.0 cited
Hi so 28. 12. 2024 v 11:35 odesílatel jian he <jian.universality@gmail.com> napsal: > hi. > > src9=# select 'XLogRecPtr'::regtype; > ERROR: type "xlogrecptr" does not exist > LINE 1: select 'XLogRecPtr'::regtype; > ^ > so > + <structfield>varcreate_lsn</structfield> <type>XLogRecPtr</type> > should be > <structfield>varcreate_lsn</structfield> <type>pg_lsn</type> > ? > done > > also > + <row> > + <entry role="catalog_table_entry"><para role="column_definition"> > + <structfield>varcreate_lsn</structfield> <type>XLogRecPtr</type> > + </para> > + <para> > + LSN of the transaction where the variable was created. > + <structfield>varcreate_lsn</structfield> and > + <structfield>oid</structfield> together form the all-time unique > + identifier (<structfield>oid</structfield> alone is not enough, > since > + object identifiers can get reused). > + </para></entry> > + </row> > + > we have "pg_variable_oid_index" PRIMARY KEY, btree (oid) > for table pg_variable. > so I am confused by saying the column "oid" itself is not enough to > prove unique. > The session variable is stored in memory until the end of the session. Theoretically, some sessions with used session variables can be opened for a very long time without any activity - so it is not possible to process sinval message. Other sessions can drop and create a lot of session variables (this is very possible with temporary session variables). Oid in Postgres can overflow, and postgres can reuse used oid of dropped objects (oid is only 32bit integer). And after some time, the session with the used variable can be activated, and the session variable can be used. Before usage the session variable is rechecked against pg_variable, and theoretically the variable with the same oid can be there (although it is a different variable with possibly different type). The implementation should protect against this scenario. The stored value must not be used in this case - the usage of old value is dangerous - the calculations with the variable can lose sense or can crash postgres. LSN is forever unique - it is 64bit integer - so it is our safeguard so we can detect obsolete values (stored in memory) although there are variables with the same oid. oid in pg_variable ensures a unique identifier for any session variable in one moment. Compound key [oid, varcreate_lsn] is a unique identifier for ever. > in let.sgml > <term><literal>session_variable</literal></term> > should be > <term><replaceable class="parameter">session_variable</replaceable></term> > done > > <term><literal>sql_expression</literal></term> > should be > <term><replaceable class="parameter">sql_expression</replaceable></term> > done