Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit3769fa5

Browse files
committed
Make pg_tablespace_location(0) return the database's default tablespace.
This definition is convenient when applying the function to thereltablespace column of pg_class, since that's what zero means there;and it doesn't interfere with any other plausible use of the function.Per gripe from Bruce Momjian.
1 parent38458e4 commit3769fa5

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

‎src/backend/utils/adt/misc.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,15 @@ pg_tablespace_location(PG_FUNCTION_ARGS)
335335
intrllen;
336336

337337
/*
338-
* Return empty string for our default tablespaces
338+
* It's useful to apply this function to pg_class.reltablespace, wherein
339+
* zero means "the database's default tablespace". So, rather than
340+
* throwing an error for zero, we choose to assume that's what is meant.
341+
*/
342+
if (tablespaceOid==InvalidOid)
343+
tablespaceOid=MyDatabaseTableSpace;
344+
345+
/*
346+
* Return empty string for the cluster's default tablespaces
339347
*/
340348
if (tablespaceOid==DEFAULTTABLESPACE_OID||
341349
tablespaceOid==GLOBALTABLESPACE_OID)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp