meteor / postgres-packages

Early preview of PostgreSQL support for Meteor (deprecated, here for historical reasons)
http://meteor-postgres.readthedocs.org/
158 stars 25 forks source link

Payload string too long (trigger) #56

Open OlivierNguyen opened 8 years ago

OlivierNguyen commented 8 years ago

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 commented 8 years ago

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