Thoughts on how to support UUID for Postgres?

74 views
Skip to first unread message

Chris Normand

unread,
Nov 11, 2019, 2:07:55 PM11/11/19
to dbfit
One of our tables contains a "uuid" column, and DbFit reports:

java.lang.UnsupportedOperationException: Type UUID is not supported

Do you think it would be "safe" to add "UUID" to the list of supported columns (in PostgresEnvironment.java) and treat it as a String?
(Since FitNesse is basically passing strings)

Andrew Sturza

unread,
Nov 11, 2019, 2:48:18 PM11/11/19
to db...@googlegroups.com
As you are suggesting, the probability for collision with UUID is increased when casting the binary object to a string.  However, a deeper issue may be at hand.  That is, Acceptance Testing or Behavior Driven Development main goal is to demonstrate the correctness of the software solution in terms that are acceptable to non technical audiences.  The solution I favor when dealing with UUID usage is to leave them out of the use cases and tests in favor of a Natural Key that will provide more meaningful insight into the business models being tested. 

This solves the problem and closes the communication gap. 

--
You received this message because you are subscribed to the Google Groups "dbfit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dbfit+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dbfit/d52e7f7d-6cc4-4f5f-87c9-cdfd67111ccf%40googlegroups.com.

Chris Normand

unread,
Nov 12, 2019, 8:46:19 AM11/12/19
to dbfit
This solves the problem

Unfortunately, it does not.   I agree with everything you said, and in fact, none of my tests reference the UUID column.   However, PostgresEnvironment throws "java.lang.UnsupportedOperationException: Type UUID is not supported", just by reading the meta-data of the table, even though I don't reference that column in the test.

So, I was wondering if I could update the PostgresEnvironment such that it would be able to "skip over" the UUID columns (by assuming they are Strings) without actually manipulating them. 

Chris Normand

unread,
Nov 12, 2019, 12:56:29 PM11/12/19
to dbfit
Following the "contributing" instructions, I downloaded and built the 4.0 snapshot.

In the dbfit.environment.PostgresEnvironment.java,

I changed the following line:
    private static List<String> stringTypes = Arrays.asList(new String[] {
           
"VARCHAR", "CHAR", "CHARACTER", "CHARACTER VARYING", "TEXT",
           
"NAME", "XML", "BPCHAR", "UNKNOWN" });


to
    private static List<String> stringTypes = Arrays.asList(new String[] {
           
"VARCHAR", "CHAR", "CHARACTER", "CHARACTER VARYING", "TEXT",
           
"NAME", "XML", "BPCHAR", "UNKNOWN", "UUID" });


And it allowed the test to run.  Which is the first hurdle.  ;-)

Mark Matten

unread,
Feb 25, 2020, 2:52:45 AM2/25/20
to dbfit
Would you consider creating a pull request, including some tests, against the github project ?

Mohamed Hussain

unread,
Aug 8, 2020, 1:16:04 PM8/8/20
to dbfit
Hi @Chris,

Is the fix working for you? Looks like we are in need of sample data. 

Can you help us? 

Thanks
Hussain

Reply all
Reply to author
Forward
0 new messages