Okay,
  Because I'm hardheaded as well as anxious to implement my own ideas
for the challenge of it :) ...


I've extended the the -t/--table option to optionally accept a WHERE
clause expression following the table pattern.

The user can, for example, run:
        pg_dump -t "tab1:col1>15" -t "tab2:col1>25"
and it will dump only tab1 WHERE col1>15 and tab2 WHERE col2>25

Since the -t/--table option already supports accepting wildcard table
names, the WHERE clause expression applies to all tables matching a
pattern.

The only backwards incompatibility is that if a table name pattern
contains a ':', then the pattern must be quoted otherwise the ':' that
is part of the pattern will be interpreted as a separator between a
pattern and an expression.  If ':' is too common a character to be found
in table patterns, then it can easily be changed (in the pg_dump.sgml
file and in one place with a #define at the top of pg_dump.c).

As before, I have implemented and tested that it works when generating
either COPY statements (the default), or INSERT statements (-d and -D).
These two modes of operation have two different sections of code that
select the data to be dumped.

The code changes should be in conformance to the existing coding style
within pg_dump.

I've made minimal changes to the pg_dump.sgml file as well to affect
the man page.

The patch should be applied from the root of the source tree with a -p1
option to the patch command. The patch is against version 8.3.1 source
code.


Thanks *again* for a great DB,
  Davy


==

P.S.
  This submission is my final response to the previous thread titled: 
        "Feature: give pg_dump a WHERE clause expression"
        
  Please forgive the submitted patch that I know may never get merged
in.  I merely wanted the final result posted/archived somewhere public
in case any other lurkers were interested for their own purposes.  But
if you're at all curious, try it out.  You might like it :)

  Thanks again for all your feedback.

diff -cr postgresql-8.3.1.orig/doc/src/sgml/ref/pg_dump.sgml postgresql-8.3.1/doc/src/sgml/ref/pg_dump.sgml
*** postgresql-8.3.1.orig/doc/src/sgml/ref/pg_dump.sgml	2008-05-31 17:48:38.000000000 -0500
--- postgresql-8.3.1/doc/src/sgml/ref/pg_dump.sgml	2008-06-01 23:37:32.000000000 -0500
***************
*** 451,458 ****
       </varlistentry>
  
       <varlistentry>
!       <term><option>-t <replaceable class="parameter">table</replaceable></option></term>
!       <term><option>--table=<replaceable class="parameter">table</replaceable></option></term>
        <listitem>
         <para>
          Dump only tables (or views or sequences) matching <replaceable
--- 451,458 ----
       </varlistentry>
  
       <varlistentry>
!       <term><option>-t <replaceable class="parameter">table[:expression]</replaceable></option></term>
!       <term><option>--table=<replaceable class="parameter">table[:expression]</replaceable></option></term>
        <listitem>
         <para>
          Dump only tables (or views or sequences) matching <replaceable
***************
*** 468,473 ****
--- 468,482 ----
         </para>
  
         <para>
+ 	If ':' and an expression follow the given table pattern, then it 
+ 	becomes a <command>WHERE</command> clause expression on the table(s) 
+ 	being dumped by this parameter.  When the expression contains cerain
+ 	characters or spaces, be careful also to quote the entire parameter 
+ 	to prevent the shell from processing special characters or passing
+ 	the parameter as multiple arguments to <command>pg_dump</command>.
+        </para>
+ 
+        <para>
          The <option>-n</> and <option>-N</> switches have no effect when
          <option>-t</> is used, because tables selected by <option>-t</> will
          be dumped regardless of those switches, and non-table objects will not
diff -cr postgresql-8.3.1.orig/src/bin/pg_dump/common.c postgresql-8.3.1/src/bin/pg_dump/common.c
*** postgresql-8.3.1.orig/src/bin/pg_dump/common.c	2008-05-31 17:48:25.000000000 -0500
--- postgresql-8.3.1/src/bin/pg_dump/common.c	2008-06-01 20:16:01.000000000 -0500
***************
*** 915,927 ****
   * Support for simple list operations
   */
  
! void
  simple_oid_list_append(SimpleOidList *list, Oid val)
  {
  	SimpleOidListCell *cell;
  
  	cell = (SimpleOidListCell *) pg_malloc(sizeof(SimpleOidListCell));
  	cell->next = NULL;
  	cell->val = val;
  
  	if (list->tail)
--- 915,928 ----
   * Support for simple list operations
   */
  
! SimpleOidListCell *
  simple_oid_list_append(SimpleOidList *list, Oid val)
  {
  	SimpleOidListCell *cell;
  
  	cell = (SimpleOidListCell *) pg_malloc(sizeof(SimpleOidListCell));
  	cell->next = NULL;
+ 	cell->userData = NULL;
  	cell->val = val;
  
  	if (list->tail)
***************
*** 929,937 ****
  	else
  		list->head = cell;
  	list->tail = cell;
  }
  
! void
  simple_string_list_append(SimpleStringList *list, const char *val)
  {
  	SimpleStringListCell *cell;
--- 930,939 ----
  	else
  		list->head = cell;
  	list->tail = cell;
+ 	return cell;
  }
  
! SimpleStringListCell *
  simple_string_list_append(SimpleStringList *list, const char *val)
  {
  	SimpleStringListCell *cell;
***************
*** 940,945 ****
--- 942,948 ----
  	cell = (SimpleStringListCell *)
  		pg_malloc(sizeof(SimpleStringListCell) + strlen(val));
  	cell->next = NULL;
+ 	cell->userData = NULL;
  	strcpy(cell->val, val);
  
  	if (list->tail)
***************
*** 947,963 ****
  	else
  		list->head = cell;
  	list->tail = cell;
  }
  
  bool
! simple_oid_list_member(SimpleOidList *list, Oid val)
  {
  	SimpleOidListCell *cell;
  
  	for (cell = list->head; cell; cell = cell->next)
  	{
  		if (cell->val == val)
  			return true;
  	}
  	return false;
  }
--- 950,971 ----
  	else
  		list->head = cell;
  	list->tail = cell;
+ 	return cell;
  }
  
  bool
! simple_oid_list_member(SimpleOidList *list, Oid val, SimpleOidListCell **found)
  {
  	SimpleOidListCell *cell;
  
  	for (cell = list->head; cell; cell = cell->next)
  	{
  		if (cell->val == val)
+ 		{
+ 			if(found)
+ 				(*found) = cell;
  			return true;
+ 		}
  	}
  	return false;
  }
diff -cr postgresql-8.3.1.orig/src/bin/pg_dump/pg_dump.c postgresql-8.3.1/src/bin/pg_dump/pg_dump.c
*** postgresql-8.3.1.orig/src/bin/pg_dump/pg_dump.c	2008-05-31 17:48:25.000000000 -0500
--- postgresql-8.3.1/src/bin/pg_dump/pg_dump.c	2008-06-02 00:24:03.000000000 -0500
***************
*** 51,56 ****
--- 51,58 ----
  #include "pg_backup_archiver.h"
  #include "dumputils.h"
  
+ #define TBL_EXPR_SEP ":"
+ 
  extern char *optarg;
  extern int	optind,
  			opterr;
***************
*** 191,200 ****
  static void dumpEncoding(Archive *AH);
  static void dumpStdStrings(Archive *AH);
  static const char *getAttrName(int attrnum, TableInfo *tblInfo);
! static const char *fmtCopyColumnList(const TableInfo *ti);
  static void do_sql_command(PGconn *conn, const char *query);
  static void check_sql_result(PGresult *res, PGconn *conn, const char *query,
  				 ExecStatusType expected);
  
  
  int
--- 193,203 ----
  static void dumpEncoding(Archive *AH);
  static void dumpStdStrings(Archive *AH);
  static const char *getAttrName(int attrnum, TableInfo *tblInfo);
! static const char *fmtCopyColumnList(const TableInfo *ti, bool addParens);
  static void do_sql_command(PGconn *conn, const char *query);
  static void check_sql_result(PGresult *res, PGconn *conn, const char *query,
  				 ExecStatusType expected);
+ static void splitPatternAndWhere(char *arg, char **pattern, char **whereClauseExpr);
  
  
  int
***************
*** 226,231 ****
--- 229,236 ----
  	static int	use_setsessauth = 0;
  	static int	disable_triggers = 0;
  	char	   *outputSuperuser = NULL;
+ 	char	   *pattern;
+ 	char	   *whereClauseExpr;
  
  	RestoreOptions *ropt;
  
***************
*** 387,393 ****
  				break;
  
  			case 't':			/* include table(s) */
! 				simple_string_list_append(&table_include_patterns, optarg);
  				include_everything = false;
  				break;
  
--- 392,399 ----
  				break;
  
  			case 't':			/* include table(s) */
! 				splitPatternAndWhere(optarg, &pattern, &whereClauseExpr);
! 				simple_string_list_append(&table_include_patterns, pattern)->userData = whereClauseExpr;
  				include_everything = false;
  				break;
  
***************
*** 763,769 ****
  	printf(_("  -s, --schema-only           dump only the schema, no data\n"));
  	printf(_("  -S, --superuser=NAME        specify the superuser user name to use in\n"
  			 "                              plain text format\n"));
! 	printf(_("  -t, --table=TABLE           dump the named table(s) only\n"));
  	printf(_("  -T, --exclude-table=TABLE   do NOT dump the named table(s)\n"));
  	printf(_("  -x, --no-privileges         do not dump privileges (grant/revoke)\n"));
  	printf(_("  --disable-dollar-quoting    disable dollar quoting, use SQL standard quoting\n"));
--- 769,776 ----
  	printf(_("  -s, --schema-only           dump only the schema, no data\n"));
  	printf(_("  -S, --superuser=NAME        specify the superuser user name to use in\n"
  			 "                              plain text format\n"));
! 	printf(_("  -t, --table=TABLE["TBL_EXPR_SEP"EXPR]    dump the named table(s) only with optional\n"
! 		 "                              WHERE clause expression\n"));
  	printf(_("  -T, --exclude-table=TABLE   do NOT dump the named table(s)\n"));
  	printf(_("  -x, --no-privileges         do not dump privileges (grant/revoke)\n"));
  	printf(_("  --disable-dollar-quoting    disable dollar quoting, use SQL standard quoting\n"));
***************
*** 854,859 ****
--- 861,868 ----
  	PGresult   *res;
  	SimpleStringListCell *cell;
  	int			i;
+ 	int			j;
+ 	int			k;
  
  	if (patterns->head == NULL)
  		return;					/* nothing to do */
***************
*** 865,879 ****
  	 * duplicate entries in the OID list, but we don't care.
  	 */
  
  	for (cell = patterns->head; cell; cell = cell->next)
  	{
  		if (cell != patterns->head)
  			appendPQExpBuffer(query, "UNION ALL\n");
  		appendPQExpBuffer(query,
! 						  "SELECT c.oid"
  						  "\nFROM pg_catalog.pg_class c"
  		"\n     LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace"
  						  "\nWHERE c.relkind in ('%c', '%c', '%c')\n",
  						  RELKIND_RELATION, RELKIND_SEQUENCE, RELKIND_VIEW);
  		processSQLNamePattern(g_conn, query, cell->val, true, false,
  							  "n.nspname", "c.relname", NULL,
--- 874,890 ----
  	 * duplicate entries in the OID list, but we don't care.
  	 */
  
+ 	j = 0;
  	for (cell = patterns->head; cell; cell = cell->next)
  	{
  		if (cell != patterns->head)
  			appendPQExpBuffer(query, "UNION ALL\n");
  		appendPQExpBuffer(query,
! 						  "SELECT c.oid, %d"
  						  "\nFROM pg_catalog.pg_class c"
  		"\n     LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace"
  						  "\nWHERE c.relkind in ('%c', '%c', '%c')\n",
+ 						  j++,
  						  RELKIND_RELATION, RELKIND_SEQUENCE, RELKIND_VIEW);
  		processSQLNamePattern(g_conn, query, cell->val, true, false,
  							  "n.nspname", "c.relname", NULL,
***************
*** 885,891 ****
  
  	for (i = 0; i < PQntuples(res); i++)
  	{
! 		simple_oid_list_append(oids, atooid(PQgetvalue(res, i, 0)));
  	}
  
  	PQclear(res);
--- 896,915 ----
  
  	for (i = 0; i < PQntuples(res); i++)
  	{
! 		/* 
! 		 * find the cell in the pattern list that went with 
! 		 * this Oid result and get its WHERE clause expr
! 		 */
! 		cell = patterns->head;
! 		j = atoi(PQgetvalue(res, i, 1));
! 		for(k = 0; k < j; k++)
! 			cell = cell->next;
! 
! 		/* 
!  		 * cell->userData is either NULL or the WHERE 
!  		 * clause expr given in the -t/--table argument
!  		 */
! 		simple_oid_list_append(oids, atooid(PQgetvalue(res, i, 0)))->userData = cell->userData;
  	}
  
  	PQclear(res);
***************
*** 908,914 ****
  		nsinfo->dobj.dump = false;
  	else if (schema_include_oids.head != NULL)
  		nsinfo->dobj.dump = simple_oid_list_member(&schema_include_oids,
! 												   nsinfo->dobj.catId.oid);
  	else if (strncmp(nsinfo->dobj.name, "pg_", 3) == 0 ||
  			 strcmp(nsinfo->dobj.name, "information_schema") == 0)
  		nsinfo->dobj.dump = false;
--- 932,939 ----
  		nsinfo->dobj.dump = false;
  	else if (schema_include_oids.head != NULL)
  		nsinfo->dobj.dump = simple_oid_list_member(&schema_include_oids,
! 												   nsinfo->dobj.catId.oid,
! 												   NULL);
  	else if (strncmp(nsinfo->dobj.name, "pg_", 3) == 0 ||
  			 strcmp(nsinfo->dobj.name, "information_schema") == 0)
  		nsinfo->dobj.dump = false;
***************
*** 920,926 ****
  	 */
  	if (nsinfo->dobj.dump &&
  		simple_oid_list_member(&schema_exclude_oids,
! 							   nsinfo->dobj.catId.oid))
  		nsinfo->dobj.dump = false;
  }
  
--- 945,952 ----
  	 */
  	if (nsinfo->dobj.dump &&
  		simple_oid_list_member(&schema_exclude_oids,
! 							   nsinfo->dobj.catId.oid,
! 							   NULL))
  		nsinfo->dobj.dump = false;
  }
  
***************
*** 931,943 ****
  static void
  selectDumpableTable(TableInfo *tbinfo)
  {
  	/*
  	 * If specific tables are being dumped, dump just those tables; else, dump
  	 * according to the parent namespace's dump flag.
  	 */
  	if (table_include_oids.head != NULL)
! 		tbinfo->dobj.dump = simple_oid_list_member(&table_include_oids,
! 												   tbinfo->dobj.catId.oid);
  	else
  		tbinfo->dobj.dump = tbinfo->dobj.namespace->dobj.dump;
  
--- 957,980 ----
  static void
  selectDumpableTable(TableInfo *tbinfo)
  {
+ 	SimpleOidListCell *cell;
+ 
  	/*
  	 * If specific tables are being dumped, dump just those tables; else, dump
  	 * according to the parent namespace's dump flag.
  	 */
  	if (table_include_oids.head != NULL)
! 	{
! 		if (simple_oid_list_member(&table_include_oids,
! 								   tbinfo->dobj.catId.oid,
! 								   &cell))
! 		{
! 			tbinfo->dobj.dump = true;
! 			tbinfo->whereClauseExpr = (char *)cell->userData;
! 		}
! 		else
! 			tbinfo->dobj.dump = false;
! 	}
  	else
  		tbinfo->dobj.dump = tbinfo->dobj.namespace->dobj.dump;
  
***************
*** 946,952 ****
  	 */
  	if (tbinfo->dobj.dump &&
  		simple_oid_list_member(&table_exclude_oids,
! 							   tbinfo->dobj.catId.oid))
  		tbinfo->dobj.dump = false;
  }
  
--- 983,990 ----
  	 */
  	if (tbinfo->dobj.dump &&
  		simple_oid_list_member(&table_exclude_oids,
! 							   tbinfo->dobj.catId.oid,
! 							   NULL))
  		tbinfo->dobj.dump = false;
  }
  
***************
*** 1029,1059 ****
  	 */
  	selectSourceSchema(tbinfo->dobj.namespace->dobj.name);
  
! 	/*
! 	 * If possible, specify the column list explicitly so that we have no
! 	 * possibility of retrieving data in the wrong column order.  (The default
! 	 * column ordering of COPY will not be what we want in certain corner
! 	 * cases involving ADD COLUMN and inheritance.)
! 	 */
! 	if (g_fout->remoteVersion >= 70300)
! 		column_list = fmtCopyColumnList(tbinfo);
! 	else
! 		column_list = "";		/* can't select columns in COPY */
  
! 	if (oids && hasoids)
  	{
! 		appendPQExpBuffer(q, "COPY %s %s WITH OIDS TO stdout;",
  						  fmtQualifiedId(tbinfo->dobj.namespace->dobj.name,
  										 classname),
! 						  column_list);
  	}
  	else
  	{
! 		appendPQExpBuffer(q, "COPY %s %s TO stdout;",
  						  fmtQualifiedId(tbinfo->dobj.namespace->dobj.name,
  										 classname),
  						  column_list);
  	}
  	res = PQexec(g_conn, q->data);
  	check_sql_result(res, g_conn, q->data, PGRES_COPY_OUT);
  	PQclear(res);
--- 1067,1109 ----
  	 */
  	selectSourceSchema(tbinfo->dobj.namespace->dobj.name);
  
! 	appendPQExpBuffer(q, "COPY");
  
! 	if (tbinfo->whereClauseExpr)
  	{
! 		appendPQExpBuffer(q, " (SELECT %s FROM %s WHERE %s)",
! 						  fmtCopyColumnList(tbinfo, false),
  						  fmtQualifiedId(tbinfo->dobj.namespace->dobj.name,
  										 classname),
! 						  tbinfo->whereClauseExpr);
  	}
  	else
  	{
! 		/*
! 		 * If possible, specify the column list explicitly so that we have no
! 		 * possibility of retrieving data in the wrong column order.  (The default
! 		 * column ordering of COPY will not be what we want in certain corner
! 		 * cases involving ADD COLUMN and inheritance.)
! 		 */
! 		if (g_fout->remoteVersion >= 70300)
! 			column_list = fmtCopyColumnList(tbinfo, true);
! 		else
! 			column_list = "";		/* can't select columns in COPY */
! 
! 		appendPQExpBuffer(q, " %s %s",
  						  fmtQualifiedId(tbinfo->dobj.namespace->dobj.name,
  										 classname),
  						  column_list);
  	}
+ 
+ 	if (oids && hasoids)
+ 	{
+ 		appendPQExpBuffer(q, " WITH OIDS TO stdout;");
+ 	}
+ 	else
+ 	{
+ 		appendPQExpBuffer(q, " TO stdout;");
+ 	}
  	res = PQexec(g_conn, q->data);
  	check_sql_result(res, g_conn, q->data, PGRES_COPY_OUT);
  	PQclear(res);
***************
*** 1172,1177 ****
--- 1222,1232 ----
  										 classname));
  	}
  
