Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 158 Stack Exchange communities.

What is meta?
Here's how it works:
  1. Any Stack Exchange user can ask a question
  2. The community provides support, votes on ideas, and reports bugs
  3. Your voice helps shape the way Stack Exchange operates

I am looking for some explanation of the schema for the data dump of se sites.

Specifically I'd like to know the values for PostTypeId field (1=Questions?, 2=Answers?, 3=?, etc).

I have tried to look for it, I am sure it must be posted somewhere pretty obvious, but I seem to have a blind spot that I need help with.

share|improve this question
I changed my mind about the duplicate, since the documentation is so far behind – Michael Mrozek Jul 21 '11 at 14:21
@MichaelMrozek - In that case, isn't the solution to edit the original, canonical post? It's got 40 upvotes and 24 revisions, I hardly think that we should start a new question for it. – Kevin Vermeer Jul 26 '12 at 0:02
up vote 25 down vote accepted

You can get it by:

select * from posttypes

It returns:

1 Question
2 Answer
3 Wiki
4 TagWikiExcerpt
5 TagWiki
6 ModeratorNomination
7 WikiPlaceholder
8 PrivilegeWiki

Is this what you are looking for?

share|improve this answer
Thanks. Duh, I knew it was obvious. – Unreason Jul 21 '11 at 14:27

In theory selecting from PostTypes should be the right way, but it seems to be behind, since I see 1-6 used in the PostTypeId field. The readme.txt file in the data dump is worse; it only lists 1 and 2 for Question and Answer, respectively. I looked at 20 random posts from each ID; they appear to be:

  • 1 -- Questions
  • 2 -- Answers
  • 3 -- Orphan Tag Wikis (tag wikis for tags that have since been deleted. ♦ mods can see these live)
  • 4 -- Tag Wiki Excerpts
  • 5 -- Tag Wiki Bodys
  • 6 -- Election nominations
share|improve this answer
Thank you, interesting... btw, is there somewhere where I can look more directly on the schema, integrity rules, etc... +1 – Unreason Jul 21 '11 at 14:37
There's documentation in the readme.txt that comes with the data dump; it's reproduced here. That's all that's publicly available – Michael Mrozek Jul 21 '11 at 14:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .