Re: [SPAM]-D] [SQL] How to find broken UTF-8 characters ?

2010-04-26 Thread silly sad

On 04/26/10 04:12, Andreas wrote:


Excel files

> pgAdmin
> Access.

looks like a complete offtopic


How can I find those broken UTF-8 characters?
How can I get rid of them?


iconv -c

BUT
u should not have those characters at all
if one is occured it most probably an error

AND
u should get rid of this error itself --
not of its consequences.



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


Re: [SPAM]-D] [SQL] How to find broken UTF-8 characters ?

2010-04-26 Thread Andreas

Am 26.04.2010 12:12, schrieb silly sad:

On 04/26/10 04:12, Andreas wrote:

looks like a complete offtopic

Not anymore. The bad signs are in the DB now.

I'd need some command that filters somehow for inconvertible 
(Unicode-->local charset) data.

How can I find those Unicode characters that allready sneaked in?

Actually there shouldn't be anything within the tables that NEED to be 
coded in Unicode.


something like
SELECT * FROM tab_1 WHERE  field_x <>  ConvertToLocal(field_x)
might be a good start.



How can I get rid of them?

iconv -c
AFAIK iconv would translate on file system level but I would think that 
messed up a allready messed up Excel workmap even further.

I'd be glad to handle csv, too.


BUT
u should not have those characters at all
if one is occured it most probably an error


Sure, but those files hit me over a chain of people who consider it ok 
to convert data over numerus file formats, cut, edit, save as X, send 
per mail  then hit me and I am the one to clean up.




AND
u should get rid of this error itself -- not of its consequences.

Like quitting the job and grow flowers instead?
I'll consider this.   ;)


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


Re: [SPAM]-D] Re: [SPAM]-D] [SQL] How to find broken UTF-8 characters ?

2010-04-26 Thread silly sad

How can I get rid of them?

iconv -c

AFAIK iconv would translate on file system level but I would think that
messed up a allready messed up Excel workmap even further.
I'd be glad to handle csv, too.


pg_dump | iconv -c | psql

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


Re: [SQL] count function alternative in postgres

2010-04-26 Thread junaidmalik14

Thanks tkellerer.
Junaid

tkellerer wrote:
> 
> junaidmalik14 wrote on 03.04.2010 14:58:
>>
>> Is there any alternative of mysql function COUNT(DISTINCT expr,[expr...])
>> in
>> postgres. We get error if we
>>
>> write count like this count(distinct profile.id, profile.name,
>> profile.age)
>> but it works well in mysql.
>>
>> Reference url is given below
>>
>> http://dev.mysql.com/doc/refman/5.1/en/group-by-functions.html#function_count-distinct
>>
>> Thanks
> 
> Your question has been answered several times already (including this
> list)
> 
> http://archives.postgresql.org/pgsql-hackers/2010-04/msg00182.php
> http://archives.postgresql.org/pgsql-hackers/2010-04/msg00179.php
> http://forums.devshed.com/postgresql-help-21/count-function-alternative-in-postgres-691450.html
> http://www.dbforums.com/postgresql/1655165-count-function-alternative-postgres.html
> 
> 
> 
> -- 
> Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-sql
> 
> 

-- 
View this message in context: 
http://old.nabble.com/count-function-alternative-in-postgres-tp28126792p28339789.html
Sent from the PostgreSQL - sql mailing list archive at Nabble.com.


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


Re: [SQL] count function alternative in postgres

2010-04-26 Thread junaidmalik14

Thanks Ben. It works fine.

Junaid.


Ben Morrow-2 wrote:
> 
> Quoth junaidmali...@gmail.com (junaidmalik14):
>> 
>> Is there any alternative of mysql function COUNT(DISTINCT expr,[expr...])
>> in
>> postgres. We get error if we 
>> 
>> write count like this count(distinct profile.id, profile.name,
>> profile.age)
>> but it works well in mysql.
> 
> Pg does support COUNT(DISTINCT ), but only for a single column. The best
> I can come up with for multiple columns is
> 
> select count(distinct profile.tuple) from
> (select (id, name, age) as tuple from profile)
> as profile;
> 
> or alternatively
> 
> select count(*) from
> (select distinct (id, name, age) as tuple from profile)
> as profile;
> 
> Ben
> 
> 
> -- 
> Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-sql
> 
> 

-- 
View this message in context: 
http://old.nabble.com/count-function-alternative-in-postgres-tp28126792p28339793.html
Sent from the PostgreSQL - sql mailing list archive at Nabble.com.


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