+ 	if (tbinfo->whereClauseExpr)
+ 	{
+ 		appendPQExpBuffer(q, " WHERE %s", tbinfo->whereClauseExpr);
+ 	}
+ 
  	res = PQexec(g_conn, q->data);
  	check_sql_result(res, g_conn, q->data, PGRES_COMMAND_OK);
  
***************
*** 1298,1303 ****
--- 1353,1359 ----
  	PQExpBuffer copyBuf = createPQExpBuffer();
  	DataDumperPtr dumpFn;
  	char	   *copyStmt;
+ 	char	   *desc;
  
  	if (!dumpInserts)
  	{
***************
*** 1307,1313 ****
  		appendPQExpBuffer(copyBuf, "COPY %s ",
  						  fmtId(tbinfo->dobj.name));
  		appendPQExpBuffer(copyBuf, "%s %sFROM stdin;\n",
! 						  fmtCopyColumnList(tbinfo),
  					  (tdinfo->oids && tbinfo->hasoids) ? "WITH OIDS " : "");
  		copyStmt = copyBuf->data;
  	}
--- 1363,1369 ----
  		appendPQExpBuffer(copyBuf, "COPY %s ",
  						  fmtId(tbinfo->dobj.name));
  		appendPQExpBuffer(copyBuf, "%s %sFROM stdin;\n",
! 						  fmtCopyColumnList(tbinfo, true),
  					  (tdinfo->oids && tbinfo->hasoids) ? "WITH OIDS " : "");
  		copyStmt = copyBuf->data;
  	}
