Does Compatibility Level allow unsupported functions? I've got a SQL Server 2016 instance with a database on it, running with a compatibility level of 2008. However, the following dummy proc creates, and executes just fine.

CREATE PROC usp_TestFormat
AS
BEGIN
    SELECT FORMAT(CAST('10/25/2018' AS DATE), 'MMM') AS Month;
END;


However FORMAT() is a 2012+ function, so when I tried to take a stored proc I'd written in above database, or the test proc above even, and deploy it to our production database, that is running on a 2008r2 box, it fails, as it doesn't recognize the function. It was my understanding that compatibility levels would prevent this type of behavior, as I'm now having to go through and re-work the code that uses the format function. Is this a bug, or am I not understanding Compatibility levels as much as I thought?
Is this a bug, or am I not understanding Compatibility levels as much as I thought?


Not a bug.  The Compatibility Levels are intended solely to make upgrading easier.  IE to prevent errors or changes in behavior when you upgrade to a newer version of SQL Server.

After you upgrade to a new version of SQL Server, you might want to take advantage of new features and capabilities without changing the Database Compatibility Level, so where possible, new TSQL language features are not blocked by your lower Compatibility Level.