Index: tests/phpunit/tests/post/query.php
===================================================================
--- tests/phpunit/tests/post/query.php	(revision 25465)
+++ tests/phpunit/tests/post/query.php	(working copy)
@@ -200,6 +200,139 @@
     }
 
     /**
+     * @ticket 23033
+     */
+    function test_meta_query_decimal_results() {
+    	$post_1 = $this->factory->post->create();
+    	$post_2 = $this->factory->post->create();
+    	$post_3 = $this->factory->post->create();
+    	$post_4 = $this->factory->post->create();
+
+    	update_post_meta( $post_1, 'decimal_value', '-0.3' );
+    	update_post_meta( $post_2, 'decimal_value', '0.23409844' );
+    	update_post_meta( $post_3, 'decimal_value', '0.3' );
+    	update_post_meta( $post_4, 'decimal_value', '0.4' );
+
+    	$query = new WP_Query( array(
+    		'meta_query' => array(
+	    			array(
+	    				'key' => 'decimal_value',
+	    				'value' => '.300',
+	    				'compare' => '=',
+	    				'type' => 'DECIMAL(10,2)'
+					)
+				),
+		) );
+    	$this->assertEquals( array( $post_3 ), wp_list_pluck( $query->posts, 'ID' ) );
+
+    	$query = new WP_Query( array(
+    		'meta_query' => array(
+	    			array(
+	    				'key' => 'decimal_value',
+	    				'value' => '0.35',
+	    				'compare' => '>',
+	    				'type' => 'DECIMAL(10,2)'
+					)
+				),
+		) );
+    	$this->assertEquals( array( $post_4 ), wp_list_pluck( $query->posts, 'ID' ) );
+
+    	$query = new WP_Query( array(
+    		'meta_query' => array(
+	    			array(
+	    				'key' => 'decimal_value',
+	    				'value' => '0.3',
+	    				'compare' => '>=',
+	    				'type' => 'DECIMAL(10,2)'
+					)
+				),
+		) );
+    	$this->assertEquals( array( $post_3, $post_4 ), wp_list_pluck( $query->posts, 'ID' ) );
+
+    	$query = new WP_Query( array(
+    		'meta_query' => array(
+	    			array(
+	    				'key' => 'decimal_value',
+	    				'value' => '0',
+	    				'compare' => '<',
+	    				'type' => 'DECIMAL(10,2)'
+					)
+				),
+		) );
+    	$this->assertEquals( array( $post_1 ), wp_list_pluck( $query->posts, 'ID' ) );
+
+    	$query = new WP_Query( array(
+    		'meta_query' => array(
+	    			array(
+	    				'key' => 'decimal_value',
+	    				'value' => '0.3',
+	    				'compare' => '<=',
+	    				'type' => 'DECIMAL(10,2)'
+					)
+				),
+
+		) );
+    	$this->assertEquals( array( $post_1, $post_2, $post_3 ), wp_list_pluck( $query->posts, 'ID' ) );
+
+    	$query = new WP_Query( array(
+    		'meta_query' => array(
+	    			array(
+	    				'key' => 'decimal_value',
+	    				'value' => array( 0.23409845, .31 ),
+	    				'compare' => 'BETWEEN',
+	    				'type' => 'DECIMAL(10, 10)'
+					)
+				),
+		) );
+    	$this->assertEquals( array( $post_3 ), wp_list_pluck( $query->posts, 'ID' ) );
+
+    	$query = new WP_Query( array(
+    		'meta_query' => array(
+	    			array(
+	    				'key' => 'decimal_value',
+	    				'value' => array( 0.23409845, .31 ),
+	    				'compare' => 'NOT BETWEEN',
+	    				'type' => 'DECIMAL(10,10)'
+					)
+				),
+		) );
+    	$this->assertEquals( array( $post_1, $post_2, $post_4 ), wp_list_pluck( $query->posts, 'ID' ) );
+
+    	$query = new WP_Query( array(
+    		'meta_query' => array(
+	    			array(
+	    				'key' => 'decimal_value',
+	    				'value' => '.3',
+	    				'compare' => 'LIKE',
+	    				'type' => 'DECIMAL(10,2)'
+					)
+				),
+		) );
+    	$this->assertEquals( array( $post_1, $post_3 ), wp_list_pluck( $query->posts, 'ID' ) );
+
+    	$query = new WP_Query( array(
+    		'meta_query' => array(
+	    			array(
+	    				'key' => 'decimal_value',
+	    				'value' => '.3',
+	    				'compare' => 'NOT LIKE',
+	    				'type' => 'DECIMAL(10,2)'
+					)
+				),
+		) );
+    	$this->assertEquals( array( $post_2, $post_4 ), wp_list_pluck( $query->posts, 'ID' ) );
+
+    	$query = new WP_Query( array(
+    		'orderby' => 'meta_value',
+    		'order' => 'DESC',
+    		'meta_key' => 'decimal_value',
+    		'meta_type' => 'DECIMAL(10, 2)'
+		) );
+    	$this->assertEquals( array( $post_4, $post_3, $post_2, $post_1 ), wp_list_pluck( $query->posts, 'ID' ) );
+
+    }
+
+    /**
      * @ticket 20604
      */
     function test_taxonomy_empty_or() {
Index: tests/phpunit/tests/meta/query.php
===================================================================
--- tests/phpunit/tests/meta/query.php	(revision 25465)
+++ tests/phpunit/tests/meta/query.php	(working copy)
@@ -105,4 +105,37 @@
 		$this->assertEquals( 1, substr_count( $sql['where'], "$wpdb->postmeta.meta_key = 'my_third_key'" ) );
 
 	}