***************
*** 1318,1332 ****
  		copyStmt = NULL;
  	}
  
  	ArchiveEntry(fout, tdinfo->dobj.catId, tdinfo->dobj.dumpId,
  				 tbinfo->dobj.name,
  				 tbinfo->dobj.namespace->dobj.name,
  				 NULL,
  				 tbinfo->rolname, false,
! 				 "TABLE DATA", "", "", copyStmt,
  				 tdinfo->dobj.dependencies, tdinfo->dobj.nDeps,
  				 dumpFn, tdinfo);
  
  	destroyPQExpBuffer(copyBuf);
  }
  
--- 1374,1409 ----
  		copyStmt = NULL;
  	}
  
+ 	if (tbinfo->whereClauseExpr)
+ 	{
+ 		int l;
+ 		desc = malloc(64 + strlen(tbinfo->whereClauseExpr));
+ 		sprintf(desc, "TABLE DATA (WHERE %s)", tbinfo->whereClauseExpr);
+ 
+ 		/* don't allow \n or \r in what will be part of a comment in the output */
+ 		l = strlen(desc);
+ 		for(l=l-1; l>=0; l--)
+ 		{
+ 			if (desc[l] == '\n' || desc[l] == '\r')
+ 				desc[l] = ' ';
+ 		}
+ 	}
+ 	else
+ 	{
+ 		desc = strdup("TABLE DATA");
+ 	}
+ 
  	ArchiveEntry(fout, tdinfo->dobj.catId, tdinfo->dobj.dumpId,
  				 tbinfo->dobj.name,
  				 tbinfo->dobj.namespace->dobj.name,
  				 NULL,
  				 tbinfo->rolname, false,
! 				 desc, "", "", copyStmt,
  				 tdinfo->dobj.dependencies, tdinfo->dobj.nDeps,
  				 dumpFn, tdinfo);
  
