Hello, You can use function translate testdb011=# select translate('XY1X234X','qwertyuioplkjhgfdsazxcvbnmQWERTYUIOPLKJHGFDSAZXCVBNM',''); translate ----------- 1234 (1 row) Regards Pavel Stehule ---------------------------(end of broadcast)--------------------------- TIP 9: the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match