मैं कुछ टूल्स को कनवर्ट करने की प्रक्रिया में हूं जो MySQL का उपयोग PostgreSQL पर कर रहे हैं। इसके साथ में, मैंने कई मुद्दों में भाग लिया है लेकिन अधिकांश चीज़ों को ढूंढने में सक्षम था। मुझे एक समस्या है जिसमें HEX()
और UNHEX()
है। मैंने encode(%s, 'hex')
और decode(%s, 'hex')
की कोशिश की है जो वास्तव में मुझे त्रुटियों का कारण बनने से रोकता है, लेकिन यह अभी भी चाल नहीं लग रहा था। क्या किसी को यह पता है कि पोस्टग्रेज़ में उन कार्यों के बराबर क्या होगा? यहाँMySQL के हेक्स() और यूएनएचएक्स() पोस्टग्रेज़ में समकक्ष?
SELECT HEX(test_table.hash),
title,
user,
reason,
description,
url,
performed,
comment,
authenticated,
status
FROM alerts
JOIN user_responses ON test_table.hash = user_responses.hash
JOIN test_status ON test_table.hash = test_status.hash
WHERE status = %s
और PostgreSQL प्रारूप में मेरी अद्यतन क्वेरी है:
यहाँ वर्ष MySQL क्वेरी है
SELECT encode(test_table.hash, 'hex') as hash,
title,
user,
reason,
description,
url,
performed,
comment,
authenticated,
status
FROM test_table
JOIN user_responses ON test_table.hash = user_responses.hash
JOIN test_status ON test_table.hash = test_status.hash
WHERE status = %s
धन्यवाद!