Igor, you are absolutely right.

But....

I will use this table as a manager. There will be multiple columns holding 
various file names. The names can be random, but I want humans to be able to 
easily inspect. After table is filled, an operation "for each row"  will get 
files in some columns and produce files in other columns. This is done outside 
of SQLite. "For each row" will process several rows in parallel because they 
are independent. Some operations might fail and will be recored in the proper 
columns. After all the work is done, the manager table is discarded.

"For each row" is equivalent to SELECT, but it operates on the files 
themselves. This can be implemented within SQLIte by loading extension. I 
investigated this route (and even asked questions on this list) and eventually 
concluded that it is better to do outside because of the way parallel execution 
is done (sometimes sent to a compute cluster grid engine for queueing.) 

This makes no sense from the database point of view: No reason to hold 
redundant data with such a simple algorithm to generate it.


Roman

________________________________________
From: sqlite-users [sqlite-users-boun...@mailinglists.sqlite.org] on behalf of 
Igor Tandetnik [i...@tandetnik.org]
Sent: Friday, January 26, 2018 5:33 PM
To: sqlite-users@mailinglists.sqlite.org
Subject: Re: [sqlite] primary key in another column

On 1/26/2018 4:43 PM, Roman Fleysher wrote:
> I would like to use primary key as a way to create unique column entry:
>
> CREATE TABLE A( id INTEGER PRIMARY KEY, fileName TEXT NOT NULL)
>
> such that file name is always prefix followed by the ID for the content to be:
>
> ID  fileName
>
> 1   prefix_1
> 2   prefix_2

Why do you want to store redundant data? What's the actual problem this is 
supposed to help you solve? As stated, this looks like an XY problem ( 
http://xyproblem.info/ )

--
Igor Tandetnik

_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to