Thread: ERROR: collation "latin1_general_ci" for encoding "UTF8" does not exist

I have started writting query since a day on postGreS my query is :

    CREATE TABLE IF NOT EXISTS utilisateurs (
      SEQU_NK   SERIAL PRIMARY KEY NOT NULL UNIQUE,
      UTILISATEUR_NK bigint NOT NULL,
      NOM varchar(25) COLLATE latin1_general_ci NOT NULL DEFAULT '',
      PASSE varchar(40) COLLATE latin1_general_ci NOT NULL ,
      RACCOURCI varchar(5) COLLATE latin1_general_ci NOT NULL,
      DROITS varchar(4) COLLATE latin1_general_ci NOT NULL DEFAULT '....' ,

       CONSTRAINT   UTILISATEUR_NK UNIQUE (UTILISATEUR_NK,NOM)
    ) ;
    COMMENT ON COLUMN utilisateurs.PASSE IS 'md5';
    COMMENT ON COLUMN utilisateurs.DROITS IS 'ceps';

And the error is :

    ERROR:  collation "latin1_general_ci" for encoding "UTF8" does not exist
    LINE 4:   NOM varchar(25) COLLATE latin1_general_ci NOT NULL DEFAULT...
                              ^
    ********** Error **********

    ERROR: collation "latin1_general_ci" for encoding "UTF8" does not exist
    SQL state: 42704
    Character: 143

Could some one please help me ?



--
View this message in context:
http://postgresql.nabble.com/ERROR-collation-latin1-general-ci-for-encoding-UTF8-does-not-exist-tp5863581.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.


Re: ERROR: collation "latin1_general_ci" for encoding "UTF8" does not exist

From
Adrian Klaver
Date:
On 08/27/2015 06:47 AM, ss wrote:
> I have started writting query since a day on postGreS my query is :
>
>      CREATE TABLE IF NOT EXISTS utilisateurs (
>        SEQU_NK   SERIAL PRIMARY KEY NOT NULL UNIQUE,
>        UTILISATEUR_NK bigint NOT NULL,
>        NOM varchar(25) COLLATE latin1_general_ci NOT NULL DEFAULT '',
>        PASSE varchar(40) COLLATE latin1_general_ci NOT NULL ,
>        RACCOURCI varchar(5) COLLATE latin1_general_ci NOT NULL,
>        DROITS varchar(4) COLLATE latin1_general_ci NOT NULL DEFAULT '....' ,
>
>         CONSTRAINT   UTILISATEUR_NK UNIQUE (UTILISATEUR_NK,NOM)
>      ) ;
>      COMMENT ON COLUMN utilisateurs.PASSE IS 'md5';
>      COMMENT ON COLUMN utilisateurs.DROITS IS 'ceps';
>
> And the error is :
>
>      ERROR:  collation "latin1_general_ci" for encoding "UTF8" does not exist
>      LINE 4:   NOM varchar(25) COLLATE latin1_general_ci NOT NULL DEFAULT...
>                                ^
>      ********** Error **********
>
>      ERROR: collation "latin1_general_ci" for encoding "UTF8" does not exist
>      SQL state: 42704
>      Character: 143
>
> Could some one please help me ?

 From what I can find latin1_general_ci is a MySQL collation:

https://dev.mysql.com/doc/refman/5.1/en/charset-mysql.html

so on that alone I would not expect it to work.

What sort of collation are you trying to achieve?

>
>
>
> --
> View this message in context:
http://postgresql.nabble.com/ERROR-collation-latin1-general-ci-for-encoding-UTF8-does-not-exist-tp5863581.html
> Sent from the PostgreSQL - general mailing list archive at Nabble.com.
>
>


--
Adrian Klaver
adrian.klaver@aklaver.com


Thanks for the reply Adrian. I have been given mysql schema and i have to create table using postgres..this is the information I have. Could u still help me ? If not then please let me know precisely  that what should I ask the task giver in order to make you understand the question? (If I am right then collation is used to sort the data) ..may be he mean sorting the data on alphabetical order or something similar

On Aug 27, 2015 11:00 PM, "Adrian Klaver-4 [via PostgreSQL]" <[hidden email]> wrote:
On 08/27/2015 06:47 AM, ss wrote:

> I have started writting query since a day on postGreS my query is :
>
>      CREATE TABLE IF NOT EXISTS utilisateurs (
>        SEQU_NK   SERIAL PRIMARY KEY NOT NULL UNIQUE,
>        UTILISATEUR_NK bigint NOT NULL,
>        NOM varchar(25) COLLATE latin1_general_ci NOT NULL DEFAULT '',
>        PASSE varchar(40) COLLATE latin1_general_ci NOT NULL ,
>        RACCOURCI varchar(5) COLLATE latin1_general_ci NOT NULL,
>        DROITS varchar(4) COLLATE latin1_general_ci NOT NULL DEFAULT '....' ,
>
>         CONSTRAINT   UTILISATEUR_NK UNIQUE (UTILISATEUR_NK,NOM)
>      ) ;
>      COMMENT ON COLUMN utilisateurs.PASSE IS 'md5';
>      COMMENT ON COLUMN utilisateurs.DROITS IS 'ceps';
>
> And the error is :
>
>      ERROR:  collation "latin1_general_ci" for encoding "UTF8" does not exist
>      LINE 4:   NOM varchar(25) COLLATE latin1_general_ci NOT NULL DEFAULT...
>                                ^
>      ********** Error **********
>
>      ERROR: collation "latin1_general_ci" for encoding "UTF8" does not exist
>      SQL state: 42704
>      Character: 143
>
> Could some one please help me ?
 From what I can find latin1_general_ci is a MySQL collation:

https://dev.mysql.com/doc/refman/5.1/en/charset-mysql.html

so on that alone I would not expect it to work.

What sort of collation are you trying to achieve?

>
>
>
> --
> View this message in context: http://postgresql.nabble.com/ERROR-collation-latin1-general-ci-for-encoding-UTF8-does-not-exist-tp5863581.html
> Sent from the PostgreSQL - general mailing list archive at Nabble.com.
>
>


--
Adrian Klaver
[hidden email]


--
Sent via pgsql-general mailing list ([hidden email])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general



If you reply to this email, your message will be added to the discussion below:
http://postgresql.nabble.com/ERROR-collation-latin1-general-ci-for-encoding-UTF8-does-not-exist-tp5863581p5863613.html
To start a new topic under PostgreSQL - general, email [hidden email]
To unsubscribe from ERROR: collation "latin1_general_ci" for encoding "UTF8" does not exist, click here.
NAML


View this message in context: Re: ERROR: collation "latin1_general_ci" for encoding "UTF8" does not exist
Sent from the PostgreSQL - general mailing list archive at Nabble.com.

Re: Re: ERROR: collation "latin1_general_ci" for encoding "UTF8" does not exist

From
Adrian Klaver
Date:
On 08/27/2015 10:51 AM, ss wrote:
> Thanks for the reply Adrian. I have been given mysql schema and i have
> to create table using postgres..this is the information I have. Could u
> still help me ? If not then please let me know precisely  that what
> should I ask the task giver in order to make you understand the
> question? (If I am right then collation is used to sort the data) ..may
> be he mean sorting the data on alphabetical order or something similar
>

Well without knowing what the desired end result is, it is hard to
suggest a solution. I can point you at the localization/character
support section of the documentation so you can see how Postgres handles
this:

http://www.postgresql.org/docs/9.4/interactive/charset.html

As to specific questions:

1) What language do they want the data to be collated in?

2) What is the result that is desired?

3) Using psql and doing \l what does it show for the database(s) you are
working with?


--
Adrian Klaver
adrian.klaver@aklaver.com