2

In the current SEDE, the PostTags table contains information only from the currently existing questions (i.e. from the questions in the Posts table, but not from the ones in the PostsWithDeleted table).

I think, the knowledge how were the deleted posts tagged, is not a very serious security breach. However, it could be very useful for a lot of stat generation. More exactly, not knowing the tags of the deleted questions makes them significantly more un-exact.

1

1 Answer 1

7

This information is present in the Tags column of the PostsWithDeleted table, albeit in a less convenient format. If a question was tagged , its Tags value would be <frob><widget>. If you want one row per tag, you can use CROSS APPLY with STRING_SPLIT. Here is a query that will return the tags of a post with a given ID:

select st.Value as TagName from PostsWithDeleted
cross apply STRING_SPLIT (LTRIM(REPLACE(REPLACE(Tags, '<', ' '), '>', '')), ' ') st
where Id = ##ID##

That has the same effect as this query, which only works on non-deleted posts:

select Tags.TagName
from Posts
inner join PostTags on Posts.ID = PostTags.PostId
inner join Tags on Tags.ID = PostTags.TagId
where Posts.Id = ##ID##
2
  • 1
    As an aside, one of the reasons this information will always be kept separate is a ton of queries on SEDE would break if we suddenly dumped a bunch of deleted post information into those tables. Many queries are built on the assumption it doesn't include deleted posts, and would have to be updated to exclude them again. So @peterh don't count on this ever being added to the PostTags table - you'll have to live with this hacky way of doing it.
    – animuson StaffMod
    Commented Sep 25, 2017 at 15:17
  • @animuson Ok, it is not so bad, I accustomed to some hacky ways on the SEDE very well already. :-) However, I would like to suggest: if you never do any useful developments on compatibility reasons, you will be rigid and incapable to develop anything. It is long very strongly visible on the SE, practically all of the "do something better" initiatives are rejected without any examination. It is not good, it is the kiss of death on the long-term. You can have releases, between major version number changes you are allowed to break compatibility, and so is it.
    – peterh
    Commented Jan 23, 2018 at 21:50

You must log in to answer this question.

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