How does Firefox reference Bookmarks to Tags in places.sqlite?

Firefox Bookmarks are saved in the table moz_bookmarks in the database file places.sqlite.

see table overview:

a single bookmark may look like this:

id 77 type 1 fk 73 parent 3 position 1 title Google

now I add two Tags to this bookmark in Firefox. Lets name them tag1 and tag2.

The line of the Google bookmark is not changed in the moz_bookmarks table.

Instead the two new tags are added to the end of the table.

example for "tag1":

id 120 type 2 fk (empty) position 0 title tag1


I want to know where Firefox is linking the Google Bookmark to the newly created Tag. There is no reference in the Google Bookmark table entry to tag1 or tag2.

I've looked in every other table of places.sqlite (using SQLite Database Browser, you can get it at SourceForge) and I see nowhere a link between the bookmark and the tags.

Documentation on this subject is very sparse and often 2 years old. The Firefox source code consists of 60.000 files, so it's not easy to do anything with it quickly.
Who is Participating?
Greg WrightConnect With a Mentor Sr. Database AdministratorCommented:
Here's what is going on. Kinda of confusing, yet, but this should clear it up.

My photo shows a sample from my bookmarks on the following items:
*) Bookmark = "Mozilla Firefox Start Page"
*) Tag 1 = "Sample 1"
*) Tag 2 = "Sample 2"

Here is the breakdown, watch two things, the fk field, and the third record.

The bookmark has id = 2161 and fk = 11841.
The tag has been recorded as id = 2162 with fk = null, yet has the parent = 4, which ties it to the Tag parent grouping. This is how Firefox knows it falls in into Tags.
Then, and most importantly, the next record is id = 2163 with fk = 11841 (tie to the bookmark), and parent = 2162 (tie to the tag).

The last record is what ties the two (bookmark and tag) together.

All Courses

From novice to tech pro — start learning today.