How to compare character varying (varcar) to UUID in PostgreSQL? The Next CEO of Stack OverflowPostgreSQL “DESCRIBE TABLE”Show tables in PostgreSQLHow can I drop all the tables in a PostgreSQL database?PostgreSQL: Difference between text and varchar (character varying)How to start PostgreSQL server on Mac OS X?How to exit from PostgreSQL command line utility: psqlWhich version of PostgreSQL am I running?Polymorphic Association On UUID and Integer Fieldserror on altering table column type in postgresql - bigint to character varyingHow to use the IN operator with uuid - Django?

Missile strike detection (but it's not actually a missile)

Help understanding this unsettling image of Titan, Epimetheus, and Saturn's rings?

How did people program for Consoles with multiple CPUs?

Can MTA send mail via a relay without being told so?

How do I align (1) and (2)?

Rotate a column

Make solar eclipses exceedingly rare, but still have new moons

Powershell. How to parse gci Name?

Find non-case sensitive string in a mixed list of elements?

How to count occurrences of text in a file?

Easy to read palindrome checker

Chain wire methods together in Lightning Web Components

Why isn't the Mueller report being released completely and unredacted?

What flight has the highest ratio of time difference to flight time?

How to invert MapIndexed on a ragged structure? How to construct a tree from rules?

Which one is the true statement?

Where do students learn to solve polynomial equations these days?

Math-accent symbol over parentheses enclosing accented symbol (amsmath)

Running a General Election and the European Elections together

How to check if all elements of 1 list are in the *same quantity* and in any order, in the list2?

Do I need to write [sic] when a number is less than 10 but isn't written out?

Domestic-to-international connection at Orlando (MCO)

Proper way to express "He disappeared them"

Is it professional to write unrelated content in an almost-empty email?



How to compare character varying (varcar) to UUID in PostgreSQL?



The Next CEO of Stack OverflowPostgreSQL “DESCRIBE TABLE”Show tables in PostgreSQLHow can I drop all the tables in a PostgreSQL database?PostgreSQL: Difference between text and varchar (character varying)How to start PostgreSQL server on Mac OS X?How to exit from PostgreSQL command line utility: psqlWhich version of PostgreSQL am I running?Polymorphic Association On UUID and Integer Fieldserror on altering table column type in postgresql - bigint to character varyingHow to use the IN operator with uuid - Django?










1















Operator does not exist: character varying = uuid



Client id is UUId and should be why it is not working.



Where I am wrong, since I have tried almost everything I imagined.



SELECT * FROM "cobranca_assinatura"
INNER JOIN "cadastro_cliente" ON ("cobranca_assinatura"."cliente_id" = "cadastro_cliente"."id")
WHERE "cadastro_cliente"."nome" LIKE marcelo% ESCAPE ''



[2019-03-21 14:40:34] [42883] ERROR: operator does not exist:
character varying = uuid [2019-03-21 14:40:34]
Dica: No operator
matches the given name and argument type(s). You might need to add
explicit type casts.











share|improve this question
























  • What are the data types of "cadastro_cliente"."id"? and "cobranca_assinatura"."cliente_id"?

    – Tamer Shlash
    Mar 21 at 17:57












  • Tamer. Is uuid.

    – marcelo.delta
    Mar 21 at 17:57











  • "cobranca_assinatura"."cliente_id" is Varchar

    – marcelo.delta
    Mar 21 at 17:59











  • That's it, and the error is self-explanatory. You are comparing two different data types, must cast one type to the other before comparing.

    – Tamer Shlash
    Mar 21 at 18:02











  • thank you Tamer.

    – marcelo.delta
    Mar 21 at 18:09















1















Operator does not exist: character varying = uuid



Client id is UUId and should be why it is not working.



Where I am wrong, since I have tried almost everything I imagined.



SELECT * FROM "cobranca_assinatura"
INNER JOIN "cadastro_cliente" ON ("cobranca_assinatura"."cliente_id" = "cadastro_cliente"."id")
WHERE "cadastro_cliente"."nome" LIKE marcelo% ESCAPE ''



[2019-03-21 14:40:34] [42883] ERROR: operator does not exist:
character varying = uuid [2019-03-21 14:40:34]
Dica: No operator
matches the given name and argument type(s). You might need to add
explicit type casts.











share|improve this question
























  • What are the data types of "cadastro_cliente"."id"? and "cobranca_assinatura"."cliente_id"?

    – Tamer Shlash
    Mar 21 at 17:57












  • Tamer. Is uuid.

    – marcelo.delta
    Mar 21 at 17:57











  • "cobranca_assinatura"."cliente_id" is Varchar

    – marcelo.delta
    Mar 21 at 17:59











  • That's it, and the error is self-explanatory. You are comparing two different data types, must cast one type to the other before comparing.

    – Tamer Shlash
    Mar 21 at 18:02











  • thank you Tamer.

    – marcelo.delta
    Mar 21 at 18:09













1












1








1








Operator does not exist: character varying = uuid



Client id is UUId and should be why it is not working.



Where I am wrong, since I have tried almost everything I imagined.



SELECT * FROM "cobranca_assinatura"
INNER JOIN "cadastro_cliente" ON ("cobranca_assinatura"."cliente_id" = "cadastro_cliente"."id")
WHERE "cadastro_cliente"."nome" LIKE marcelo% ESCAPE ''



[2019-03-21 14:40:34] [42883] ERROR: operator does not exist:
character varying = uuid [2019-03-21 14:40:34]
Dica: No operator
matches the given name and argument type(s). You might need to add
explicit type casts.











share|improve this question
















Operator does not exist: character varying = uuid



Client id is UUId and should be why it is not working.



Where I am wrong, since I have tried almost everything I imagined.



SELECT * FROM "cobranca_assinatura"
INNER JOIN "cadastro_cliente" ON ("cobranca_assinatura"."cliente_id" = "cadastro_cliente"."id")
WHERE "cadastro_cliente"."nome" LIKE marcelo% ESCAPE ''



[2019-03-21 14:40:34] [42883] ERROR: operator does not exist:
character varying = uuid [2019-03-21 14:40:34]
Dica: No operator
matches the given name and argument type(s). You might need to add
explicit type casts.








postgresql






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 21 at 18:03









Tamer Shlash

7,13833268




7,13833268










asked Mar 21 at 17:47









marcelo.deltamarcelo.delta

5021524




5021524












  • What are the data types of "cadastro_cliente"."id"? and "cobranca_assinatura"."cliente_id"?

    – Tamer Shlash
    Mar 21 at 17:57












  • Tamer. Is uuid.

    – marcelo.delta
    Mar 21 at 17:57











  • "cobranca_assinatura"."cliente_id" is Varchar

    – marcelo.delta
    Mar 21 at 17:59











  • That's it, and the error is self-explanatory. You are comparing two different data types, must cast one type to the other before comparing.

    – Tamer Shlash
    Mar 21 at 18:02











  • thank you Tamer.

    – marcelo.delta
    Mar 21 at 18:09

















  • What are the data types of "cadastro_cliente"."id"? and "cobranca_assinatura"."cliente_id"?

    – Tamer Shlash
    Mar 21 at 17:57












  • Tamer. Is uuid.

    – marcelo.delta
    Mar 21 at 17:57











  • "cobranca_assinatura"."cliente_id" is Varchar

    – marcelo.delta
    Mar 21 at 17:59











  • That's it, and the error is self-explanatory. You are comparing two different data types, must cast one type to the other before comparing.

    – Tamer Shlash
    Mar 21 at 18:02











  • thank you Tamer.

    – marcelo.delta
    Mar 21 at 18:09
















What are the data types of "cadastro_cliente"."id"? and "cobranca_assinatura"."cliente_id"?

– Tamer Shlash
Mar 21 at 17:57






What are the data types of "cadastro_cliente"."id"? and "cobranca_assinatura"."cliente_id"?

– Tamer Shlash
Mar 21 at 17:57














Tamer. Is uuid.

– marcelo.delta
Mar 21 at 17:57





Tamer. Is uuid.

– marcelo.delta
Mar 21 at 17:57













"cobranca_assinatura"."cliente_id" is Varchar

– marcelo.delta
Mar 21 at 17:59





"cobranca_assinatura"."cliente_id" is Varchar

– marcelo.delta
Mar 21 at 17:59













That's it, and the error is self-explanatory. You are comparing two different data types, must cast one type to the other before comparing.

– Tamer Shlash
Mar 21 at 18:02





That's it, and the error is self-explanatory. You are comparing two different data types, must cast one type to the other before comparing.

– Tamer Shlash
Mar 21 at 18:02













thank you Tamer.

– marcelo.delta
Mar 21 at 18:09





thank you Tamer.

– marcelo.delta
Mar 21 at 18:09












1 Answer
1






active

oldest

votes


















1














uuid is a specific datatype. To you it looks like text, but it's not. You cannot compare uuid using string functions (uuid like "abc%"), or compare it with text.



As Tamer suggests, you can cast it first, if you need to compare.



SELECT * 
FROM (SELECT 'A0EEBC99-9C0B-4EF8-BB6D-6BB9BD380A11'::uuid as my_uuid) foo
WHERE my_uuid::text like 'a%'


For example, above I create a uuid by casting a string to uuid type. (You'll fail if you attempt to case just any old string to uuid because 'abc' cannot be a uuid).



Then with a uuid item called 'my_uuid', I cast to back to a string to use string comparison. (Note the 'A' becomes 'a'!)






share|improve this answer

























  • Showing how to cast it for comparing would make this a proper answer.

    – Tamer Shlash
    Mar 21 at 18:06











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55286397%2fhow-to-compare-character-varying-varcar-to-uuid-in-postgresql%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









1














uuid is a specific datatype. To you it looks like text, but it's not. You cannot compare uuid using string functions (uuid like "abc%"), or compare it with text.



As Tamer suggests, you can cast it first, if you need to compare.



SELECT * 
FROM (SELECT 'A0EEBC99-9C0B-4EF8-BB6D-6BB9BD380A11'::uuid as my_uuid) foo
WHERE my_uuid::text like 'a%'


For example, above I create a uuid by casting a string to uuid type. (You'll fail if you attempt to case just any old string to uuid because 'abc' cannot be a uuid).



Then with a uuid item called 'my_uuid', I cast to back to a string to use string comparison. (Note the 'A' becomes 'a'!)






share|improve this answer

























  • Showing how to cast it for comparing would make this a proper answer.

    – Tamer Shlash
    Mar 21 at 18:06















1














uuid is a specific datatype. To you it looks like text, but it's not. You cannot compare uuid using string functions (uuid like "abc%"), or compare it with text.



As Tamer suggests, you can cast it first, if you need to compare.



SELECT * 
FROM (SELECT 'A0EEBC99-9C0B-4EF8-BB6D-6BB9BD380A11'::uuid as my_uuid) foo
WHERE my_uuid::text like 'a%'


For example, above I create a uuid by casting a string to uuid type. (You'll fail if you attempt to case just any old string to uuid because 'abc' cannot be a uuid).



Then with a uuid item called 'my_uuid', I cast to back to a string to use string comparison. (Note the 'A' becomes 'a'!)






share|improve this answer

























  • Showing how to cast it for comparing would make this a proper answer.

    – Tamer Shlash
    Mar 21 at 18:06













1












1








1







uuid is a specific datatype. To you it looks like text, but it's not. You cannot compare uuid using string functions (uuid like "abc%"), or compare it with text.



As Tamer suggests, you can cast it first, if you need to compare.



SELECT * 
FROM (SELECT 'A0EEBC99-9C0B-4EF8-BB6D-6BB9BD380A11'::uuid as my_uuid) foo
WHERE my_uuid::text like 'a%'


For example, above I create a uuid by casting a string to uuid type. (You'll fail if you attempt to case just any old string to uuid because 'abc' cannot be a uuid).



Then with a uuid item called 'my_uuid', I cast to back to a string to use string comparison. (Note the 'A' becomes 'a'!)






share|improve this answer















uuid is a specific datatype. To you it looks like text, but it's not. You cannot compare uuid using string functions (uuid like "abc%"), or compare it with text.



As Tamer suggests, you can cast it first, if you need to compare.



SELECT * 
FROM (SELECT 'A0EEBC99-9C0B-4EF8-BB6D-6BB9BD380A11'::uuid as my_uuid) foo
WHERE my_uuid::text like 'a%'


For example, above I create a uuid by casting a string to uuid type. (You'll fail if you attempt to case just any old string to uuid because 'abc' cannot be a uuid).



Then with a uuid item called 'my_uuid', I cast to back to a string to use string comparison. (Note the 'A' becomes 'a'!)







share|improve this answer














share|improve this answer



share|improve this answer








edited Mar 21 at 18:14

























answered Mar 21 at 18:04









pbuckpbuck

2,55821422




2,55821422












  • Showing how to cast it for comparing would make this a proper answer.

    – Tamer Shlash
    Mar 21 at 18:06

















  • Showing how to cast it for comparing would make this a proper answer.

    – Tamer Shlash
    Mar 21 at 18:06
















Showing how to cast it for comparing would make this a proper answer.

– Tamer Shlash
Mar 21 at 18:06





Showing how to cast it for comparing would make this a proper answer.

– Tamer Shlash
Mar 21 at 18:06



















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55286397%2fhow-to-compare-character-varying-varcar-to-uuid-in-postgresql%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현