> On 25 Nov 2015, at 2:23pm, Domingo Alvarez Duarte
<sqlite-mail at dev.dadbiz.es> wrote:
>
>> This way we repeat the string everywhere then it's not DRY !
>
> You know, I think you're the first person to mention DRY here.  I had to
look it up.
>
> <https://en.wikipedia.org/wiki/Don%27t_repeat_yourself>
>
> For some reason it seems that under DRY repeating a string in lots of
places is bad,
> but repeating a number in lots of places is good.  I'm not sure about
the logic
> behind that.
>
> Okay, do this instead:
>
> CREATE TABLE enum_type (the_ID INTEGER PRIMARY KEY, the_value TEXT UNIQUE);
> INSERT INTO enum_type (the_value) VALUES ('simple'), ('tuple');
>
> CREATE TABLE use_mytype (...
>    ...
>    one_type TEXT REFERENCES enum_type(theID) DEFAULT 2
> )
>
> It is now harder to know which value to insert for one_type.
>
> Simon.

Thank you. I have been just about completed a plugin for my tool,
MyJSQLView, that will convert a PostgreSQL database query to a
SQLite table, then transfer the data to the newly created memory
or file database table.

I left out ENUM types as a possible data type since it is relatively
new to PostgreSQL, well a year or few perhaps.

That should work nicely.

danap.

Reply via email to