How can I use int32? The maximum int is int8 which...
# help
t
How can I use int32? The maximum int is int8 which can store a max length of 8
n
Hello @theuknowner! This thread has been automatically created from your message in #843999948717555735 a ``few seconds ago``. Pinging @User so that they see this as well! Want to unsubscribe from this thread? Right-click the thread in Discord (or use the ... menu) and select Leave Thread to unsubscribe from future updates. Want to change the title? Use the
/title
command! We have solved your problem? Click the button below to archive it.
a
int8 is 8 bytes, int4 is 4 bytes
n
theuknowner (2022-03-26)
a
u need 32 bytes?
t
yes
I want to store timestamps
a
for timestamp with time zone, u can try: timestamptz
t
Yes I have seen this type but I have to store a date
I want to store timestamp like 1648301593
which has 10 length and I can't store it in max 8 length int
I tried to set the column to bigint but I get int8 again
a
bigint == int8
t
what type can I use in order to have 10 length
?
s
bigint should work
a
bigint range: -9223372036854775808 to +9223372036854775807
t
My bad guys, I had set the value to string in golang
s
You should even be ok with int4, but it might not be sufficient in years to come as the range is -2147483648 to 2147483647
t
Yes int4 (for timestamp) has a maximum year 2038
I'll set it to int4 for now
s
If you have a choice I would suggest converting them to timestampz, this way you get the benefit of the tools the database provides when dealing with date comparison and so on.
t
I use it for my chat module, so it's easier to check according to device's unix timestamp value (eg. 2 mins ago)