+ 	free(desc);
+ 
  	destroyPQExpBuffer(copyBuf);
  }
  
***************
*** 10227,10233 ****
   * "", not an invalid "()" column list.
   */
  static const char *
! fmtCopyColumnList(const TableInfo *ti)
  {
  	static PQExpBuffer q = NULL;
  	int			numatts = ti->numatts;
--- 10304,10310 ----
   * "", not an invalid "()" column list.
   */
  static const char *
! fmtCopyColumnList(const TableInfo *ti, bool addParens)
  {
  	static PQExpBuffer q = NULL;
  	int			numatts = ti->numatts;
***************
*** 10241,10247 ****
  	else
  		q = createPQExpBuffer();
  
! 	appendPQExpBuffer(q, "(");
  	needComma = false;
  	for (i = 0; i < numatts; i++)
  	{
--- 10318,10325 ----
  	else
  		q = createPQExpBuffer();
  
! 	if (addParens)
! 		appendPQExpBuffer(q, "(");
  	needComma = false;
  	for (i = 0; i < numatts; i++)
  	{
***************
*** 10256,10262 ****
  	if (!needComma)
  		return "";				/* no undropped columns */
  
! 	appendPQExpBuffer(q, ")");
  	return q->data;
  }
  
--- 10334,10341 ----
  	if (!needComma)
  		return "";				/* no undropped columns */
  
! 	if (addParens)
! 		appendPQExpBuffer(q, ")");
  	return q->data;
  }
  
***************
*** 10296,10298 ****
--- 10375,10427 ----
  	write_msg(NULL, "The command was: %s\n", query);
  	exit_nicely();
  }
+ 
+ static void 
+ splitPatternAndWhere(char *arg, char **pattern, char **whereClauseExpr)
+ {
+ 	int state = 0;
+ 	char c;
+ 
+ 	/*
+ 	 * Find where a TBL_EXPR_SEP exists not between quotes
+ 	 */
+ 	(*pattern) = arg;
+ 	(*whereClauseExpr) = NULL;
+ 	for (; *arg; arg++)
+ 	{
+ 		c = *(arg);
+ 		switch (state)
+ 		{
+ 			case 0: /* waiting for open quote */
+ 				if (c == '"')
+ 					state = 1;
+ 				if (c == *TBL_EXPR_SEP)
+ 				{
+ 					/* found a TBL_EXPR_SEP not within quotes */
+ 					arg[0] = 0;
+ 					if (*(arg + 1)) /* make sure the expr isn't blank */
+ 						(*whereClauseExpr) = arg + 1;
+ 					return;
+ 				}
+ 				break;
+ 			case 1: /* within open quote */
+ 				if (c =='"')
+ 					state = 0; /* possible closing quote */
+ 				break;
+ 			case 2: /* possible closing quote */
+ 				if (c == '"')
+ 				{
+ 					/* encountered two consecutive quotes, still within quotes */
+ 					state = 1;
+ 				}
+ 				else
+ 				{
+ 					/* encountered closing quote in state 1, repeat this char in state 0 */
+ 					arg--;
+ 					state = 0;
+ 				}
+ 				break;
+ 		}
+ 	}
+ }
+ 
diff -cr postgresql-8.3.1.orig/src/bin/pg_dump/pg_dump.h postgresql-8.3.1/src/bin/pg_dump/pg_dump.h
*** postgresql-8.3.1.orig/src/bin/pg_dump/pg_dump.h	2008-05-31 17:48:25.000000000 -0500
--- postgresql-8.3.1/src/bin/pg_dump/pg_dump.h	2008-06-01 20:16:06.000000000 -0500
***************
*** 68,73 ****
--- 68,74 ----
  typedef struct SimpleOidListCell
  {
  	struct SimpleOidListCell *next;
+ 	void			*userData;
  	Oid			val;
  } SimpleOidListCell;
  
***************
*** 80,85 ****
--- 81,87 ----
  typedef struct SimpleStringListCell
  {
  	struct SimpleStringListCell *next;
+ 	void		*userData;
  	char		val[1];			/* VARIABLE LENGTH FIELD */
  } SimpleStringListCell;
  
***************
*** 274,279 ****
--- 276,282 ----
  	bool	   *inhAttrDef;		/* true if attr's default is inherited */
  	bool	   *inhNotNull;		/* true if NOT NULL is inherited */
  	struct _constraintInfo *checkexprs; /* CHECK constraints */
+ 	char	   *whereClauseExpr;
  
  	/*
  	 * Stuff computed only for dumpable tables.
***************
*** 454,462 ****
  extern FuncInfo *findFuncByOid(Oid oid);
  extern OprInfo *findOprByOid(Oid oid);
  
! extern void simple_oid_list_append(SimpleOidList *list, Oid val);
! extern void simple_string_list_append(SimpleStringList *list, const char *val);
! extern bool simple_oid_list_member(SimpleOidList *list, Oid val);
  extern bool simple_string_list_member(SimpleStringList *list, const char *val);
  
  extern char *pg_strdup(const char *string);
--- 457,465 ----
  extern FuncInfo *findFuncByOid(Oid oid);
  extern OprInfo *findOprByOid(Oid oid);
  
! extern SimpleOidListCell *simple_oid_list_append(SimpleOidList *list, Oid val);
! extern SimpleStringListCell *simple_string_list_append(SimpleStringList *list, const char *val);
! extern bool simple_oid_list_member(SimpleOidList *list, Oid val, SimpleOidListCell **found);
  extern bool simple_string_list_member(SimpleStringList *list, const char *val);
  
  extern char *pg_strdup(const char *string);
-- 
Sent via pgsql-patches mailing list (pgsql-patches@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-patches

Reply via email to