pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bruce Momjian <maillist@candle.pha.pa.us>
To: jwieck@debis.com
Cc: hackers@postgreSQL.org
Subject: Re: [HACKERS] Open 6.4 items
Date: Wed, 28 Oct 1998 11:06:15 -0500 (EST)
Message-ID: <199810281606.LAA17193@candle.pha.pa.us> (raw)
In-Reply-To: <m0zYWRE-000EBPC@orion.SAPserv.Hamburg.dsh.de>

Thanks.  Applied.

> Bruce Momjian wrote:
> >
> > Additions
> > ---------
> > CREATE TABLE test (x text, s serial) fails if no database creation permission
> > regression test all platforms
> 
>     The  patch  below  arranges  that the sequence(s) get created
>     first.  Unprivileged user now can create  table  with  serial
>     columns.
> 
>     Regression tested.
> 
> 
> Jan
> 
> --
> 
> #======================================================================#
> # It's easier to get forgiveness for being wrong than for being right. #
> # Let's break this rule - forgive me.                                  #
> #======================================== jwieck@debis.com (Jan Wieck) #
> 
> 
> *** analyze.c.orig	Wed Oct 28 14:50:47 1998
> --- analyze.c	Wed Oct 28 14:59:12 1998
> ***************
> *** 42,48 ****
>   static Query *transformCursorStmt(ParseState *pstate, SelectStmt *stmt);
>   static Query *transformCreateStmt(ParseState *pstate, CreateStmt *stmt);
>   
> ! List	   *extras = NIL;
>   
>   /*
>    * parse_analyze -
> --- 42,49 ----
>   static Query *transformCursorStmt(ParseState *pstate, SelectStmt *stmt);
>   static Query *transformCreateStmt(ParseState *pstate, CreateStmt *stmt);
>   
> ! List	   *extras_before = NIL;
> ! List	   *extras_after = NIL;
>   
>   /*
>    * parse_analyze -
> ***************
> *** 57,62 ****
> --- 58,64 ----
>   {
>   	QueryTreeList *result;
>   	ParseState *pstate;
> + 	Query *parsetree;
>   	int			i = 0;
>   
>   	result = malloc(sizeof(QueryTreeList));
> ***************
> *** 66,88 ****
>   	while (pl != NIL)
>   	{
>   		pstate = make_parsestate(parentParseState);
> ! 		result->qtrees[i++] = transformStmt(pstate, lfirst(pl));
>   		if (pstate->p_target_relation != NULL)
>   			heap_close(pstate->p_target_relation);
>   
> ! 		if (extras != NIL)
>   		{
> ! 			result->len += length(extras);
>   			result->qtrees = (Query **) realloc(result->qtrees, result->len * sizeof(Query *));
> ! 			while (extras != NIL)
>   			{
> ! 				result->qtrees[i++] = transformStmt(pstate, lfirst(extras));
>   				if (pstate->p_target_relation != NULL)
>   					heap_close(pstate->p_target_relation);
> ! 				extras = lnext(extras);
>   			}
>   		}
> ! 		extras = NIL;
>   		pl = lnext(pl);
>   		pfree(pstate);
>   	}
> --- 68,107 ----
>   	while (pl != NIL)
>   	{
>   		pstate = make_parsestate(parentParseState);
> ! 		parsetree = transformStmt(pstate, lfirst(pl));
>   		if (pstate->p_target_relation != NULL)
>   			heap_close(pstate->p_target_relation);
>   
> ! 		if (extras_before != NIL)
>   		{
> ! 			result->len += length(extras_before);
>   			result->qtrees = (Query **) realloc(result->qtrees, result->len * sizeof(Query *));
> ! 			while (extras_before != NIL)
>   			{
> ! 				result->qtrees[i++] = transformStmt(pstate, lfirst(extras_before));
>   				if (pstate->p_target_relation != NULL)
>   					heap_close(pstate->p_target_relation);
> ! 				extras_before = lnext(extras_before);
>   			}
>   		}
> ! 		extras_before = NIL;
> ! 
> ! 		result->qtrees[i++] = parsetree;
> ! 
> ! 		if (extras_after != NIL)
> ! 		{
> ! 			result->len += length(extras_after);
> ! 			result->qtrees = (Query **) realloc(result->qtrees, result->len * sizeof(Query *));
> ! 			while (extras_after != NIL)
> ! 			{
> ! 				result->qtrees[i++] = transformStmt(pstate, lfirst(extras_after));
> ! 				if (pstate->p_target_relation != NULL)
> ! 					heap_close(pstate->p_target_relation);
> ! 				extras_after = lnext(extras_after);
> ! 			}
> ! 		}
> ! 		extras_after = NIL;
> ! 
>   		pl = lnext(pl);
>   		pfree(pstate);
>   	}
> ***************
> *** 487,492 ****
> --- 506,512 ----
>   	Constraint *constraint;
>   	List	   *keys;
>   	Ident	   *key;
> + 	List	   *blist = NIL;
>   	List	   *ilist = NIL;
>   	IndexStmt  *index;
>   	IndexElem  *iparam;
> ***************
> *** 553,559 ****
>   					elog(NOTICE, "CREATE TABLE will create implicit sequence %s for SERIAL column %s.%s",
>   					  sequence->seqname, stmt->relname, column->colname);
>   
> ! 					ilist = lcons(sequence, NIL);
>   				}
>   
>   				if (column->constraints != NIL)
> --- 573,579 ----
>   					elog(NOTICE, "CREATE TABLE will create implicit sequence %s for SERIAL column %s.%s",
>   					  sequence->seqname, stmt->relname, column->colname);
>   
> ! 					blist = lcons(sequence, NIL);
>   				}
>   
>   				if (column->constraints != NIL)
> ***************
> *** 745,751 ****
>   	}
>   
>   	q->utilityStmt = (Node *) stmt;
> ! 	extras = ilist;
>   
>   	return q;
>   }
> --- 765,772 ----
>   	}
>   
>   	q->utilityStmt = (Node *) stmt;
> ! 	extras_before = blist;
> ! 	extras_after = ilist;
>   
>   	return q;
>   }
> 


-- 
  Bruce Momjian                        |  http://www.op.net/~candle
  maillist@candle.pha.pa.us            |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026



view thread (141+ messages)  latest in thread

Message-ID: <199810281606.LAA17193@candle.pha.pa.us>
Permalink:  ../199810281606.LAA17193@candle.pha.pa.us/
Also on:    postgresql.org/message-id/199810281606.LAA17193@candle.pha.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: maillist@candle.pha.pa.us, jwieck@debis.com, hackers@postgreSQL.org
  Subject: Re: [HACKERS] Open 6.4 items
  In-Reply-To: <199810281606.LAA17193@candle.pha.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox