Search Results

Search found 19103 results on 765 pages for 'foreign key'.

Page 1/765 | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • How should I define a composite foreign key for domain constraints in the presence of surrogate keys

    - by Samuel Danielson
    I am writing a new app with Rails so I have an id column on every table. What is the best practice for enforcing domain constraints using foreign keys? I'll outline my thoughts and frustration. Here's what I would imagine as "The Rails Way". It's what I started with. Companies: id: integer, serial company_code: char, unique, not null Invoices: id: integer, serial company_id: integer, not null Products: id: integer, serial sku: char, unique, not null company_id: integer, not null LineItems: id: integer, serial invoice_id: integer, not null, references Invoices (id) product_id: integer, not null, references Products (id) The problem with this is that a product from one company might appear on an invoice for a different company. I added a (company_id: integer, not null) to LineItems, sort of like I'd do if only using natural keys and serials, then added a composite foreign key. LineItems (product_id, company_id) references Products (id, company_id) LineItems (invoice_id, company_id) references Invoices (id, company_id) This properly constrains LineItems to a single company but it seems over-engineered and wrong. company_id in LineItems is extraneous because the surrogate foreign keys are already unique in the foreign table. Postgres requires that I add a unique index for the referenced attributes so I am creating a unique index on (id, company_id) in Products and Invoices, even though id is simply unique. The following table with natural keys and a serial invoice number would not have these issues. LineItems: company_code: char, not null sku: char, not null invoice_id: integer, not null I can ignore the surrogate keys in the LineItems table but this also seems wrong. Why make the database join on char when it has an integer already there to use? Also, doing it exactly like the above would require me to add company_code, a natural foreign key, to Products and Invoices. The compromise... LineItems: company_id: integer, not null sku: integer, not null invoice_id: integer, not null does not require natural foreign keys in other tables but it is still joining on char when there is a integer available. Is there a clean way to enforce domain constraints with foreign keys like God intended, but in the presence of surrogates, without turning the schema and indexes into a complicated mess?

    Read the article

  • tmux: Suddenly, cannot horizontally split

    - by A__A__0
    As root, using a reasonably default .profile and .shrc and an empty tmux.conf, I am unable to split the window horizontally. There are a number of cases to consider so I'll list them clearly. Using the keybinding + empty configuration: nothing happens Using the keybinding + my configuration: a bell is generated, nothing else; occasionally, the split will appear and disappear immediately (maybe it always does this, but I'm connecting over ssh so it may not make it through) Using tmux split-window -h with any config: tmux immediately exits I've posted here in order the server and client verbose logs generated by tmux -v during the third case: server started, pid 9523 socket path /tmp/tmux-0/default new client 7 got 100 from client 7 got 101 from client 7 got 102 from client 7 got 103 from client 7 got 104 from client 7 got 105 from client 7 got 105 from client 7 got 105 from client 7 got 105 from client 7 got 105 from client 7 got 105 from client 7 got 105 from client 7 got 105 from client 7 got 105 from client 7 got 105 from client 7 got 105 from client 7 got 105 from client 7 got 105 from client 7 got 105 from client 7 got 105 from client 7 got 105 from client 7 got 106 from client 7 got 200 from client 7 cmdq 0x801c6e080: new-session (client 7) new term: xterm xterm override: XT xterm override: Ms ]52;%p1%s;%p2%s xterm override: Cs ]12;%p1%s xterm override: Cr ]112 xterm override: Ss [%p1%d q xterm override: Se [2 q new key Oo: 0x1021 (KP/) new key Oj: 0x1022 (KP*) new key Om: 0x1023 (KP-) new key Ow: 0x1024 (KP7) new key Ox: 0x1025 (KP8) new key Oy: 0x1026 (KP9) new key Ok: 0x1027 (KP+) new key Ot: 0x1028 (KP4) new key Ou: 0x1029 (KP5) new key Ov: 0x102a (KP6) new key Oq: 0x102b (KP1) new key Or: 0x102c (KP2) new key Os: 0x102d (KP3) new key OM: 0x102e (KPEnter) new key Op: 0x102f (KP0) new key On: 0x1030 (KP.) new key OA: 0x101d (Up) new key OB: 0x101e (Down) new key OC: 0x1020 (Right) new key OD: 0x101f (Left) new key [A: 0x101d (Up) new key [B: 0x101e (Down) new key [C: 0x1020 (Right) new key [D: 0x101f (Left) new key OH: 0x1018 (Home) new key OF: 0x1019 (End) new key [H: 0x1018 (Home) new key [F: 0x1019 (End) new key Oa: 0x501d (C-Up) new key Ob: 0x501e (C-Down) new key Oc: 0x5020 (C-Right) new key Od: 0x501f (C-Left) new key [a: 0x901d (S-Up) new key [b: 0x901e (S-Down) new key [c: 0x9020 (S-Right) new key [d: 0x901f (S-Left) new key [11^: 0x5002 (C-F1) new key [12^: 0x5003 (C-F2) new key [13^: 0x5004 (C-F3) new key [14^: 0x5005 (C-F4) new key [15^: 0x5006 (C-F5) new key [17^: 0x5007 (C-F6) new key [18^: 0x5008 (C-F7) new key [19^: 0x5009 (C-F8) new key [20^: 0x500a (C-F9) new key [21^: 0x500b (C-F10) new key [23^: 0x500c (C-F11) new key [24^: 0x500d (C-F12) new key [25^: 0x500e (C-F13) new key [26^: 0x500f (C-F14) new key [28^: 0x5010 (C-F15) new key [29^: 0x5011 (C-F16) new key [31^: 0x5012 (C-F17) new key [32^: 0x5013 (C-F18) new key [33^: 0x5014 (C-F19) new key [34^: 0x5015 (C-F20) new key [2^: 0x5016 (C-IC) new key [3^: 0x5017 (C-DC) new key [7^: 0x5018 (C-Home) new key [8^: 0x5019 (C-End) new key [6^: 0x501a (C-NPage) new key [5^: 0x501b (C-PPage) new key [11$: 0x9002 (S-F1) new key [12$: 0x9003 (S-F2) new key [13$: 0x9004 (S-F3) new key [14$: 0x9005 (S-F4) new key [15$: 0x9006 (S-F5) new key [17$: 0x9007 (S-F6) new key [18$: 0x9008 (S-F7) new key [19$: 0x9009 (S-F8) new key [20$: 0x900a (S-F9) new key [21$: 0x900b (S-F10) new key [23$: 0x900c (S-F11) new key [24$: 0x900d (S-F12) new key [25$: 0x900e (S-F13) new key [26$: 0x900f (S-F14) new key [28$: 0x9010 (S-F15) new key [29$: 0x9011 (S-F16) new key [31$: 0x9012 (S-F17) new key [32$: 0x9013 (S-F18) new key [33$: 0x9014 (S-F19) new key [34$: 0x9015 (S-F20) new key [2$: 0x9016 (S-IC) new key [3$: 0x9017 (S-DC) new key [7$: 0x9018 (S-Home) new key [8$: 0x9019 (S-End) new key [6$: 0x901a (S-NPage) new key [5$: 0x901b (S-PPage) new key [11@: 0xd002 (C-S-F1) new key [12@: 0xd003 (C-S-F2) new key [13@: 0xd004 (C-S-F3) new key [14@: 0xd005 (C-S-F4) new key [15@: 0xd006 (C-S-F5) new key [17@: 0xd007 (C-S-F6) new key [18@: 0xd008 (C-S-F7) new key [19@: 0xd009 (C-S-F8) new key [20@: 0xd00a (C-S-F9) new key [21@: 0xd00b (C-S-F10) new key [23@: 0xd00c (C-S-F11) new key [24@: 0xd00d (C-S-F12) new key [25@: 0xd00e (C-S-F13) new key [26@: 0xd00f (C-S-F14) new key [28@: 0xd010 (C-S-F15) new key [29@: 0xd011 (C-S-F16) new key [31@: 0xd012 (C-S-F17) new key [32@: 0xd013 (C-S-F18) new key [33@: 0xd014 (C-S-F19) new key [34@: 0xd015 (C-S-F20) new key [2@: 0xd016 (C-S-IC) new key [3@: 0xd017 (C-S-DC) new key [7@: 0xd018 (C-S-Home) new key [8@: 0xd019 (C-S-End) new key [6@: 0xd01a (C-S-NPage) new key [5@: 0xd01b (C-S-PPage) new key [I: 0x1031 ((null)) new key [O: 0x1032 ((null)) new key OP: 0x1002 (F1) new key OQ: 0x1003 (F2) new key OR: 0x1004 (F3) new key OS: 0x1005 (F4) new key [15~: 0x1006 (F5) new key [17~: 0x1007 (F6) new key [18~: 0x1008 (F7) new key [19~: 0x1009 (F8) new key [20~: 0x100a (F9) new key [21~: 0x100b (F10) new key [23~: 0x100c (F11) new key [24~: 0x100d (F12) new key [2~: 0x1016 (IC) new key [3~: 0x1017 (DC) replacing key OH: 0x1018 (Home) replacing key OF: 0x1019 (End) new key [6~: 0x101a (NPage) new key [5~: 0x101b (PPage) new key [Z: 0x101c (BTab) replacing key OA: 0x101d (Up) replacing key OB: 0x101e (Down) replacing key OD: 0x101f (Left) replacing key OC: 0x1020 (Right) spawn: /bin/sh -- session 0 created writing 207 to client 7 got 208 from client 7 input_parse: '#' ground input_parse: ' ' ground keys are 7 ([?1;2c) received service class 1 complete key [?1;2c 0xfff keys are 1 (t) complete key t 0x74 input_parse: 't' ground keys are 1 (m) complete key m 0x6d input_parse: 'm' ground keys are 1 (u) complete key u 0x75 input_parse: 'u' ground keys are 1 (x) complete key x 0x78 input_parse: 'x' ground keys are 1 ( ) complete key 0x20 input_parse: ' ' ground keys are 1 (s) complete key s 0x73 input_parse: 's' ground keys are 1 (p) complete key p 0x70 input_parse: 'p' ground keys are 1 (l) complete key l 0x6c input_parse: 'l' ground keys are 1 (i) complete key i 0x69 input_parse: 'i' ground keys are 1 (t) complete key t 0x74 input_parse: 't' ground keys are 1 (-) complete key - 0x2d input_parse: '-' ground keys are 1 (d) complete key d 0x64 input_parse: 'd' ground keys are 1 () complete key 0x7f input_parse: '' ground input_c0_dispatch: ' input_parse: '' ground input_parse: '[' esc_enter input_parse: 'K' csi_enter input_csi_dispatch: 'K' "" "" keys are 1 (w) complete key w 0x77 input_parse: 'w' ground keys are 1 (i) complete key i 0x69 input_parse: 'i' ground keys are 1 (n) complete key n 0x6e input_parse: 'n' ground keys are 1 (d) complete key d 0x64 input_parse: 'd' ground keys are 1 (o) complete key o 0x6f input_parse: 'o' ground keys are 1 (w) complete key w 0x77 input_parse: 'w' ground keys are 1 ( ) complete key 0x20 input_parse: ' ' ground keys are 1 (-) complete key - 0x2d input_parse: '-' ground keys are 1 (h) complete key h 0x68 input_parse: 'h' ground keys are 1 ( ) complete key 0xd input_parse: ' ' ground input_c0_dispatch: ' input_parse: ' ' ground input_c0_dispatch: ' new client 13 got 100 from client 13 got 101 from client 13 got 102 from client 13 got 103 from client 13 got 104 from client 13 got 105 from client 13 got 105 from client 13 got 105 from client 13 got 105 from client 13 got 105 from client 13 got 105 from client 13 got 105 from client 13 got 105 from client 13 got 105 from client 13 got 105 from client 13 got 105 from client 13 got 105 from client 13 got 105 from client 13 got 105 from client 13 got 105 from client 13 got 105 from client 13 got 105 from client 13 got 105 from client 13 got 106 from client 13 got 200 from client 13 cmdq 0x801c6e160: split-window -h (client 13) spawn: /bin/sh -- writing 203 to client 13 input_parse: '#' ground input_parse: ' ' ground input_parse: '#' ground input_parse: ' ' ground lost client 13 session 0 destroyed writing 203 to client 7 got 205 from client 7 writing 204 to client 7 lost client 7 got 207 from server got 203 from server got 204 from server There are some other peculiarities: With a newly created user (from which I overwrote root's .profile and .shrc, tmux works perfectly. Occasionally (twice out of the 50 or so times I've tested it), the splitting will work fine once in a session. (This happened for example when I ran ktrace on tmux, which I can also post) To explain the 'suddenly' part of the title: when I started my newly updated mysql56-server, tmux immediately exited and lost the session. Recently I changed architectures, from FreeBSD 10.0 i386 to amd64, and I am still working through shared library incompatibilities. I suspect that this could be involved, but I can't imagine how an incompatibility of this sort could result in such a specific, isolated failure.

    Read the article

  • Should foreign keys become table primary key?

    - by Carvell Fenton
    Hello again, I have a table (session_comments) with the following fields structure: student_id (foreign key to students table) session_id (foreign key to sessions table) session_subject_ID (foreign key to session_subjects table) user_id (foreign key to users table) comment_date_time comment Now, the combination of student_id, session_id, and session_subject_id will uniquely identify a comment about that student for that session subject. Given that combined they are unique, even though they are foreign keys, is there an advantage to me making them the combined primary key for that table? Thanks again.

    Read the article

  • Should all foreign table references use foreign key constraints

    - by TecBrat
    Closely related to: Foreign key restrictions -> yes or no? I asked a question on SO and it led me to ask this here. If I'm faced with a choice of having a circular reference or just not enforcing the restraint, which is the better choice? In my particular case I have customers and addresses. I want an address to have a reference to a customer and I want each customer to have a default billing address id and a default shipping address id. I might query for all addresses that have a certain customer ID or I might query for the address with the ID that matches the default shipping or billing address ids. I'm not sure yet how the constraints (or lack of) will effect the system as my application and it's data age.

    Read the article

  • Rejuvenated: Script Creates and Drops for Candidate Keys and Referencing Foreign Keys

    - by Adam Machanic
    Once upon a time it was 2004, and I wrote what I have to say was a pretty cool little script . (Yes, I know the post is dated 2006, but that's because I dropped the ball and failed to back-date the posts when I moved them over here from my prior blog space.) The impetus for creating this script was (and is) simple: Changing keys can be a painful experience. Sometimes you want to make a clustered key nonclustered, or a nonclustered key clustered. Or maybe you want to add a column to the key. Or remove...(read more)

    Read the article

  • sql foreign keys

    - by Paul Est
    I was create tables with the syntax in phpmyadmin: DROP TABLE IF EXISTS users; DROP TABLE IF EXISTS info; CREATE TABLE users ( user_id int unsigned NOT NULL auto_increment, email varchar(100) NOT NULL default '', pwd varchar(32) NOT NULL default '', isAdmin int(1) unsigned NOT NULL, PRIMARY KEY (user_id) ) TYPE=INNODB; CREATE TABLE info ( info_id int unsigned NOT NULL auto_increment, first_name varchar(100) NOT NULL default '', last_name varchar(100) NOT NULL default '', address varchar(300) NOT NULL default '', zipcode varchar(100) NOT NULL default '', personal_phone varchar(100) NOT NULL default '', mobilephone varchar(100) NOT NULL default '', faxe varchar(100) NOT NULL default '', email2 varchar(100) NOT NULL default '', country varchar(100) NOT NULL default '', sex varchar(1) NOT NULL default '', birth varchar(1) NOT NULL default '', email varchar(100) NOT NULL default '', PRIMARY KEY (info_id), FOREIGN KEY (email) REFERENCES users(email) ON UPDATE CASCADE ON DELETE CASCADE ) TYPE=INNODB; But shows the error "#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'TYPE=INNODB' at line 11 " If i remove the TYPE=INNODB in the end of create the tables, it will show the error "#1005 - Can't create table 'curriculo.info' (errno: 150) ".

    Read the article

  • Problems getting foreign keys working in MySQL

    - by thehuby
    I've been trying to get a delete to cascade and it just doesn't seem to work. I'm sure I am missing something obvious, can anyone help me find it? I would expect a delete on the 'articles' table to trigger a delete on the corresponding rows in the 'article_section_lt' table. CREATE TABLE articles ( id INTEGER UNSIGNED PRIMARY KEY AUTO_INCREMENT, url_stub VARCHAR(255) NOT NULL UNIQUE, h1 VARCHAR(60) NOT NULL UNIQUE, title VARCHAR(60) NOT NULL, description VARCHAR(150) NOT NULL, summary VARCHAR(150) NOT NULL DEFAULT "", html_content TEXT, date DATE NOT NULL, updated TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP )ENGINE=INNODB; CREATE TABLE article_sections ( /* blog, news etc */ id INTEGER UNSIGNED PRIMARY KEY AUTO_INCREMENT, url_stub VARCHAR(255) NOT NULL UNIQUE, h1 VARCHAR(60) NOT NULL, title VARCHAR(60) NOT NULL, description VARCHAR(150) NOT NULL, summary VARCHAR(150) NOT NULL DEFAULT "", html_content TEXT NOT NULL DEFAULT "" )ENGINE=INNODB; CREATE TABLE article_section_lt ( fk_article_id INTEGER UNSIGNED NOT NULL REFERENCES articles(id) ON DELETE CASCADE, fk_article_section_id INTEGER UNSIGNED NOT NULL )ENGINE=INNODB;

    Read the article

  • Fluent composite foreign key mapping

    - by Fionn
    Hi, I wonder if this is possible to map the following with fluent nhibernate: A document table and a document_revision table will be the target tables. The document_revision table should have a composite unique key consisting of the document_id and the revision number (where the document_id is also the foreign key to the document table). class Document { Guid Id; //other members omitted } class DocumentRevision { Guid document_id; //Part one of the primary key and also foreign key to Document.Id int revision; //Part two of the primary key //other members omitted }

    Read the article

  • Foreign key,local key?

    - by user198729
    CREATE TABLE products ( id integer unsigned auto_increment primary key ) ENGINE=INNODB; CREATE TABLE orders ( id integer PRIMARY KEY auto_increment, product_id integer unsigned, quantity integer, INDEX product_id_idx (product_id), FOREIGN KEY (product_id) REFERENCES products (id) ) ENGINE=INNODB; Here the products and orders obviously have some kind of relation--foreign key relation. Also a coin has two sides,so I'm doubting how do we say which table is the foreign key side or local key side?

    Read the article

  • Added key, but still getting "gpg: Can't check signature: public key not found"

    - by gertvdijk
    Trying to download Django source package using dget and the .dsc file from here. Then dget fails to verify the source, because it is missing a public key. $ dget https://launchpad.net/ubuntu... [...] dscverify: python-django_1.4.1-2.dsc failed signature check: gpg: Signature made Tue 21 Aug 2012 09:12:04 CEST using RSA key ID F2AC729A gpg: Can't check signature: public key not found Validation FAILED!! Fine, I added this key to my keyring, because I think I can trust this one: $ gpg --keyserver keyserver.ubuntu.com --recv-key 0xF2AC729A gpg: requesting key F2AC729A from hkp server keyserver.ubuntu.com gpg: key F2AC729A: "Raphaël Hertzog <[email protected]>" not changed gpg: Total number processed: 1 gpg: unchanged: 1 (well, this output is run afterwards, when it was already in my keyring) And it is really there: $ gpg --fingerprint F2AC729A pub 4096R/F2AC729A 2009-05-07 Key fingerprint = 3E4F B711 7877 F589 DBCF 06D6 E619 045D F2AC 729A uid Raphaël Hertzog <[email protected]> uid Raphaël Hertzog (Debian) <[email protected]> uid Raphaël Hertzog (Freexian SARL) <[email protected]> sub 2048R/71F23DEE 2009-05-07 But still fails for the same reason: gpg: Signature made Tue 21 Aug 2012 09:12:04 CEST using RSA key ID F2AC729A gpg: Can't check signature: public key not found I'm running all these commands as my regular user. I also tried adding this key to APT's keyring and root's keyring. Both to no avail. What am I missing here?

    Read the article

  • SQL - Two foreign keys that have a dependency between them

    - by Brian
    The current structure is as follows: Table RowType: RowTypeID Table RowSubType: RowSubTypeID FK_RowTypeID Table ColumnDef: FK_RowTypeID FK_RowSubTypeID (nullable) In short, I'm mapping column definitions to rows. In some cases, those rows have subtype(s), which will have column definitions specific to them. Alternatively, I could hang those column definitions that are specific to subtypes off their own table, or I could combine the data in RowType and RowSubType into one table and work with a single ID, but I'm not sure either is a better solution (if anything, I'd lean towards the latter, as we mostly end up pulling ColumnDefs for a given RowType/RowSubType). Is the current design SQL Blasphemy? If I keep the current structuree, how do I maintain that if RowSubTypeID is specified in ColumnDef, that it must correspond to the RowType specified by RowTypeID? Should I try to enforce this with a trigger or am I missing a simple redesign that would solve the problem?

    Read the article

  • Multiple foreign keys from one table linking to single primary key in second table

    - by croker10
    Hi all, I have a database with three tables, a household table, an adults table and a users table. The Household table contains two foreign keys, iAdult1ID and iAdult2ID. The Users table has a iUserID primary key and the Adult table has a corresponding iUserID foreign key. One of the columns in the Users table is strUsername, an e-mail address. I am trying to write a query that will allow me to search for an e-mail address for either adult that has a relation to the household. So I have two questions, assuming that all the values are not null, how can I do this? And two, in reality, iAdult2ID can be null, is it still possible to write a query to do this? Thanks for your help. Let me know if you need any more information.

    Read the article

  • How to script indexes, keys, foreign keys in SQL Server

    - by dontomaso
    Hi, I would like to get the details of all indexes, keys, and foreign keys from a database in SQL Server (2008). How do I do this? I plan to use this to synchronize those properties across a couple of somewhat similar databases. I can use SQL Server Management Studio, but I cannot do a full backup of a database because of restrictions set by the web hoster. -- Secondary question that you do not need to answer: Why can't there be something similar to the database schema in Mysql that simply lists all of the database structure in text SQL script format? Thanks,

    Read the article

  • MySQL primary/foreign key size?

    - by David
    I seem to see a lot of people arbitrarily assigning large sizes to primary/foreign key fields in their MySQL schemas, such as INT(11) and even BIGINT(20) as WordPress uses. Now correct me if I'm wrong, but even an INT(4) would support (unsigned) values up to over 4 billion. Change it to INT(5) and you allow for values up to a quadrillion, which is more than you would ever need, unless possibly you're storing geodata at NASA/Google, which I'm sure most of us aren't. Is there a reason people use such large sizes for their primary keys? Seems like a waste to me...

    Read the article

  • Simple SSH public/private key question

    - by James R.
    I am trying to learn this instead of just following guides so I can recommend proper actions when people do ask (and they do). Here is what I got down. First, generate both key with command such as this: ssh-keygen -b 2048 -t rsa -C comment -f ~/.ssh/id_rsa Then you push the public part of the key into authorized_keys2 file cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys2 (and then chmod it to 600 or similar) And you download the private key to your computer (id_rsa) and feed that in to Putty to be read and authenticate. Are these the correct steps to setting this public/private key authentication for passwordless login to SSH?

    Read the article

  • OperationalError: foreign key mismatch

    - by Niek de Klein
    I have two tables that I'm filling, 'msrun' and 'feature'. 'feature' has a foreign key pointing to the 'msrun_name' column of the 'msrun' table. Inserting in the tables works fine. But when I try to delete from the 'feature' table I get the following error: pysqlite2.dbapi2.OperationalError: foreign key mismatch From the rules of foreign keys in the manual of SQLite: - The parent table does not exist, or - The parent key columns named in the foreign key constraint do not exist, or - The parent key columns named in the foreign key constraint are not the primary key of the parent table and are not subject to a unique constraint using collating sequence specified in the CREATE TABLE, or - The child table references the primary key of the parent without specifying the primary key columns and the number of primary key columns in the parent do not match the number of child key columns. I can see nothing that I'm violating. My create tables look like this: DROP TABLE IF EXISTS `msrun`; -- ----------------------------------------------------- -- Table `msrun` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `msrun` ( `msrun_name` VARCHAR(40) PRIMARY KEY NOT NULL , `description` VARCHAR(500) NOT NULL ); DROP TABLE IF EXISTS `feature`; -- ----------------------------------------------------- -- Table `feature` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `feature` ( `feature_id` VARCHAR(40) PRIMARY KEY NOT NULL , `intensity` DOUBLE NOT NULL , `overallquality` DOUBLE NOT NULL , `charge` INT NOT NULL , `content` VARCHAR(45) NOT NULL , `msrun_msrun_name` VARCHAR(40) NOT NULL , CONSTRAINT `fk_feature_msrun1` FOREIGN KEY (`msrun_msrun_name` ) REFERENCES `msrun` (`msrun_name` ) ON DELETE NO ACTION ON UPDATE NO ACTION); CREATE UNIQUE INDEX `id_UNIQUE` ON `feature` (`feature_id` ASC); CREATE INDEX `fk_feature_msrun1` ON `feature` (`msrun_msrun_name` ASC); As far as I can see the parent table exists, the foreign key is pointing to the right parent key, the parent key is a primary key and the foreign key specifies the primary key column. The script that produces the error: from pysqlite2 import dbapi2 as sqlite import parseFeatureXML connection = sqlite.connect('example.db') cursor = connection.cursor() cursor.execute("PRAGMA foreign_keys=ON") inputValues = ('example', 'description') cursor.execute("INSERT INTO `msrun` VALUES(?, ?)", inputValues) featureXML = parseFeatureXML.Reader('../example_scripts/example_files/input/featureXML_example.featureXML') for feature in featureXML.getSimpleFeatureInfo(): inputValues = (featureXML['id'], featureXML['intensity'], featureXML['overallquality'], featureXML['charge'], featureXML['content'], 'example') # insert the values into msrun using ? for sql injection safety cursor.execute("INSERT INTO `feature` VALUES(?,?,?,?,?,?)", inputValues) connection.commit() for feature in featureXML.getSimpleFeatureInfo(): cursor.execute("DELETE FROM `feature` WHERE feature_id = ?", (str(featureXML['id']),))

    Read the article

  • Can a Compound key be set as a primary key to another table?

    - by Nikos
    Can a compound key be set as a primary key to another table? For instance i have the tables: Books -with Primary Key:Product_ID Client -with Primary key: Client_ID Clients_Books -with Compound Primary Key:Product_Id and Client_ID I want to set this compound Primary key from Clients_Books as a Primary Key to another table named: Order_Details. But I don't want to use the Product_ID and the Client_ID from the Books, Clients tables. Does this make sense? All opinions more than welcome.

    Read the article

  • DB Designer creates compound primary key

    - by Jon Winstanley
    When adding relationships to a database model in DB Designer 4, a composite primary key is being created every time. So every foreign key I add, I get an extra key added to a composite primary key. I think I must have changed a setting as I don't remember it doing this in the past. Does anyone know how to turn off this feature as I prefer to use a single surrogate primary keys in my database tables?

    Read the article

  • Tell git which private key to use

    - by jrdioko
    ssh has the -i option to tell it which private key file to use when authenticating: -i identity_file Selects a file from which the identity (private key) for RSA or DSA authentication is read. The default is ~/.ssh/identity for protocol ver- sion 1, and ~/.ssh/id_rsa and ~/.ssh/id_dsa for protocol version 2. Iden- tity files may also be specified on a per-host basis in the configuration file. It is possible to have multiple -i options (and multiple identities specified in configuration files). Is there a similar way to tell git which private key file to use when on a system with multiple private keys in the .ssh directory?

    Read the article

  • How to revoke gnupg public key without private key?

    - by danijelc
    Long story short I have an key generated with seahorse and mistakenly deleted it from my system. I do remember passphrase but I don't have this key anywhere on my system. Scanned trough Ask Ubuntu but couldn't find any aplicabile solution on similar issue. However public key is still updated on keyring servers and I would like to revoke it. Since I have no revocation certificate and I can't get hold of private key (only public key is available from keyservers which I imported to seahorse) I have no idea how to accomplish it. Spent some time searching for solution acros net, various manuals and so on, but so far no luck. gpg --list-secret-keys - returns no output at all. gpg --list-keys - returns public key info gpg --gen-revoke *user-id* - returns - gpg: secret key *user-id* not found: eof gpg (GnuPG) version 1.4.11. Anyone able to suggest a solution?

    Read the article

  • one primary key column foreign key to 2 other table columns.How to resolve data entry issue.

    - by Rohit
    I have a requirement according to which I have to create a central Login system.We have 2 things Corporate and Brand each represented by tables "Corporate" and "Brand". When a corporate gets registered,corporateID is given,When a user under that corporate gets registered there is a table corporateuser in which corporateID is a foreign key and CorporateUserID is a primary key.Similarly in the case of a brand. So we have CorporateUserId and BrandUserID. Now i have a table called RegisteredUsers in which i want to have corporate as well as brand users.UserID is a primary key in this table which is a foreign key to both corporateuser as well as Branduser. now when i enter a corporateuser,I do an entry to corporateuser as well as RegisteredUsers.When i enter CorporateUserID in userID for RegisteredUsers.It gives foreign key violation error. I fully understand this error.How can i achieve this.This requirement is very rigid.Please tell a workaround

    Read the article

  • BAD_UID error while exporting key in CryptoAPI

    - by mindthief
    Hi all, I am writing a test application for Microsoft CryptoAPI. I want to export the secret key of one party using the public key of the second party, and then import that secret key as the second party's secret key (this sets up a shared secret key for communication). Here is my code: if(!CryptExportKey(encryptT->hSymKey, decryptT->hPubKey, SIMPLEBLOB, 0, keyExBuf, &bufLen)) { FormattedDebugPrint(NULL, GetLastError(), "could not export secret key", TRUE); return -1; } if(!CryptImportKey(decryptT->hCryptProv, keyExBuf, bufLen, decryptT->hPubKey, 0, &(decryptT->hSymKey))) { FormattedDebugPrint(NULL, GetLastError(), "could not import secret key", TRUE); return -1; } And this gives the error: 80090001: Bad UID. The public keypair is being generated for both encryptT and decryptT (sender, receiver) by calling: CryptGenKey(encryptT->hCryptProv, CALG_RSA_KEYX, CRYPT_EXPORTABLE, &(encryptT->hPubKey)) Any idea what could be causing the error? Thanks,

    Read the article

  • Multiple Foriegn Keys from One Table linking to single Primary Key in second Table

    - by croker10
    Hi all, I have a database with three tables, a household table, an adults table and a users table. The Household table contains two foreign keys, iAdult1ID and iAdult2ID. The Users table has a iUserID primary key and the Adult table has a corresponding iUserID foreign key. One of the columns in the Users table is strUsername, an e-mail address. I am trying to write a query that will allow me to search for an e-mail address for either adult that has a relation to the household. So I have two questions, assuming that all the values are not null, how can I do this? And two, in reality, iAdult2ID can be null, is it still possible to write a query to do this? Thanks for your help. Let me know if you need any more information.

    Read the article

  • Bind the windows key to Lubuntu start menu

    - by abel
    I am running Lubuntu 11.10. By default the main menu is bound to Alt+F1 (A-F1) which works. Here is the relevant code from ~/.config/openbox/lubuntu-rc.xml <keybind key="A-F1"> <action name="Execute"> <command>lxpanelctl menu</command> </action> </keybind> This works. When I hit Alt+F1, I can see the start menu. If I change the keys to "Windows key + M" (W-m), I can pull up the start menu using Win+M <keybind key="W-m"> <action name="Execute"> <command>lxpanelctl menu</command> </action> </keybind> However, I cannot bind the start menu to the Windows key alone. If I try replacing "W-m" by "W", the "W" alphabet key gets bound to the start menu. If I try "W-" nothing happens, I have tried the "Super" option too but to no avail. How can I bind the Lubuntu main menu to the windows Key? I have been through some relevant lubuntu questions, like this one, which tries to do the opposite. How do I unbind Super key from menu in Lubuntu

    Read the article

1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >