The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
Fixed tables?
Ramiro Nuñez Dosio5e96ba04fa1e
diff --git a/apps/www/_blog/2022-09-08-choosing-a-postgres-primary-key.mdx b/apps/www/_blog/2022-09-08-choosing-a-postgres-primary-key.mdxindex 5f066684efe..edc6f412497 100644--- a/apps/www/_blog/2022-09-08-choosing-a-postgres-primary-key.mdx+++ b/apps/www/_blog/2022-09-08-choosing-a-postgres-primary-key.mdx@@ -62,10 +62,15 @@ After running that query, we can double check our results:```sqlSELECT * FROM users;```- id | email | name++id | email | name+----+------------------+----------- 1 | [email protected] | new_user- 2 | [email protected] | new_user++ 1 | [email protected] | new_user++ 2 | [email protected] | new_user+(2 rows)Using `COUNT(*)` in our query is not the most efficient (or even easiest) solution though, and hopefully it's clear why -- **counting a sequence of numbers for primary keys is a feature built in to Postgres**!@@ -99,10 +104,14 @@ INSERT INTO users_serial (email, name) VALUES ('[email protected]', 'new user');SELECT * FROM users;- id | email | name+ id | email | name+----+------------------+----------- 1 | [email protected] | new user++ 1 | [email protected] | new user+(1 row)+INSERT 0 1It works, as you might expect - now the application doesn't have to *somehow magically know* the right ID to use when inserting.