Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add SQL command to close a specific prepared statement #6732

Closed
monetdb-team opened this issue Nov 30, 2020 · 0 comments
Closed

Add SQL command to close a specific prepared statement #6732

monetdb-team opened this issue Nov 30, 2020 · 0 comments
Labels
enhancement New feature or request SQL

Comments

@monetdb-team
Copy link

Date: 2019-07-17 14:06:59 +0200
From: Martin van Dinther <<martin.van.dinther>>
To: SQL devs <>
Version: 11.33.3 (Apr2019)
CC: @mlkersten, @PedroTadim

Last updated: 2020-06-03 16:58:54 +0200

Comment 27144

Date: 2019-07-17 14:06:59 +0200
From: Martin van Dinther <<martin.van.dinther>>

User-Agent: Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:67.0) Gecko/20100101 Firefox/67.0
Build Identifier:

There is currently no way to close a specific prepared statement.
To free resources on the server, it would be good if the user/application could close a prepared statement after it is no longer needed.

PostgreSQL supports: DEALLOCATE [ PREPARE ] { name | ALL }
See https://www.postgresql.org/docs/current/sql-deallocate.html

MySQL supports: {DEALLOCATE | DROP} PREPARE stmt_name
See https://dev.mysql.com/doc/refman/8.0/en/deallocate-prepare.html

Reproducible: Always

See https://www.postgresql.org/docs/current/sql-deallocate.html
and https://dev.mysql.com/doc/refman/8.0/en/deallocate-prepare.html
This request is related to https://www.monetdb.org/bugzilla/show_bug.cgi?id=6731

Comment 27207

Date: 2019-08-12 09:47:29 +0200
From: @mlkersten

In this context it is also good to review the use of () as the name
for the prepared statement. I would prefer an identifier, possibly controlled
by the user, e.g.

sql>prepare

A possibly cleaner approach is to consider them as short-hand function/procedure
definitions which end up in the function table. Then releasing them aligns
with dropping functions/procedures.

sql>prepare select 1;
statement turned into a CREATE FUNCTION p5(...)

sql> select p5();
sql> drop function p5();

Unfortunately, the PREPARE can also be prepended to a create table, which is not a function call.

Comment 27208

Date: 2019-08-12 10:06:08 +0200
From: @mlkersten

sql> prepare myquery select ?, count(*) from tables
sql> call myquery('total')

@monetdb-team monetdb-team added enhancement New feature or request SQL labels Nov 30, 2020
@sjoerdmullender sjoerdmullender added this to the Ancient Release milestone Feb 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request SQL
Projects
None yet
Development

No branches or pull requests

2 participants