graphql-postgres-subscriptions icon indicating copy to clipboard operation
graphql-postgres-subscriptions copied to clipboard

NOTIFY channel length limit

Open jedwards1211 opened this issue 6 years ago • 2 comments

It seems that Postgres (9.5 at least) limits the length of channels for NOTIFY and LISTEN:

# LISTEN "pg/tables/TagNotificationTriggers/tag/_org/1/JSON Test/battery/1/lifetimeWh";
NOTICE:  identifier "pg/tables/TagNotificationTriggers/tag/_org/1/JSON Test/battery/1/lifetimeWh"
  will be truncated to "pg/tables/TagNotificationTriggers/tag/_org/1/JSON Test/battery/"

Finding out about this was a bit of a rude awakening. I just complained on the Postgres mailing list that no channel length limit is mentioned in their documentation. I don't know if graphql-postgres-subscriptions has a way to catch the NOTICE from postgres, but at the very least it would probably be helpful for graphql-postgres-subscriptions print a warning to the console if a topic is longer than 63 characters.

jedwards1211 avatar Dec 19 '18 00:12 jedwards1211

I didn't realize, given that channel is an identifier, it's subject to the same restrictions as any identifier (63 characters)

jedwards1211 avatar Dec 19 '18 01:12 jedwards1211

I just discovered that notify/listen silently fails in pg-ipc if the channel is too long:

https://github.com/emilbayes/pg-ipc/issues/2

jedwards1211 avatar Jun 14 '21 18:06 jedwards1211