sqlite_master structure

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

sqlite_master structure

Igor Korot
Hi, ALL,
I see that sqlite_master have 2 fields: name and tbl_name. It looks
like they have
the same value in my case.

Is there a scenario when those 2 are different?
And what should I check for the "table name"?

Thank you.
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: sqlite_master structure

Simon Slavin-3


On 2 Nov 2017, at 3:37am, Igor Korot <[hidden email]> wrote:

> I see that sqlite_master have 2 fields: name and tbl_name. It looks
> like they have
> the same value in my case.
>
> Is there a scenario when those 2 are different?

sqlite_master includes rows for things that aren’t tables.  For example, indexes.

Simon.
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: sqlite_master structure

Igor Korot
Simon,


On Wed, Nov 1, 2017 at 10:44 PM, Simon Slavin <[hidden email]> wrote:

>
>
> On 2 Nov 2017, at 3:37am, Igor Korot <[hidden email]> wrote:
>
>> I see that sqlite_master have 2 fields: name and tbl_name. It looks
>> like they have
>> the same value in my case.
>>
>> Is there a scenario when those 2 are different?
>
> sqlite_master includes rows for things that aren’t tables.  For example, indexes.

So if I want table, it is cleaner to use tbl_name, correct?
Provided I have "WHERE type = 'table'" in the query...

Thank you.

>
> Simon.
> _______________________________________________
> sqlite-users mailing list
> [hidden email]
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: sqlite_master structure

Simon Slavin-3


On 2 Nov 2017, at 5:05am, Igor Korot <[hidden email]> wrote:

> So if I want table, it is cleaner to use tbl_name, correct?
> Provided I have "WHERE type = 'table'" in the query...

For that specific thing, the two are always the same.  I think that it might make more sense to use "name" because that’s what you would do if you were looking for indexes.

Simon.
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: [EXTERNAL] sqlite_master structure

Hick Gunter
In reply to this post by Igor Korot
If an entry refers to an index, the field "name" will contain the name of the index, while the field "tbl_name" contains the name of the table the index refers to.

-----Ursprüngliche Nachricht-----
Von: sqlite-users [mailto:[hidden email]] Im Auftrag von Igor Korot
Gesendet: Donnerstag, 02. November 2017 04:37
An: Discussion of SQLite Database <[hidden email]>; General Discussion of SQLite Database <[hidden email]>
Betreff: [EXTERNAL] [sqlite] sqlite_master structure

Hi, ALL,
I see that sqlite_master have 2 fields: name and tbl_name. It looks like they have the same value in my case.

Is there a scenario when those 2 are different?
And what should I check for the "table name"?

Thank you.
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


___________________________________________
 Gunter Hick | Software Engineer | Scientific Games International GmbH | Klitschgasse 2-4, A-1130 Vienna | FN 157284 a, HG Wien, DVR: 0430013 | (O) +43 1 80100 - 0

May be privileged. May be confidential. Please delete if not the addressee.
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: [EXTERNAL] sqlite_master structure

wmertens
Don't forget about this handy pragma:

PRAGMA schema.table_info(table-name);

This pragma returns one row for each column in the named table.
Columns in the result set include the column name, data type, whether
or not the column can be NULL, and the default value for the column.
The "pk" column in the result set is zero for columns that are not
part of the primary key, and is the index of the column in the primary
key for columns that are part of the primary key.

The table named in the table_info pragma can also be a view.



On 11/2/17, Hick Gunter <[hidden email]> wrote:

> If an entry refers to an index, the field "name" will contain the name of
> the index, while the field "tbl_name" contains the name of the table the
> index refers to.
>
> -----Ursprüngliche Nachricht-----
> Von: sqlite-users [mailto:[hidden email]] Im
> Auftrag von Igor Korot
> Gesendet: Donnerstag, 02. November 2017 04:37
> An: Discussion of SQLite Database <[hidden email]>;
> General Discussion of SQLite Database <[hidden email]>
> Betreff: [EXTERNAL] [sqlite] sqlite_master structure
>
> Hi, ALL,
> I see that sqlite_master have 2 fields: name and tbl_name. It looks like
> they have the same value in my case.
>
> Is there a scenario when those 2 are different?
> And what should I check for the "table name"?
>
> Thank you.
> _______________________________________________
> sqlite-users mailing list
> [hidden email]
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>
>
> ___________________________________________
>  Gunter Hick | Software Engineer | Scientific Games International GmbH |
> Klitschgasse 2-4, A-1130 Vienna | FN 157284 a, HG Wien, DVR: 0430013 | (O)
> +43 1 80100 - 0
>
> May be privileged. May be confidential. Please delete if not the addressee.
> _______________________________________________
> sqlite-users mailing list
> [hidden email]
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users