Dear Postgres Folk,
In working with tsvectors (added in 8.3), I've come to a place where
my syntax-fu has failed me. I've resorted to turning a result set of
records into strings so that I can regexp out the record fields I
need, rather than access them directly, as I'm sure it's possible
try
select * from ts_stat()
btw, performance of ts_stat() was greatly improved in 8.4.
Oleg
On Tue, 9 Dec 2008, Dan Chak wrote:
Dear Postgres Folk,
In working with tsvectors (added in 8.3), I've come to a place where my
syntax-fu has failed me. I've resorted to turning a result set of
Dan Chak [EMAIL PROTECTED] writes:
If I say stat.word (instead of subscripting), I get 'missing FROM-
clause entry for table stat'. If I say foo.stat.word, I get
'ERROR: schema foo does not exist'.
I think the syntax you need is (stat).word etc. See Field Selection
here:
Oleg,
This syntax works fine until I also want to get the sentence_id
column in there as well, so that I can differentiate one set of
ts_stat results from another. With the syntax where ts_stat is
treated like a table, it isn't possible to run ts_stat separately on
multiple tsvectors as
That works perfectly!
Thanks,
Dan
On Dec 9, 2008, at 3:13 PM, Tom Lane wrote:
Dan Chak [EMAIL PROTECTED] writes:
If I say stat.word (instead of subscripting), I get 'missing FROM-
clause entry for table stat'. If I say foo.stat.word, I get
'ERROR: schema foo does not exist'.
I think the
On Tue, 9 Dec 2008, Dan Chak wrote:
Oleg,
This syntax works fine until I also want to get the sentence_id column in
there as well, so that I can differentiate one set of ts_stat results from
another. With the syntax where ts_stat is treated like a table, it isn't
possible to run ts_stat
ok, here is a function ( credits to Teodor )
CREATE OR REPLACE FUNCTION ts_stat(tsvector, OUT word text, OUT ndoc
integer, OUT nentry integer)
RETURNS SETOF record AS
$$
SELECT ts_stat('SELECT ' || quote_literal( $1::text ) || '::tsvector');
$$ LANGUAGE SQL RETURNS NULL ON NULL INPUT