I have a postgresql database snapshot with the following structure
id (integer / autoincrement) address (varchar) balance (integer) datetime (date)
CREATE TABLE public.snapshots ( id integer NOT NULL GENERATED BY DEFAULT AS IDENTITY ( INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 2147483647 CACHE 1 ), address character varying COLLATE pg_catalog."default", balance bigint, datetime date, CONSTRAINT snapshots_pkey PRIMARY KEY (id) ) WITH ( OIDS = FALSE ) TABLESPACE pg_default; ALTER TABLE public.snapshots OWNER to postgres;
But it has some weird issues, for example I have this data
Some example of data is:
12531 "0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D" 34567733 "2020-09-01" 12532 "0x8cfb1D4269f0daa003CDEa567aC8f76c0647764a" 34547733 "2020-09-01" 12533 "0xdAC17F958D2ee523a2206206994597C13D831ec7" 34512333 "2020-09-01" 12534 "0x94d863173EE77439E4292284fF13fAD54b3BA182" 34511133 "2020-09-01" 12535 "0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D" 34555733 "2020-09-01" 12536 "0x9287130ba603359E9621ae89c4164613BF239Fa2" 34327733 "2020-09-01"
Well the problem is now that I do this select
SELECT * FROM snapshots where address = '0x9287130ba603359E9621ae89c4164613BF239Fa2'
0 returns
But if i do
SELECT id, address, balance, datetime FROM public.snapshots where datetime = '2020-09-01' and balance = 34327733;
It does return the result
What is going on? It works with some addresses, but doesn’t with others
Advertisement
Answer
The issue was related with tolowercase lol, I was doing the select in my script with uppercase