pgcentralfoundation / pgrx

Build Postgres Extensions with Rust!
Other
3.71k stars 249 forks source link

`cargo pgrx run` actually updates the extension? #1928

Closed ccleve closed 1 month ago

ccleve commented 1 month ago

I've noticed an oddity. When I make a change to my code and then run cargo pgrx run, the code change is reflected immediately, without the need for DROP EXENSION / CREATE EXTENSION.

This is really convenient, because it means that my scripts do not need to recreate all extension objects in the database that got dropped with DROP EXTENSION.

Has it always been thus? In the past, I thought I did not see changes until I did drop/create.

eeeebbbbrrrr commented 1 month ago

It depends on when your extension is loaded by Postgres.

If it’s NOT loaded via shared preload libraries then yeah, you’ll see code changes on the next connection.

If it is then you have to restart.

Schema changes are never applied. That’s 100% on you to do.