Re: [ADMIN] invalid byte sequence for encoding UTF8: 0xf481 - how could this happen?

2012-04-17 Thread Albe Laurenz
Rural Hunter wrote:
 My db is in utf-8, I have a row in my table say tmp_article and I wanted
 to generate ts_vector from the article content:
 select to_tsvector(content) from tmp_article;
 But I got this error:
 ERROR:  invalid byte sequence for encoding UTF8: 0xf481

 Do you use any nonstandard text search parsers or dictionaries?
 What is the text search configuration you use (parameter
 default_text_search_config)?

 Yes, I'm using a Chinese tsearch2 plugin called nlpbamboo and the
 default default_text_search_config is 'chinesecfg'. I tested select
 to_tsvector('english',content) from tmp_article and this works. So it's
 the problem of nlpbamboo?

That's probably the problem - it seems to emit something that is
not proper UTF-8 sometimes.

Do you get the error if you try Chinese settings without nlpbamboo?

  btw, what's the meaning of Please don't top post.? I
 don't understand but sorry if I caused any problem.

http://en.wikipedia.org/wiki/Posting_style

Yours,
Laurenz Albe

-- 
Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin


Re: [ADMIN] Recreate primary key without dropping foreign keys?

2012-04-17 Thread Igor Neyman
 -Original Message-
 From: Chris Ernst [mailto:cer...@zvelo.com]
 Sent: Monday, April 16, 2012 10:55 PM
 To: pgsql-admin@postgresql.org
 Subject: Re: Recreate primary key without dropping foreign keys?
 
 On 04/16/2012 07:02 PM, amador alvarez wrote:
  How about deferring the FK's while recreating the PK ?
  or using a temporary parallel table to be pointed by the other tables
  (FK) and swap it up on the recreation.
 
 Hmm.. Interesting.   But it appears that you have to declare the
 foreign
 key as deferrable at creation.  Is there any way to set an existing
 foreign key as deferrable?
 
   - Chris

May be this (from the docs) would help:

ADD table_constraint [ NOT VALID ]

This form adds a new constraint to a table using the same syntax as CREATE 
TABLE, plus the option NOT VALID, which is currently only allowed for foreign 
key constraints. If the constraint is marked NOT VALID, the potentially-lengthy 
initial check to verify that all rows in the table satisfy the constraint is 
skipped. The constraint will still be enforced against subsequent inserts or 
updates (that is, they'll fail unless there is a matching row in the referenced 
table). But the database will not assume that the constraint holds for all rows 
in the table, until it is validated by using the VALIDATE CONSTRAINT option.

Using this option you can drop and recreate corresponding FKs in a very short 
time, and start using them, while postponing to run VALIDATE CONSTRAINT for 
later.

It's similar to Oracle's adding FK with NOCHECK option, but if IRC there is 
no need to run VALIDATE CONSTRAINT later.

Regards,
Igor Neyman

-- 
Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin


Re: [ADMIN] Recreate primary key without dropping foreign keys?

2012-04-17 Thread amador alvarez


Unfortunately I checked out that the deferrable option does not let us 
drop the PK (postgres8.4) while remaining FK's , I did not try on the 
constraint as NOT VALID  is not supported by postgres8.
So unless you have a 9 release or you get a try on a parallel table, you 
have to follow the manual procedure :


Generate new index
drop FK's
Drop PK
Recreate PK swiching to the new index
Recreate FK's

Can you afford a quick temporary user access to the database?




On 04/17/2012 06:43 AM, Igor Neyman wrote:

-Original Message-
From: Chris Ernst [mailto:cer...@zvelo.com]
Sent: Monday, April 16, 2012 10:55 PM
To: pgsql-admin@postgresql.org
Subject: Re: Recreate primary key without dropping foreign keys?

On 04/16/2012 07:02 PM, amador alvarez wrote:

How about deferring the FK's while recreating the PK ?
or using a temporary parallel table to be pointed by the other tables
(FK) and swap it up on the recreation.

Hmm.. Interesting.   But it appears that you have to declare the
foreign
key as deferrable at creation.  Is there any way to set an existing
foreign key as deferrable?

- Chris

May be this (from the docs) would help:

ADD table_constraint [ NOT VALID ]

 This form adds a new constraint to a table using the same syntax as CREATE 
TABLE, plus the option NOT VALID, which is currently only allowed for foreign key 
constraints. If the constraint is marked NOT VALID, the potentially-lengthy initial 
check to verify that all rows in the table satisfy the constraint is skipped. The 
constraint will still be enforced against subsequent inserts or updates (that is, 
they'll fail unless there is a matching row in the referenced table). But the 
database will not assume that the constraint holds for all rows in the table, until 
it is validated by using the VALIDATE CONSTRAINT option.

Using this option you can drop and recreate corresponding FKs in a very short time, and 
start using them, while postponing to run VALIDATE CONSTRAINT for later.

It's similar to Oracle's adding FK with NOCHECK option, but if IRC there is no need to 
run VALIDATE CONSTRAINT later.

Regards,
Igor Neyman



--
Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin