N
Neon•6mo ago
deep-jade

Missing UUID Primary Keys

Hello! I am new to Neon, but have used PostgreSQL a decent amount. I use UUIDs as primary keys in a few of my tables. However, whenever I create a table in my neon schema (through direct SQL or Neon's UI), it strips my primary key. This is making it impossible for me to remove entries from my tables since the primary keys are being removed from my UUID pkey columns.
6 Replies
deep-jade
deep-jadeOP•6mo ago
Reading through the forum I am seeing that it seems everyone is having the same issue. I should also note that, upon attempting to alter the table to add a primary key once again, I get an error stating that the table "cannot have two primary keys." So somewhere in the pipeline it is noticing that I have a primary key.
fascinating-indigo
fascinating-indigo•6mo ago
Weird, I've never had this happen before Can you share an example table query you used?
deep-jade
deep-jadeOP•6mo ago
Yeah for sure! Table schema
CREATE TABLE items (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
name TEXT NOT NULL,
description TEXT,
img_url TEXT
)
CREATE TABLE items (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
name TEXT NOT NULL,
description TEXT,
img_url TEXT
)
Insert INSERT INTO items (name) VALUES ('Example Item') Resulting id: a8b9fa26-783e-4406-9612-c0f6455f68bf Delete DELETE FROM items WHERE id = 'a8b9fa26-783e-4406-9612-c0f6455f68bf' This, btw, worked. But attempting to delete from the UI did not. 🤔
deep-jade
deep-jadeOP•6mo ago
Also, Neon is showing this as the table schema:
No description
fascinating-indigo
fascinating-indigo•6mo ago
Yeah, can confirm. Will escalate. Thanks
deep-jade
deep-jadeOP•6mo ago
No problem! I am glad that it seems to be working from the SQL side of things. At least in my case. Seems some users were having broader issues

Did you find this page helpful?