Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 632478

Summary: Can't add foreign key
Product: Gentoo Linux Reporter: Pál Csányi <csanyipal>
Component: Current packagesAssignee: Gentoo Linux bug wranglers <bug-wranglers>
Status: RESOLVED NEEDINFO    
Severity: normal CC: jstein
Priority: Normal    
Version: unspecified   
Hardware: AMD64   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: This is the database in which I want to create the foreign key.

Description Pál Csányi 2017-09-30 07:32:09 UTC
Created attachment 497190 [details]
This is the database in which I want to create the foreign key.

I have installed on amd6 hardware the 
sqlitestudio version 3.1.1 with 
USE flags (cli cups -tcl -test LINGUAS="-de -es -fr -it -pl -pt_BR -ru -sk -zh_CN"

When I want to add a foreign key in SQLiteStudio at the and of process, when want to Commit changes, I get always the error message:
[09:28:22] Could not commit table structure. Error message: unknown column "&subtypename" in foreign key definition

One can see that "&" character at the beginning of the foreign key name. It is automatically added every time when trying to create a new foreign key.

This is a bug, I think.

Bellow is the SQL code for creating the foreign key:
PRAGMA foreign_keys = 0;

CREATE TABLE sqlitestudio_temp_table AS SELECT *
                                          FROM Subtypes;

DROP TABLE Subtypes;

CREATE TABLE Subtypes (
    subtypename TEXT PRIMARY KEY
                     UNIQUE,
    description TEXT,
    FOREIGN KEY (
        [&subtypename]
    )
    REFERENCES Types (type_name) ON DELETE CASCADE
                                 ON UPDATE CASCADE
);

INSERT INTO Subtypes (
                         subtypename,
                         description
                     )
                     SELECT subtypename,
                            description
                       FROM sqlitestudio_temp_table;

DROP TABLE sqlitestudio_temp_table;

PRAGMA foreign_keys = 1;
Comment 1 Jonas Stein gentoo-dev 2017-10-01 19:26:35 UTC
It is sad to read that you have problems with the software. The situation seems to be a bit more complicate and requires some analysis.
We can not help you efficiently via bug tracker. The bug tracker aims rather on specific problems in .ebuilds and less on individual systems. 

I have had very good experience on the gentoo IRC [1] with questions like this. Of course there are also forums and mailing lists [2,3].
I hope you understand, that I will close the bug here therefore and wish you good luck on one of the mentioned channels [4].
Please reopen the ticket in order to provide an indication for an specific error in an ebuild or any gentoo related product.

[1] https://www.gentoo.org/get-involved/irc-channels/
[2] https://forums.gentoo.org/
[3] https://www.gentoo.org/get-involved/mailing-lists/all-lists.html
[4] https://www.gentoo.org/support/