Greg Stark <gsstark@mit.edu> [2009-08-23 03:44]:
> 2009/8/22 Radoslaw Zielinski <radek@pld-linux.org>:
>> =C2=A0$ seq 11 | xargs -ti psql bug -c "select {}, (x).* from (select bt=
_page_items('promocje_pkey',{}) as x ) as y"
>> =C2=A0[...]
>> =C2=A0psql bug -c select 11, (x).* from (select bt_page_items('promocje_=
pkey',11) as x ) as y
>> =C2=A0ERROR: =C2=A0block number out of range
> Sorry, I forgot to adjust the index name in the example. We don't want
> the primary key index of your table we want the index of the toast
> table.
Sorry, I got confused by the index not being shown in \d pg_toast.pg_toast_=
29644.
> Try the same thing with bt_page_items('pg_toast.pg_toast_29644_index',...)
bug=3D# select * from bt_page_items('pg_toast.pg_toast_29644_index', 8) whe=
re data ~ 'a5 d7 01 00';
-[ RECORD 1 ]-----------------------
itemoffset | 121
ctid | (458,3)
itemlen | 16
nulls | f
vars | f
data | a5 d7 01 00 00 00 00 00
Full output, without the WHERE: http://radek.cc/promocje_bpi2.txt.gz
get_raw_page( 'pg_toast.pg_toast_29644', 458 ): http://radek.cc/toast_29644=
_page_458.txt
bug=3D# select * from heap_page_items( get_raw_page( 'pg_toast.pg_toast_296=
44', 458 ) );
lp | lp_off | lp_flags | lp_len | t_xmin | t_xmax | t_field3 | t_ctid | t=
_infomask2 | t_infomask | t_hoff | t_bits | t_oid=20
----+--------+----------+--------+--------+--------+----------+---------+--=
-----------+------------+--------+--------+-------
1 | 6156 | 1 | 2036 | 3816 | 0 | 1 | (458,1) | =
3 | 2306 | 24 | |=20=20=20=20=20=20
2 | 4176 | 1 | 1979 | 3816 | 0 | 1 | (458,2) | =
3 | 2306 | 24 | |=20=20=20=20=20=20
3 | 0 | 3 | 0 | | | | | =
| | | |=20=20=20=20=20=20
4 | 2140 | 1 | 2036 | 3823 | 0 | 0 | (458,4) | =
3 | 2306 | 24 | |=20=20=20=20=20=20
(4 rows)
bug=3D# select * from bt_page_stats('pg_toast.pg_toast_29644_index', 8);
-[ RECORD 1 ]-+-----
blkno | 8
type | l
live_items | 366
dead_items | 1
avg_item_size | 16
page_size | 8192
free_size | 808
btpo_prev | 7
btpo_next | 9
btpo | 0
btpo_flags | 65
--=20
Rados=C5=82aw Zieli=C5=84ski <radek@pld-linux.org>