Index: tests/tests/query/results.php
===================================================================
--- tests/tests/query/results.php	(revision 25157)
+++ tests/tests/query/results.php	(working copy)
@@ -369,4 +369,31 @@
 			'child-two',
 		), wp_list_pluck( $posts, 'post_title' ) );
 	}
+
+	/**
+	 * @ticket 19866
+	 */
+	function test_query_fields() {
+		$posts_fields = $this->q->query( array(
+			'fields' => array( 'post_parent', 'guid' ),
+		) );
+
+		$post_fields = (array) reset( $posts_fields );
+		$this->assertEqualSets( array( 'post_parent', 'guid' ), array_keys( $post_fields ) );
+
+		$posts_ids = $this->q->query( array(
+			'fields' => 'ids',
+		) );
+
+		$post_ids = reset( $posts_ids );
+		$this->assertInternalType( 'integer', $post_ids );
+
+		$posts_id_parent = $this->q->query( array(
+			'fields' => 'id=>parent',
+		) );
+
+		$this->assertInternalType( 'array', $posts_id_parent );
+		$this->assertInternalType( 'integer', reset( $posts_id_parent ) );
+		$this->assertInternalType( 'integer', key( $posts_id_parent ) );
+	}
 }
Index: src/wp-includes/query.php
===================================================================
--- src/wp-includes/query.php	(revision 25157)
+++ src/wp-includes/query.php	(working copy)
@@ -2048,7 +2048,18 @@
 				$fields = "$wpdb->posts.ID, $wpdb->posts.post_parent";
 				break;
 			default:
-				$fields = "$wpdb->posts.*";
+				if ( is_array( $q['fields'] ) ) {
+					$_fields = array();
+					foreach ( $q['fields'] as $field ) {
+						if ( false === strpos( $field, '.' ) )
+							$_fields[] = "$wpdb->posts.$field";
+						else
+							$_fields[] = $field;
+					}
+					$fields = join( ', ', $_fields );
+				} else {
+					$fields = "$wpdb->posts.*";
+				}
 		}
 
 		if ( '' !== $q['menu_order'] )
@@ -2672,22 +2683,22 @@
 			$this->request = apply_filters_ref_array( 'posts_request', array( $this->request, &$this ) );
 		}
 
-		if ( 'ids' == $q['fields'] ) {
-			$this->posts = $wpdb->get_col( $this->request );
+		if ( is_array( $q['fields'] ) || in_array( $q['fields'], array( 'ids', 'id=>parent' ) ) ) {
+			if ( 'ids' == $q['fields'] )
+				$this->posts = array_map( 'intval', $wpdb->get_col( $this->request ) );
+			else
+				$this->posts = $wpdb->get_results( $this->request );
 			$this->post_count = count( $this->posts );
 			$this->set_found_posts( $q, $limits );
+		}
 
+		if ( 'ids' == $q['fields'] || is_array( $q['fields'] ) )
 			return $this->posts;
-		}
 
 		if ( 'id=>parent' == $q['fields'] ) {
-			$this->posts = $wpdb->get_results( $this->request );
-			$this->post_count = count( $this->posts );
-			$this->set_found_posts( $q, $limits );
-
 			$r = array();
 			foreach ( $this->posts as $post )
-				$r[ $post->ID ] = $post->post_parent;
+				$r[ (int) $post->ID ] = (int) $post->post_parent;
 
 			return $r;
 		}
