Hi, > >> 2) It seems like you have choosen wrong datatype for page_checksum. I >> am getting negative checksum value when trying to run below query. I >> think the return type for the SQL function page_checksum should be >> 'integer' instead of 'smallint'. >> >> postgres=# SELECT page_checksum(get_raw_page('pg_class', 0), 100); >> page_checksum >> --------------- >> -19532 >> (1 row) >> >> Above problem also exist in case of page_header. I am facing similar >> problem with page_header as well. >> >> postgres=# SELECT page_header(get_raw_page('pg_class', 0)); >> page_header >> --------------------------------------------- >> (0/2891538,-28949,1,220,7216,8192,8192,4,0) >> (1 row) >> > > No. This is consistent with page_header() which is also using smallint for > the checksum value. >
Yes. But, as i said earlier I am getting negative checksum value for page_header as well. Isn't that wrong. For eg. When I debug the following query, i could pd_checksum value as '40074' in gdb where page_header shows it as '-25462'. SELECT page_header(get_raw_page('pg_class', 0)); (gdb) p page->pd_checksum $2 = 40074 postgres=# SELECT page_header(get_raw_page('pg_class', 0)); page_header --------------------------------------------- (0/304EDE0,-25462,1,220,7432,8192,8192,4,0) (1 row) I think pd_checksum in PageHeaderData is defined as uint16 (0 to 65,535) whereas in SQL function for page_header it is defined as smallint (-32768 to +32767). -- With Regards, Ashutosh Sharma EnterpriseDB:http://www.enterprisedb.com -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers