However, In PostgreSQL, there's only the CAST ( expression AS data_type [ ( length ) ] ) function. I have tried the following two ways to implenting the CONVERT ( data_type [ ( length ) ] , expression ) function, but both are failed.
1. CREATE FUNCTION .....
The function's arguments can only be expressions but not data_type .
2. Modifying the gram.y .....
The CONVERT ( data_type [ ( length ) ] , expression ) is in grammer conflict with the PostgreSQL self's convert(data,src_encoding_name,dest_encoding_name) function. And the PostgreSQL self's convert(data,src_encoding_name,dest_encoding_name) function cannot be used.
I wonder whether there's a better way to solve this problem.
Any help will be appreciated.
Please do not cross post to multiple lists.
Please do not cross post to various lists.
For the options you suggested:
1) Pass in datatype as string and deparse and process in the function.