Thread: Size limit for NOTIFY payload
Hello,
according to the documentation, the payload given in a NOTIFY statement must not exceed a certain limit in bytes. But the payload is a character string, therefore the limit remains unclear.
What's the character encoding of the NOTIFY payload, is it the default database encoding?
Thanks.
sulfinu@gmail.com writes: > What's the character encoding of the NOTIFY payload, is it the default > database encoding? It's whatever encoding your database uses; NOTIFY doesn't do any transcoding. (We'd have to think harder about that if NOTIFY messages could cross database boundaries ... but they don't today.) regards, tom lane
Well, as I said, that's a text value with a byte limit. The documentation should definitely mention something like "with the default database encoding".
În mie., 18 dec. 2024 la 18:29, Tom Lane <tgl@sss.pgh.pa.us> a scris:
sulfinu@gmail.com writes:
> What's the character encoding of the NOTIFY payload, is it the default
> database encoding?
It's whatever encoding your database uses; NOTIFY doesn't do any
transcoding.
(We'd have to think harder about that if NOTIFY messages could cross
database boundaries ... but they don't today.)
regards, tom lane
On Fri, Dec 20, 2024 at 5:53 AM <sulfinu@gmail.com> wrote:
Well, as I said, that's a text value with a byte limit. The documentation should definitely mention something like "with the default database encoding".
I'm not sure why you think adding such wordage is needed. Bytes is bytes. Your application should be checking the number of bytes in the string sent to NOTIFY.
On a related note, if you find yourself approaching the payload limits, you might want to rethink the way you are using LISTEN/NOTIFY.
Cheers,
Greg