SELECT * FROM pragma_foreign_key_list('temp1');

The table name needs to be a string for the pragma_foreign_key_list virtual
table. (It's not for the corresponding pragma statement.)

On Sat, Feb 9, 2019, 11:31 PM Igor Korot <ikoro...@gmail.com wrote:

> Hi, ALL,
>
> [code]
> sqlite> SELECT * FROM sqlite_master WHERE name LIKE '%temp%';
> type|name|tbl_name|rootpage|sql
> table|temp|temp|40|CREATE TABLE temp(id INTEGER PRIMARY KEY, name
> VARCHAR(200))
> table|temp1|temp1|41|CREATE TABLE temp1(myid INTEGER PRIMARY KEY, id
> INTEGER, my
> name VARCHAR(200), CONSTRAINT temp1tempid FOREIGN KEY(id) REFERENCES
> temp(id))
> table|temp2|temp2|43|CREATE TABLE temp2(id INTEGER, name TEXT, value
> NUMERIC(15,
>  2))
> table|temp3|temp3|1268|CREATE TABLE temp3(id INTEGER PRIMARY KEY, data
> TEXT)
> table|temp4|temp4|1269|CREATE TABLE temp4(myid INTEGER PRIMARY KEY, id
> INTEGER,
> myname VARCHAR(200), FOREIGN KEY(id) REFERENCES temp(id))
> sqlite>
> sqlite>
> sqlite>
> sqlite> SELECT * FROM pragma_foreign_key_list(temp1);
> Error: no such column: temp1
> sqlite>
> [/code]
>
> I should get an information about the foreign key that exists for the
> table temp1,
> but I have an error.
>
> And when I execute the PRAGMA directly, I do get the results:
>
> [code]
> sqlite> PRAGMA foreign_key_list(temp1);
> id|seq|table|from|to|on_update|on_delete|match
> 0|0|temp|id|id|NO ACTION|NO ACTION|NONE
> [/code]
>
> [code]
> sqlite> .version
> SQLite 3.24.0 2018-06-04 19:24:41
> c7ee0833225bfd8c5ec2f9bf62b97c4e04d03bd9566366
> d5221ac8fb199a87ca
> zlib version 1.2.11
> gcc-5.2.0
> sqlite>
> [/code]
>
> This is on Windows 8.1
>
> Am I doing something wrong?
> _______________________________________________
> 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