P
Prismaβ€’2mo ago
kimb0x

Can't delete records from Prisma Postgres in Studio

I haven't been able to delete data from the new Prisma Postgres within Studio--neither a single register nor with a rawquery using prisma client. The error I get is:
Type: undefined
Message:
Invalid prisma.table_name.delete() invocation:


Error in batch request 0: Error occurred during query execution:
ConnectorError(ConnectorError { user_facing_error: None, kind: QueryError(PostgresError { code: "55000", message: "cannot delete from table \"TableName\" because it does not have a replica identity and publishes deletes", severity: "ERROR", detail: None, column: None, hint: Some("To enable deleting from the table, set REPLICA IDENTITY using ALTER TABLE.") }), transient: false })

Code: undefined

Query:
[object Object]
Type: undefined
Message:
Invalid prisma.table_name.delete() invocation:


Error in batch request 0: Error occurred during query execution:
ConnectorError(ConnectorError { user_facing_error: None, kind: QueryError(PostgresError { code: "55000", message: "cannot delete from table \"TableName\" because it does not have a replica identity and publishes deletes", severity: "ERROR", detail: None, column: None, hint: Some("To enable deleting from the table, set REPLICA IDENTITY using ALTER TABLE.") }), transient: false })

Code: undefined

Query:
[object Object]
When I try to set the Replica Identity I get a permission error. The owner of the tables is: prisma_migration My user is: prisma_application I can't change the permissions with that user. I tried creating the database with prisma migrate dev and with prisma db push and the situation is the same. I connect to Studio (v0.503.0) with a generated Prisma Client (v5.21.1) using the --no-engine flag within a local Deno (v2.0.4) development. Thank you so much! PS. Love the Prisma Postgres btw! Can't wait to see how it develops!
15 Replies
Nurul
Nurulβ€’2mo ago
Hi @kimb0x Thank you for sharing the error message. What happens if you try to delete a single record via Prisma Studio?
kimb0x
kimb0xOPβ€’2mo ago
kimb0x
kimb0xOPβ€’2mo ago
Thank you, yes, when I try to delete 1 or more records the error message is the same. I can create new records and edit the fields, though This happens with my table that has a relationship and uses an autogenerated 3rd (index) table managed by Prisma/Postgres. A simple table model with no relations allows the delete command without issues. The automatically generated table _TaskToUser is the one stopping the delete command. That inbetween table is created with this:
kimb0x
kimb0xOPβ€’2mo ago
No description
kimb0x
kimb0xOPβ€’2mo ago
Thank you again! When I try to truncate the User table with the Prisma Client (Deno/TypeScript) I get this error:
{
name: "PrismaClientKnownRequestError",
code: "P2010",
clientVersion: "5.21.1",
meta: { code: "42501", message: "ERROR: permission denied for table User" }
}
{
name: "PrismaClientKnownRequestError",
code: "P2010",
clientVersion: "5.21.1",
meta: { code: "42501", message: "ERROR: permission denied for table User" }
}
And is also the same error if I try to Truncate the _TaskToUser table.
Nurul
Nurulβ€’2mo ago
@RaphaelEtim When you are back, can you try to reproduce this issue?
Hydra
Hydraβ€’2mo ago
Having the same issue with Prisma Postgres. I even tried to set REPLICA IDENTITY FULL on the affected table but got an error.
Raw query failed. Code: `42501`. Message: `ERROR: must be owner of table
Raw query failed. Code: `42501`. Message: `ERROR: must be owner of table
KHRM
KHRMβ€’2mo ago
I had this issue too, one of my tables didn't have an @id only an @unique and it seems to work after I made the schema change and made it an @id Not sure if that's the actual issue
kimb0x
kimb0xOPβ€’2mo ago
I might need to run a test on that, but currently in my schema all involved tables have both @id and @unique definitions
RaphaelEtim
RaphaelEtimβ€’2mo ago
Hi @kimb0x Can you please share your schema file?
kimb0x
kimb0xOPβ€’2mo ago
kimb0x
kimb0xOPβ€’4w ago
Thank you! Amazing job, guys! Thank you so much. Prisma v6 fixed everything for me. @RaphaelEtim @Nurul (Prisma) :prisma_green: Prisma Rocks! 😎
RaphaelEtim
RaphaelEtimβ€’4w ago
Hey @kimb0x Thanks for the kind words. This was fixed and you can read more about it here
GitHub
Release 6.0.0 Β· prisma/prisma
We’re excited to share the Prisma ORM v6 release todayΒ πŸŽ‰ As this is a major release, it includes a few breaking changes that may affect your application. Before upgrading, we recommend that you che...
kimb0x
kimb0xOPβ€’4w ago
Thanks again! πŸ™
Nurul
Nurulβ€’3w ago
Thank you for your patience while we worked on this πŸ™
Want results from more Discord servers?
Add your server