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

Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript