P
Prisma2w 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!
12 Replies
Nurul
Nurul2w ago
Hi @kimb0x Thank you for sharing the error message. What happens if you try to delete a single record via Prisma Studio?
kimb0x
kimb0xOP2w ago
kimb0x
kimb0xOP2w 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
kimb0xOP2w ago
No description
kimb0x
kimb0xOP2w 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
Nurul2w ago
@RaphaelEtim When you are back, can you try to reproduce this issue?
Hydra
Hydra2w 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
KHRM6d 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
kimb0xOP6d 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
RaphaelEtim5d ago
Hi @kimb0x Can you please share your schema file?
kimb0x
kimb0xOP5d ago
Thank you!
Want results from more Discord servers?
Add your server