postgres parse_indent() function hang select parse_ident('abc,efi&amp;xyz');


Will stay there for ever, not returning. But a similar command will finish.  

select regexp_split_to_array('abc,efi&amp;xyz', '[,&amp;]');
 regexp_split_to_array 
-----------------------
 {abc,efi,xyz}
(1 row)


Not sure what's wrong with my database.  I am running a vacuum full analyze at the moment. Not sure that cause the hang.
You're losing error messages,

# select parse_ident('abc,efi&amp;xyz');
ERROR:  string is not a valid identifier: "abc,efi&amp;xyz"


They also do different things:


parse_ident takes a string a fully-qualified identifier -- something you can use to identify a thing in a database, and returns the breakdown of it in an array. For example, if you had a column named abc,efi&amp;xyz on a table named table in a schema named schema in a database named db, you could do, 

SELECT parse_ident('"abc,efi&amp;xyz".table.schema.db');
           parse_ident           
---------------------------------
 {"abc,efi&amp;xyz",table,schema,db}
(1 row)


From this point you could use array addressing to identify the table, (parse_ident(...)[2]).
regexp_split_to_array takes any string and simply splits it returning an array. Unlike parse_ident it doesn't require a fully-qualified identifier, and it doesn't understand ANSI-quotes inside the identifier (as I used in my example above).