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

Cannot ALTER EXTENSION due to owner conflicts #725

Open
2 tasks done
henningko opened this issue Apr 14, 2023 · 4 comments
Open
2 tasks done

Cannot ALTER EXTENSION due to owner conflicts #725

henningko opened this issue Apr 14, 2023 · 4 comments
Labels
bug Something isn't working

Comments

@henningko
Copy link

Bug report

  • I confirm this is a bug with Supabase, not with my own application.
  • I confirm I have searched the Docs, GitHub Discussions, and Discord.

Describe the bug

When trying to alter an an extension in a migration after installation in a previous migration, the operation fails due to ownership conflicts.

To Reproduce

Steps to reproduce the behavior, please provide code snippets or a repository:

  1. Create a migration with
CREATE EXTENSION "vector";
ALTER EXTENSION "vector" SET SCHEMA extensions;
  1. The following error is returned
Error: ERROR: must be owner of extension vector (SQLSTATE 42501)
At statement 2: ALTER EXTENSION "vector" SET SCHEMA extensions

This is due to the extension having the id of supabase_admin as its user listed in pg_extension.extowner. However, via the CLI, it is not possible to change extowner to the id of postgres, and there seems to be no programmatic way of changing the owner of an extension.

In some cases, the extension can be dropped and reinstalled. But if you already use a vector data type in a table, the operation will fail.

Expected behavior

alter extension [ext] set schema [schema] should work via the CLI as long as the extension is relocatable.

System information

  • OS: macOS
  • Version of supabase-cli: 1.50.4
@henningko henningko added the bug Something isn't working label Apr 14, 2023
@sweatybridge sweatybridge transferred this issue from supabase/cli Aug 22, 2023
@sweatybridge
Copy link
Contributor

Transferred from CLI repo because it also affects the hosted platform.

@mercurydiogo
Copy link

any updates on this?

@03hgryan
Copy link

03hgryan commented Mar 4, 2024

Any updates?

@03hgryan
Copy link

03hgryan commented Mar 4, 2024

any updates on this?

If you use prisma, try this.

generator client {
  provider        = "prisma-client-js"
  previewFeatures = ["postgresqlExtensions"]
}

datasource db {
  provider   = "postgresql"
  url        = env("DATABASE_URL")
  extensions = [pgvector(map: "vector", schema: "extensions")]
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants