Bonjour
j'ai une requete a faire sur un type real et j'ai des résultats surprenants à mon gout mais je suis sur que vous avez une explication a mon péhnomène paranormal :
Ma table note contient un type real :
\d infos_note;
Table « public.infos_note »
Colonne | Type | Modificateurs
----------------+---------+--------------------------------------------------------------------
id_infos_note | integer |
note | real |
Mes requetes :
***** un chiffre non décimal => OK
SELECT * from infos_note where note=5;
id_infos_note | note
1467 | 5 |
***** un chiffre décimal => KO
SELECT * from infos_note where note=5.29;
(0 lignes)
ou alors
SELECT * from infos_note where note=5.1;
(0 lignes)
***** un chiffre décimal entouré de quote => OK
SELECT * from infos_note where note='5.29';
id_infos_note | note
1563 | 5.29
ou alors
SELECT * from infos_note where note='5.1';
id_infos_note | note
1506 | 5.1
***** un chiffre décimal avec .5 entouré de quote ou non => OK
SELECT * from infos_note where note=5.5;
id_infos_note | note
1470 | 5.5
SELECT * from infos_note where note='5.5';
id_infos_note | note
1470 | 5.5
Alors questions
:
pourquoi faut il des quotes sur des chiffres à virgules et pourquoi ca fonctionne sans quand c'est .5 ?
Merci de votre aide
Partager