IQSS / dataverse

Open source research data repository software
http://dataverse.org
Other
876 stars 484 forks source link

CamelCase notation for PostgreSQL function name might cause confusion. #10842

Open lobbikerivm opened 5 days ago

lobbikerivm commented 5 days ago

https://github.com/IQSS/dataverse/blob/fbb215ac69b34fae63e0197e8d9d15b38d8424a9/doc/sphinx-guides/source/_static/util/createsequence.sql#L25

The actual function created by running this SQL statement is generateidentifierfromstoredprocedure(), without the CamelCase Capitals. If someone would for example manualy create a function with the CamelCase name it will not work, because PostgreSQL will add "" around the function name.

By the way, I used this functionality to get a PID with a random UUID4, by using the function like this:

CREATE OR REPLACE FUNCTION generateidentifierfromstoredprocedure() RETURNS varchar AS $$ DECLARE identifier varchar; BEGIN identifier := (select gen_random_uuid())::varchar; RETURN identifier; END; $$ LANGUAGE plpgsql IMMUTABLE;

which works nicely :)!

great job on the multiple PID providers!

Stefan

pdurbin commented 5 days ago

Interesting. It sounds like small amount of value we get in readability from the camelCase version don't justify the potential confusion you're pointing out. I don't have any objection to making it all lower case.