Hi. I'm using Postgres and I wan't to have a colum...
# orm-help
p
Hi. I'm using Postgres and I wan't to have a column
cursor
that has always the same value as the column
id
. I think that somewhere in the past I saw here in prisma slack someone doing that, but I can't see how I can do it with postgres. Anyone knows? It's like a view column.
r
Hey @Paulo Neves 👋 As you’re using Postgres, you can use the 
generated
 identifier for this to make sure all values are same 🙂 Something like :
Copy code
create table "user" (
	"id" serial primary key,
	"cursor" int generated always as ("id") stored
);
p
So when a item is created, the cursor is created without the need to define it?
r
Yeah. The value will be copied from the id and both will have the same values.
p
It worked!! Thanks 🙂
🙌 1
@Ryan While deploying I discovered that azure only supports postgres version 11 and this is a version 12 feature. Do you know any alternative?
I'm trying a type of Postgres in Azure that has v12 to see if it fits well.
r
I would need to check for PG 11 and get back to you 🙂
p
Azure has a preview for Postgres 12. I hope it's stable enough 😅 But for now it's working very well 🙂
🙌 1