Skip to content

Mutable SQL commands should be used with Spi::update().#1114

Merged
montanalow merged 1 commit into
postgresml:masterfrom
higuoxing:fix-spi-call
Oct 23, 2023
Merged

Mutable SQL commands should be used with Spi::update().#1114
montanalow merged 1 commit into
postgresml:masterfrom
higuoxing:fix-spi-call

Conversation

@higuoxing

@higuoxing higuoxing commented Oct 23, 2023

Copy link
Copy Markdown
Contributor

Commands like 'INSERT', 'CREATE TABLE' are modifying database objects. They should be used with 'Spi::update()'12.

Besides, one of the unnecessary calling of '.clone()' is removed.

Co-Authored-By: Chen Mulong chenmulong@gmail.com

Footnotes

  1. https://www.postgresql.org/docs/current/spi-spi-execute.html

  2. https://github.com/pgcentralfoundation/pgrx/blob/64fbc2e2efb06212046082ffcde2e794ccb4d48a/pgrx/src/spi/client.rs#L60

Commands like 'INSERT', 'CREATE TABLE' are modifying database objects.
They should be used in 'Spi::update()'[1][2].

Besides, one of the unnecessary calling of '.clone()' is removed.

[1]: https://www.postgresql.org/docs/current/spi-spi-execute.html
[2]: https://github.com/pgcentralfoundation/pgrx/blob/64fbc2e2efb06212046082ffcde2e794ccb4d48a/pgrx/src/spi/client.rs#L60

Co-Authored-By: Chen Mulong <chenmulong@gmail.com>
@higuoxing higuoxing changed the title Mutable SQL commands should be used in Spi::update(). Mutable SQL commands should be used with Spi::update(). Oct 23, 2023
@montanalow montanalow self-requested a review October 23, 2023 15:46
@montanalow

Copy link
Copy Markdown
Contributor

Thanks for this fix!

@montanalow montanalow merged commit a46825a into postgresml:master Oct 23, 2023
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.

2 participants