Skip to content

Commit bdbe9c9

Browse files
committed
pg_get_indexdef() didn't do quite the right thing with identifying
an index's tablespace.
1 parent ca14e3b commit bdbe9c9

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/backend/utils/adt/ruleutils.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* back to source text
44
*
55
* IDENTIFICATION
6-
* $PostgreSQL: pgsql/src/backend/utils/adt/ruleutils.c,v 1.182 2004/10/07 20:36:52 tgl Exp $
6+
* $PostgreSQL: pgsql/src/backend/utils/adt/ruleutils.c,v 1.183 2004/10/17 21:17:27 tgl Exp $
77
*
88
* This software is copyrighted by Jan Wieck - Hamburg.
99
*
@@ -58,6 +58,7 @@
5858
#include "commands/tablespace.h"
5959
#include "executor/spi.h"
6060
#include "lib/stringinfo.h"
61+
#include "miscadmin.h"
6162
#include "nodes/makefuncs.h"
6263
#include "optimizer/clauses.h"
6364
#include "optimizer/tlist.h"
@@ -777,10 +778,14 @@ pg_get_indexdef_worker(Oid indexrelid, int colno, int prettyFlags)
777778
* If the index is in a different tablespace from its parent, tell
778779
* about that
779780
*/
780-
if (OidIsValid(idxrelrec->reltablespace) &&
781-
idxrelrec->reltablespace != get_rel_tablespace(indrelid))
781+
if (idxrelrec->reltablespace != get_rel_tablespace(indrelid))
782782
{
783-
char *spcname = get_tablespace_name(idxrelrec->reltablespace);
783+
char *spcname;
784+
785+
if (OidIsValid(idxrelrec->reltablespace))
786+
spcname = get_tablespace_name(idxrelrec->reltablespace);
787+
else
788+
spcname = get_tablespace_name(MyDatabaseTableSpace);
784789

785790
if (spcname) /* just paranoia... */
786791
{

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy