Skip to content

Declared Local Temporary Tables in PSQL#9058

Open
asfernandes wants to merge 4 commits into
masterfrom
work/ltt
Open

Declared Local Temporary Tables in PSQL#9058
asfernandes wants to merge 4 commits into
masterfrom
work/ltt

Conversation

@asfernandes

Copy link
Copy Markdown
Member

No description provided.

@AlexBekhtin

Copy link
Copy Markdown

Is infinite execution correct by design?

execute block returns (n integer)
as
    declare local temporary table t (
        id integer not null
    );
begin
     insert into t(id)    
     values(1);

     insert into t(id) 
     select id from t;

    select count(*) from t into n;
    suspend;
end!

@asfernandes

Copy link
Copy Markdown
Member Author

Is infinite execution correct by design?

No, current local table blr (as used for RETURNING) is fragile.
I'm reviewing the implementation details.

@sim1984

sim1984 commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Please add documentation about declared ltt restrictions, specifically the number of LTTs per operator.

Could you add the ability to declare indexes for such tables?

@asfernandes

Copy link
Copy Markdown
Member Author

Could you add the ability to declare indexes for such tables?

I'm working on it. Will be added in another PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants