Hi Jakub J Jablonski •,
I'm glad that you were able to resolve your issue and thank you for posting your solution so that others experiencing the same thing can easily reference this! Since the Microsoft Q&A community has a policy that "The question author cannot accept their own answer. They can only accept answers by others ", I'll repost your solution in case you'd like to "Accept " the answer.
Issue:
Solution taken in Cx verbatim:
We believe the root cause is that exporting data from Postgres to Azure Storage requires 2 steps (after the initial CREATE EXTENSION azure_storage):
- SELECT azure_storage.account_add...
- COPY … TO 'https://….blob.core.windows.net/…'
Until now we have been doing SELECT, and then a series of COPY statements.
However, we are using a pool of connections to the database, so if for any reason the subsequent COPY has been using a different connection than the one with SELECT, we got this (misleading) error message.
We could reproduce it in DBeaver, SELECTing account in one SQL console, and then COPYing in another.
We have changed the behavior to send both SELECT and COPY one just after the other, reducing the risk of them using a different connection. Ideally we would like to put them in the single SQL statement, but we couldn’t find a way to do that.
IMHO the manual in https://learn.microsoft.com/en-us/azure/postgresql/flexible-server/concepts-storage-extension#export-data-from-azure-database-for-postgresql-flexible-server-to-azure-blob-storage could be improved to clarify the behavior in case of pooled database connections (which is the usual real-life case).
If you have any other questions or are still running into more issues, please let me know. Thank you again for your time and patience throughout this issue.
Please remember to "Accept Answer" if any answer/reply helped, so that others in the community facing similar issues can easily find the solution.