[SQL] LTREE extension and "order by"

2011-07-20 Thread Ivan Polak
Hi, in postgreSQL (with LTREE extension) database I have the following table "comments": id BIGINT /* id */ article_id BIGINT /*article-id */ parent_id BIGINT comment TEXT path LTREE level INTEGER /* level */ with the following rows: id article_id comment parent_id path level 1 1 1 1 2 1 b

Re: [SQL] LTREE extension and "order by"

2011-07-21 Thread Ivan Polak
Hi, thank you for your answer, please can You send me complete select command how to convert ltree column to integer[] and use it to order by. thanks Ivan 2011/7/21 pasman pasmański : > Hi. > > You should convert path to integer[]. > > 2011/7/20, Ivan Polak : >> Hi, >

Re: [SQL] LTREE extension and "order by"

2011-07-21 Thread Ivan Polak
:text,'.')::integer[]; > > 2011/7/21 Ivan Polak >> >> Hi, thank you for your answer, please can You send me complete select >> command how to convert ltree column to integer[] and use it to order >> by. >> >> thanks >> >> Ivan >&

Re: [SQL] LTREE extension and "order by"

2011-07-21 Thread Ivan Polak
d = 2 order by > cast(string_to_array(ltree2text(path),'.') as integer[]); > > 2011/7/21 Ivan Polak >> >> hi, thank you, but there is error: >> >> ERROR:  cannot cast type ltree to text >> LINE 1: ... article_id = 2 order by string_to_array(path::tex