mirror of
				https://github.com/postgres/postgres.git
				synced 2025-11-03 09:13:20 +03:00 
			
		
		
		
	expandRTE and get_rte_attribute_type mistakenly always imputed typmod -1
to columns of an RTE that was a function returning RECORD with a column definition list. Apparently no one has tried to use non-default typmod with a function returning RECORD before.
This commit is contained in:
		@@ -8,7 +8,7 @@
 | 
				
			|||||||
 *
 | 
					 *
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * IDENTIFICATION
 | 
					 * IDENTIFICATION
 | 
				
			||||||
 *	  $Header: /cvsroot/pgsql/src/backend/parser/parse_relation.c,v 1.79 2002/09/04 20:31:24 momjian Exp $
 | 
					 *	  $Header: /cvsroot/pgsql/src/backend/parser/parse_relation.c,v 1.79.2.1 2005/05/29 17:11:07 tgl Exp $
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 *-------------------------------------------------------------------------
 | 
					 *-------------------------------------------------------------------------
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
@@ -1372,7 +1372,7 @@ expandRTE(ParseState *pstate, RangeTblEntry *rte,
 | 
				
			|||||||
							varnode = makeVar(rtindex,
 | 
												varnode = makeVar(rtindex,
 | 
				
			||||||
											  attnum,
 | 
																  attnum,
 | 
				
			||||||
											  atttypid,
 | 
																  atttypid,
 | 
				
			||||||
											  -1,
 | 
																  colDef->typename->typmod,
 | 
				
			||||||
											  sublevels_up);
 | 
																  sublevels_up);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
							*colvars = lappend(*colvars, varnode);
 | 
												*colvars = lappend(*colvars, varnode);
 | 
				
			||||||
@@ -1631,7 +1631,7 @@ get_rte_attribute_type(RangeTblEntry *rte, AttrNumber attnum,
 | 
				
			|||||||
					ColumnDef  *colDef = nth(attnum - 1, coldeflist);
 | 
										ColumnDef  *colDef = nth(attnum - 1, coldeflist);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
					*vartype = typenameTypeId(colDef->typename);
 | 
										*vartype = typenameTypeId(colDef->typename);
 | 
				
			||||||
					*vartypmod = -1;
 | 
										*vartypmod = colDef->typename->typmod;
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
				else
 | 
									else
 | 
				
			||||||
					elog(ERROR, "Unknown kind of return type specified for function");
 | 
										elog(ERROR, "Unknown kind of return type specified for function");
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user