Thread

  1. Size limit for NOTIFY payload

    sulfinu@gmail.com — 2024-12-16T08:01:14Z

    Hello,
    
    according to the documentation
    <https://www.postgresql.org/docs/current/sql-notify.html>, 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.
    
  2. Re: Size limit for NOTIFY payload

    Tom Lane <tgl@sss.pgh.pa.us> — 2024-12-18T16:29:20Z

    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
    
    
    
    
  3. Re: Size limit for NOTIFY payload

    sulfinu@gmail.com — 2024-12-19T09:00:18Z

    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
    >
    
  4. Re: Size limit for NOTIFY payload

    Greg Sabino Mullane <htamfids@gmail.com> — 2024-12-20T14:16:30Z

    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