{"action":"created","issue":{"url":"https://api.github.com/repos/citusdata/citus/issues/240","repository_url":"https://api.github.com/repos/citusdata/citus","labels_url":"https://api.github.com/repos/citusdata/citus/issues/240/labels{/name}","comments_url":"https://api.github.com/repos/citusdata/citus/issues/240/comments","events_url":"https://api.github.com/repos/citusdata/citus/issues/240/events","html_url":"https://github.com/citusdata/citus/issues/240","id":131445965,"number":240,"title":"Allow IMMUTABLE functions in modification commands","user":{"login":"citus-github-bot","id":17053023,"avatar_url":"https://avatars.githubusercontent.com/u/17053023?v=3","gravatar_id":"","url":"https://api.github.com/users/citus-github-bot","html_url":"https://github.com/citus-github-bot","followers_url":"https://api.github.com/users/citus-github-bot/followers","following_url":"https://api.github.com/users/citus-github-bot/following{/other_user}","gists_url":"https://api.github.com/users/citus-github-bot/gists{/gist_id}","starred_url":"https://api.github.com/users/citus-github-bot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/citus-github-bot/subscriptions","organizations_url":"https://api.github.com/users/citus-github-bot/orgs","repos_url":"https://api.github.com/users/citus-github-bot/repos","events_url":"https://api.github.com/users/citus-github-bot/events{/privacy}","received_events_url":"https://api.github.com/users/citus-github-bot/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/citusdata/citus/labels/feature","name":"feature","color":"84b6eb"}],"state":"open","locked":false,"assignee":{"login":"jasonmp85","id":50673,"avatar_url":"https://avatars.githubusercontent.com/u/50673?v=3","gravatar_id":"","url":"https://api.github.com/users/jasonmp85","html_url":"https://github.com/jasonmp85","followers_url":"https://api.github.com/users/jasonmp85/followers","following_url":"https://api.github.com/users/jasonmp85/following{/other_user}","gists_url":"https://api.github.com/users/jasonmp85/gists{/gist_id}","starred_url":"https://api.github.com/users/jasonmp85/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jasonmp85/subscriptions","organizations_url":"https://api.github.com/users/jasonmp85/orgs","repos_url":"https://api.github.com/users/jasonmp85/repos","events_url":"https://api.github.com/users/jasonmp85/events{/privacy}","received_events_url":"https://api.github.com/users/jasonmp85/received_events","type":"User","site_admin":false},"milestone":null,"comments":24,"created_at":"2016-02-04T19:08:53Z","updated_at":"2016-04-21T20:56:03Z","closed_at":null,"body":"<a href=\"https://github.com/gmcquillan\"><img src=\"https://avatars.githubusercontent.com/u/313116?v=3\" align=\"left\" width=\"96\" height=\"96\" hspace=\"10\"></img></a> **Issue by [gmcquillan](https://github.com/gmcquillan)**\n_Tuesday May 05, 2015 at 22:53 GMT_\n_Originally opened as https://github.com/citusdata/pg_shard/issues/108_\n\n----\n\nI'm experimenting with using HyperLogLog (HLL) data types in some columns. One problem with these is that they take up quite a lot more space than a BIGINT. pg_shard potentially allays a lot of those issues. The extension that provides the HLL datatype is [this one](https://github.com/aggregateknowledge/postgresql-hll) by aggregateknowledge. These two extensions seem complimentary for warehousing purposes.\r\n\r\nSurprisingly, these data types work with sharded tables for most types of reads, but not for writes (see below). When I attempt an update like so:\r\n\r\n```sql\r\nupdate test_hll_shard set users = users||hll_hash_text('foobar') where date = date('2015-01-08');\r\n```\r\nI get: \r\n```\r\nERROR:  cannot plan sharded modification containing values which are not constants or constant expressions\r\n```\r\n\r\n I can sort of work around this by setting the literal bytes in this field. Which works fine -- but adding HLL values requires a read and a write. Since pg_shard (understandably) doesn't allow for more than a single statement transaction, this leaves my use-case vulnerable to race conditions in multi-writer environments.\r\n\r\nSince this function is available on the workers, and is deterministic based on the value of the existing row and the new HLL value to be added, there shouldn't be any issue with dispatching this expression through to the workers. \r\n\r\nIs there a *hard limitation* preventing pg_shard from dispatching modifications for non-constant expressions?\n"},"comment":{"url":"https://api.github.com/repos/citusdata/citus/issues/comments/213110496","html_url":"https://github.com/citusdata/citus/issues/240#issuecomment-213110496","issue_url":"https://api.github.com/repos/citusdata/citus/issues/240","id":213110496,"user":{"login":"marcocitus","id":7127240,"avatar_url":"https://avatars.githubusercontent.com/u/7127240?v=3","gravatar_id":"","url":"https://api.github.com/users/marcocitus","html_url":"https://github.com/marcocitus","followers_url":"https://api.github.com/users/marcocitus/followers","following_url":"https://api.github.com/users/marcocitus/following{/other_user}","gists_url":"https://api.github.com/users/marcocitus/gists{/gist_id}","starred_url":"https://api.github.com/users/marcocitus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marcocitus/subscriptions","organizations_url":"https://api.github.com/users/marcocitus/orgs","repos_url":"https://api.github.com/users/marcocitus/repos","events_url":"https://api.github.com/users/marcocitus/events{/privacy}","received_events_url":"https://api.github.com/users/marcocitus/received_events","type":"User","site_admin":false},"created_at":"2016-04-21T20:56:02Z","updated_at":"2016-04-21T20:56:02Z","body":"Once we solve this issue we can also provide a sneaky workaround for #211 by defining a PL/pgSQL wrapper for nextval that is marked as immutable. In that case it will get evaluated on the master as if it was a constant expression."}}