'What's the difference between BIGINT and INT8? (postgres)
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?
Solution 1:[1]
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 |
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Lukas Eder |