Reputation: 8841
I'm using a service called Supabase and I created a table:
CREATE TABLE my_table (
"id" BIGSERIAL PRIMARY KEY NOT NULL,
"title" Text COLLATE "pg_catalog"."default",
"message" Text COLLATE "pg_catalog"."default");
However, this turns into an int8 type. Is that smaller than bigint?
Upvotes: 22
Views: 28461
Reputation: 220842
BIGINT
is just an alias for INT8
in PostgreSQL. Try this:
CREATE TABLE t (
c1 bigint,
c2 int8
);
SELECT a.attname, t.typname
FROM pg_class AS c
JOIN pg_attribute AS a ON a.attrelid = c.oid
JOIN pg_type AS t ON a.atttypid = t.oid
WHERE c.relname = 't'
AND a.attname IN ('c1', 'c2')
ORDER BY 1;
You'll get:
|attname|typname|
|-------|-------|
|c1 |int8 |
|c2 |int8 |
There's no stored type name bigint
in pg_type
:
SELECT * FROM pg_type WHERE typname IN ('int8', 'bigint');
This only returns:
|typname|
|-------|
|int8 |
Upvotes: 28