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
Attachments
- v20250106-0023-pg_restore-A-variable.patch (text/x-patch) patch v20250106-0023
- v20250106-0022-transactional-variables.patch (text/x-patch) patch v20250106-0022
- v20250106-0021-this-patch-changes-error-message-column-doesn-t-exis.patch (text/x-patch) patch v20250106-0021
- v20250106-0020-expression-with-session-variables-can-be-inlined.patch (text/x-patch) patch v20250106-0020
- v20250106-0019-plpgsql-implementation-for-LET-statement.patch (text/x-patch) patch v20250106-0019
- v20250106-0018-allow-parallel-execution-queries-with-session-variab.patch (text/x-patch) patch v20250106-0018
- v20250106-0017-allow-read-an-value-of-session-variable-directly-fro.patch (text/x-patch) patch v20250106-0017
- v20250106-0015-Implementation-of-DEFAULT-clause-default-expressions.patch (text/x-patch) patch v20250106-0015
- v20250106-0016-Implementation-of-NOT-NULL-and-IMMUTABLE-clauses.patch (text/x-patch) patch v20250106-0016
- v20250106-0014-Implementation-ON-TRANSACTION-END-RESET-clause.patch (text/x-patch) patch v20250106-0014
- v20250106-0012-PREPARE-LET-support.patch (text/x-patch) patch v20250106-0012
- v20250106-0013-implementation-of-temporary-session-variables.patch (text/x-patch) patch v20250106-0013
- v20250106-0011-EXPLAIN-LET-support.patch (text/x-patch) patch v20250106-0011
- v20250106-0009-variable-fence-syntax-support-and-variable-fence-usa.patch (text/x-patch) patch v20250106-0009
- v20250106-0010-dynamic-check-of-usage-of-session-variable-fences.patch (text/x-patch) patch v20250106-0010
- v20250106-0008-GUC-session_variables_ambiguity_warning.patch (text/x-patch) patch v20250106-0008
- v20250106-0007-plpgsql-tests.patch (text/x-patch) patch v20250106-0007
- v20250106-0006-memory-cleaning-after-DROP-VARIABLE.patch (text/x-patch) patch v20250106-0006
- v20250106-0004-function-pg_session_variables-for-cleaning-tests.patch (text/x-patch) patch v20250106-0004
- v20250106-0005-DISCARD-VARIABLES.patch (text/x-patch) patch v20250106-0005
- v20250106-0003-use-bitmapset-of-parid-instead-of-varid-for-calculat.patch (text/x-patch) patch v20250106-0003
- v20250106-0002-Storage-for-session-variables-and-SQL-interface.patch (text/x-patch) patch v20250106-0002
- v20250106-0001-Enhancing-catalog-for-support-session-variables-and-.patch (text/x-patch) patch v20250106-0001
Hi
>
>>
>> we use PlannerGlobal
>> {
>> Oid basenodeSessionVarid;
>> Bitmapset *checkSelectPermVarids;
>> }
>> to solve the self-assigned corner case SELECT privilege.
>> (let v1.a =v1.a; in this case, we need have SELECT priv for v1.a
>> but let v1.a = 1, we don't need SELECT priv for v1.a).
>>
>> i found out these two field value(information) most case is the same
>> as PlannerGlobal.sessionVariables;
>> I came up with another solution, introduce a bool
>> (Query.is_Variable_assigned),
>> and get rid of PlannerGlobal.basenodeSessionVarid,
>> PlannerGlobal.checkSelectPermVarids.
>> not sure it make sense to you, refer
>> v1-0002-refactoring-LET-statement-self-assign-privileg.no-cfbot
>>
>
> It is true, so bitmapset checkSelectPermVarids contains almost all the
> same data like sessionVariables.
> But checkSelectPermVarids allows fast checking if a variable is used
> already, and sessionVariables list ensures necessary order.
>
> My implementation needs more memory (one bitmapset), but I think it is
> very simple and less error prone (doesn't depend on iteration order).
>
> In this case and this moment I prefer my bitmapset based solution. It can
> be optimized maybe later - I thought about a dedicated item in
> sessionVariables for the basenode parameter.
> This should be a clear winner for value passed types, but for varlena
> types (for long varlena types), it can force passing content of some
> session variable twice.
>
I found so storing oid to bitmapset can have big memory overhead. Bitmapset
with one oid value like 16000 has about 2kB. So instead storing varid, I
try to store paramid. paramid starts by zero.
See patch 03. Now the overhead of the usage of bitmapset for calculation of
the variable excluded from SELECT acl check has tens bytes overhead.
Regards
Pavel
>
> Regards
>
> Pavel
>
>
>
>
>
>