+
+	/**
+	 * @ticket 23033
+	 */
+	function test_get_cast_for_type() {
+		$query = new WP_Meta_Query();
+		$this->assertEquals( 'BINARY', $query->get_cast_for_type( 'BINARY' ) );
+		$this->assertEquals( 'CHAR', $query->get_cast_for_type( 'CHAR' ) );
+		$this->assertEquals( 'DATE', $query->get_cast_for_type( 'DATE' ) );
+		$this->assertEquals( 'DATETIME', $query->get_cast_for_type( 'DATETIME' ) );
+		$this->assertEquals( 'SIGNED', $query->get_cast_for_type( 'SIGNED' ) );
+		$this->assertEquals( 'UNSIGNED', $query->get_cast_for_type( 'UNSIGNED' ) );
+		$this->assertEquals( 'TIME', $query->get_cast_for_type( 'TIME' ) );
+		$this->assertEquals( 'SIGNED', $query->get_cast_for_type( 'NUMERIC' ) );
+		$this->assertEquals( 'NUMERIC(10)', $query->get_cast_for_type( 'NUMERIC(10)' ) );
+		$this->assertEquals( 'CHAR', $query->get_cast_for_type( 'NUMERIC( 10)' ) );
+		$this->assertEquals( 'CHAR', $query->get_cast_for_type( 'NUMERIC( 10 )' ) );
+		$this->assertEquals( 'NUMERIC(10, 5)', $query->get_cast_for_type( 'NUMERIC(10, 5)' ) );
+		$this->assertEquals( 'CHAR', $query->get_cast_for_type( 'NUMERIC(10,  5)' ) );
+		$this->assertEquals( 'NUMERIC(10,5)', $query->get_cast_for_type( 'NUMERIC(10,5)' ) );
+		$this->assertEquals( 'CHAR', $query->get_cast_for_type( 'NUMERIC( 10, 5 )' ) );
+		$this->assertEquals( 'CHAR', $query->get_cast_for_type( 'NUMERIC(10, 5 )' ) );
+		$this->assertEquals( 'DECIMAL', $query->get_cast_for_type( 'DECIMAL' ) );
+		$this->assertEquals( 'DECIMAL(10)', $query->get_cast_for_type( 'DECIMAL(10)' ) );
+		$this->assertEquals( 'CHAR', $query->get_cast_for_type( 'DECIMAL( 10 )' ) );
+		$this->assertEquals( 'CHAR', $query->get_cast_for_type( 'DECIMAL( 10)' ) );
+		$this->assertEquals( 'CHAR', $query->get_cast_for_type( 'DECIMAL(10 )' ) );
+		$this->assertEquals( 'DECIMAL(10, 5)', $query->get_cast_for_type( 'DECIMAL(10, 5)' ) );
+		$this->assertEquals( 'DECIMAL(10,5)', $query->get_cast_for_type( 'DECIMAL(10,5)' ) );
+		$this->assertEquals( 'CHAR', $query->get_cast_for_type( 'DECIMAL(10,  5)' ) );
+
+		$this->assertEquals( 'CHAR', $query->get_cast_for_type( 'ANYTHING ELSE' ) );
+	}
 }
Index: src/wp-includes/meta.php
===================================================================
--- src/wp-includes/meta.php	(revision 25465)
+++ src/wp-includes/meta.php	(working copy)
@@ -702,7 +702,7 @@
 
 		$meta_type = strtoupper( $type );
 
-		if ( ! in_array( $meta_type, array( 'BINARY', 'CHAR', 'DATE', 'DATETIME', 'DECIMAL', 'SIGNED', 'TIME', 'UNSIGNED', 'NUMERIC' ) ) )
+		if ( ! preg_match( '/^(?:BINARY|CHAR|DATE|DATETIME|SIGNED|UNSIGNED|TIME|NUMERIC(?:\(\d+(?:,\s?\d+)?\))?|DECIMAL(?:\(\d+(?:,\s?\d+)?\))?)$/', $meta_type ) )
 			return 'CHAR';
 
 		if ( 'NUMERIC' == $meta_type )
