Re:Tell HN: Citus is 100% open source now
by bombcar on Friday September 02, 2022 @02:22PM
(#32694118)
SELECT causing changes to things makes me feel weird inside.
[ Parent
| on HN ]
Re:Tell HN: Citus is 100% open source now
by pcthrowaway on Friday September 02, 2022 @02:23PM
(#32694131)
That's how every Postgres extension works (e.g. Timescale, PostGIS, etc.)
Re:Tell HN: Citus is 100% open source now
by firloop on Friday September 02, 2022 @02:33PM
(#32694254)
Not just Postgres extensions, most of Postgres’ own administrative functions can be triggered in SELECT statements. e.g. pg_terminate_backend()
https://www.postgresql.org/docs/current/functions-admin.html
Re:Tell HN: Citus is 100% open source now
by yjftsjthsd-h on Saturday September 03, 2022 @12:28PM
(#32703449)
To be quite clear, that always felt weird to me as well - something to the effect of "I thought SELECT was for reading data; why am I using it to create a replica?"
Re:Tell HN: Citus is 100% open source now
by kaveet on Friday September 02, 2022 @02:28PM
(#32694192)
DO $$ BEGIN
PERFORM rebalance_table_shards();
END $$;
Re:Tell HN: Citus is 100% open source now
by quickthrower2 on Friday September 02, 2022 @02:25PM
(#32694157)
SELECT is a bit like return?
return 6;
or
return x++;
or even
return (exit(0));
Re:Tell HN: Citus is 100% open source now
by colejohnson66 on Friday September 02, 2022 @02:28PM
(#32694184)
I think GP is saying they view SELECT as a "pure" function. A pure function doesn't modify state, so neither should SELECT.