Skip to content
This repository has been archived by the owner on Jun 20, 2024. It is now read-only.

Payload string too long (trigger) #56

Open
OlivierNguyen opened this issue Dec 10, 2015 · 1 comment
Open

Payload string too long (trigger) #56

OlivierNguyen opened this issue Dec 10, 2015 · 1 comment

Comments

@OlivierNguyen
Copy link

I have a problem when I try to update my table : "Payload string too long".

I made the following change in the /packages/pg/observe-driver/setup-triggers.sql file :

7950 to 7500

And I don't really understand why It works. Can we get more informations about this code and what represents the 7950 ?

SELECT row_to_json(row_data)::TEXT INTO full_msg;
    SELECT char_length(full_msg)       INTO full_len;
    SELECT (full_len / 7950) + 1       INTO page_count;
    SELECT md5(full_msg)               INTO msg_hash;

    FOR cur_page IN 1..page_count LOOP
      PERFORM pg_notify('simple_pg_sjJN',
        msg_hash || ':' || page_count || ':' || cur_page || ':' ||
        substr(full_msg, ((cur_page - 1) * 7950) + 1, 7950)
      );

Thanks in advance

@btoueg
Copy link
Contributor

btoueg commented Dec 14, 2015

It seems that the payload argument of the pg_notify function is maxed at 8000 bytes by default.

http://www.postgresql.org/docs/9.4/static/sql-notify.html

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants