Lists: | pgsql-fr-generale |
---|
From: | Jean-Michel <jm130794(at)gmail(dot)com> |
---|---|
To: | pgsql-fr-generale(at)postgresql(dot)org |
Subject: | Question bête |
Date: | 2013-01-07 16:46:51 |
Message-ID: | 50EAFBFB.2030706@gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-fr-generale |
Bonjour à tous,
J'ai une question assez bête. Voici deux requêtes :
SELECT id from author where uuid ='82a2db11-55c2-2c04-8bdb-aba1fb'
SELECT id from author where uuid like '82a2db11-55c2-2c04-8bdb-aba1fb%'
La première ne retourne aucune ligne alors que la seconde me retourne la
ligne voulue...
Une petite idée ?
Merci,
JM
From: | Maxime Longuet <m(dot)longuet(at)itika(dot)net> |
---|---|
To: | "pgsql-fr-generale(at)postgresql(dot)org" <pgsql-fr-generale(at)postgresql(dot)org> |
Subject: | Re: [pgsql-fr-generale] Question bête |
Date: | 2013-01-07 16:49:03 |
Message-ID: | C6ECA90B-BACC-4DAD-B762-EC0FFC72B525@itika.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-fr-generale |
Un espace ou un autre caractére non visible dans le champ uuid à la fin de 82a2db11-55c2-2c04-8bdb-aba1fb
Le 7 janv. 2013 à 17:46, Jean-Michel <jm130794(at)gmail(dot)com> a écrit :
> Bonjour à tous,
>
> J'ai une question assez bête. Voici deux requêtes :
>
> SELECT id from author where uuid ='82a2db11-55c2-2c04-8bdb-aba1fb'
> SELECT id from author where uuid like '82a2db11-55c2-2c04-8bdb-aba1fb%'
>
> La première ne retourne aucune ligne alors que la seconde me retourne la ligne voulue...
>
> Une petite idée ?
>
> Merci,
>
> JM
>
>
> --
> Sent via pgsql-fr-generale mailing list (pgsql-fr-generale(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-fr-generale
From: | Christophe GARAULT <christophe(at)garault(dot)org> |
---|---|
To: | <pgsql-fr-generale(at)postgresql(dot)org> |
Subject: | Re: Question bête |
Date: | 2013-01-07 17:03:55 |
Message-ID: | 8f23bd64c7af272b2ebfd13cb44860d8@webmail.garault.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-fr-generale |
Le 2013-01-07 17:46, Jean-Michel a écrit :
> Bonjour à tous,
>
> J'ai une question assez bête. Voici deux requêtes :
>
> SELECT id from author where uuid ='82a2db11-55c2-2c04-8bdb-aba1fb'
> SELECT id from author where uuid like
> '82a2db11-55c2-2c04-8bdb-aba1fb%'
>
> La première ne retourne aucune ligne alors que la seconde me retourne
> la ligne voulue...
>
> Une petite idée ?
>
> Merci,
>
> JM
C'est une colonne de type uuid ou varchar ?
Dans le second cas peut-être un petit TRIM ?
http://www.postgresql.org/docs/9.1/static/functions-string.html
PS: les seules questions bêtes sont celles qui n'ont pas été posées...
;)
From: | Dimitri Fontaine <dimitri(at)2ndQuadrant(dot)fr> |
---|---|
To: | Jean-Michel <jm130794(at)gmail(dot)com> |
Cc: | pgsql-fr-generale(at)postgresql(dot)org |
Subject: | Re: Question bête |
Date: | 2013-01-07 18:00:28 |
Message-ID: | m2vcb8kh4z.fsf@2ndQuadrant.fr |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-fr-generale |
Jean-Michel <jm130794(at)gmail(dot)com> writes:
> SELECT id from author where uuid ='82a2db11-55c2-2c04-8bdb-aba1fb'
> SELECT id from author where uuid like '82a2db11-55c2-2c04-8bdb-aba1fb%'
On peut avoir les EXPLAIN ANALYZE des deux requêtes ? Ça peut être un
index corrompu, dans le pire des cas.
--
Dimitri Fontaine
http://2ndQuadrant.fr PostgreSQL : Expertise, Formation et Support
From: | Jean-Michel Choulet <jm130794(at)gmail(dot)com> |
---|---|
To: | pgsql-fr-generale(at)postgresql(dot)org |
Subject: | Re: [pgsql-fr-generale] Re: [pgsql-fr-generale] Question bête |
Date: | 2013-01-07 19:36:13 |
Message-ID: | 50EB23AD.4000000@gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-fr-generale |
Le 07/01/2013 17:49, Maxime Longuet a écrit :
> Un espace ou un autre caractére non visible dans le champ uuid à la fin de 82a2db11-55c2-2c04-8bdb-aba1fb
>
>
>
> Le 7 janv. 2013 à 17:46, Jean-Michel <jm130794(at)gmail(dot)com> a écrit :
>
>> Bonjour à tous,
>>
>> J'ai une question assez bête. Voici deux requêtes :
>>
>> SELECT id from author where uuid ='82a2db11-55c2-2c04-8bdb-aba1fb'
>> SELECT id from author where uuid like '82a2db11-55c2-2c04-8bdb-aba1fb%'
>>
>> La première ne retourne aucune ligne alors que la seconde me retourne la ligne voulue...
>>
>> Une petite idée ?
>>
>> Merci,
>>
>> JM
>>
>>
>> --
>> Sent via pgsql-fr-generale mailing list (pgsql-fr-generale(at)postgresql(dot)org)
>> To make changes to your subscription:
>> http://www.postgresql.org/mailpref/pgsql-fr-generale
>
>
Bonsoir à tous,
Merci pour tous vos conseils. Effectivement, il y avait des caractères
indésirables à la fin. Plus précisément le retour à la ligne version
Windows : \r\n.
Un trim ne suffisait donc pas. Un petit bout de code Perl a réglé tout
ça :)
s/\R//g;
Merci,
Jean-Michel