datum_t pg_tablespace_size_name(PG_FUNC_ARGS) { struct name* tblspcName = ARG_NAME(0); oid_t tblspcOid = tbs_get_oid(NAME_TO_STR(*tblspcName), false); RET_INT64(calculate_tablespace_size(tblspcOid)); }
Datum pg_tablespace_size_oid(PG_FUNCTION_ARGS) { Oid tblspcOid = PG_GETARG_OID(0); PG_RETURN_INT64(calculate_tablespace_size(tblspcOid)); }
datum_t pg_tablespace_size_oid(PG_FUNC_ARGS) { oid_t tblspcOid; tblspcOid = ARG_OID(0); RET_INT64(calculate_tablespace_size(tblspcOid)); }
Datum pg_tablespace_size_name(PG_FUNCTION_ARGS) { int64 size = 0; Name tblspcName = PG_GETARG_NAME(0); Oid tblspcOid = get_tablespace_oid(NameStr(*tblspcName)); if (!OidIsValid(tblspcOid)) ereport(ERROR, (errcode(ERRCODE_UNDEFINED_OBJECT), errmsg("tablespace \"%s\" does not exist", NameStr(*tblspcName)))); size = calculate_tablespace_size(tblspcOid); if (Gp_role == GP_ROLE_DISPATCH) { StringInfoData buffer; initStringInfo(&buffer); appendStringInfo(&buffer, "select sum(pg_tablespace_size('%s'))::int8 from gp_dist_random('gp_version_at_initdb');", NameStr(*tblspcName)); size += get_size_from_segDBs(buffer.data); } PG_RETURN_INT64(size); }
Datum pg_tablespace_size_name(PG_FUNCTION_ARGS) { Name tblspcName = PG_GETARG_NAME(0); Oid tblspcOid = get_tablespace_oid(NameStr(*tblspcName), false); PG_RETURN_INT64(calculate_tablespace_size(tblspcOid)); }
Datum pg_tablespace_size_oid(PG_FUNCTION_ARGS) { Oid tblspcOid = PG_GETARG_OID(0); int64 size; size = calculate_tablespace_size(tblspcOid); if (size < 0) PG_RETURN_NULL(); PG_RETURN_INT64(size); }
Datum pg_tablespace_size_name(PG_FUNCTION_ARGS) { Name tblspcName = PG_GETARG_NAME(0); Oid tblspcOid = get_tablespace_oid(NameStr(*tblspcName), false); int64 size; size = calculate_tablespace_size(tblspcOid); if (size < 0) PG_RETURN_NULL(); PG_RETURN_INT64(size); }
Datum pg_tablespace_size_name(PG_FUNCTION_ARGS) { Name tblspcName = PG_GETARG_NAME(0); Oid tblspcOid = get_tablespace_oid(NameStr(*tblspcName)); if (!OidIsValid(tblspcOid)) ereport(ERROR, (errcode(ERRCODE_UNDEFINED_OBJECT), errmsg("tablespace \"%s\" does not exist", NameStr(*tblspcName)))); PG_RETURN_INT64(calculate_tablespace_size(tblspcOid)); }
Datum pg_tablespace_size_oid(PG_FUNCTION_ARGS) { int64 size = 0; Oid tblspcOid = PG_GETARG_OID(0); size = calculate_tablespace_size(tblspcOid); if (Gp_role == GP_ROLE_DISPATCH) { StringInfoData buffer; initStringInfo(&buffer); appendStringInfo(&buffer, "select sum(pg_tablespace_size(%u))::int8 from gp_dist_random('gp_id');", tblspcOid); size += get_size_from_segDBs(buffer.data); } PG_RETURN_INT64(size); }
Datum pg_tablespace_size_oid(PG_FUNCTION_ARGS) { Oid tblspcOid = PG_GETARG_OID(0); int64 size; size = calculate_tablespace_size(tblspcOid); if (Gp_role == GP_ROLE_DISPATCH) { char *sql; sql = psprintf("select pg_catalog.pg_tablespace_size(%u)", tblspcOid); size += get_size_from_segDBs(sql); } if (size < 0) PG_RETURN_NULL(); PG_RETURN_INT64(size); }
Datum pg_tablespace_size_name(PG_FUNCTION_ARGS) { int64 size = 0; Name tblspcName = PG_GETARG_NAME(0); Oid tblspcOid = get_tablespace_oid(NameStr(*tblspcName), false); size = calculate_tablespace_size(tblspcOid); if (Gp_role == GP_ROLE_DISPATCH) { StringInfoData buffer; initStringInfo(&buffer); appendStringInfo(&buffer, "select sum(pg_tablespace_size('%s'))::int8 from gp_dist_random('gp_id');", NameStr(*tblspcName)); size += get_size_from_segDBs(buffer.data); } PG_RETURN_INT64(size); }
Datum pg_tablespace_size_name(PG_FUNCTION_ARGS) { Name tblspcName = PG_GETARG_NAME(0); Oid tblspcOid = get_tablespace_oid(NameStr(*tblspcName), false); int64 size; size = calculate_tablespace_size(tblspcOid); if (Gp_role == GP_ROLE_DISPATCH) { char *sql; sql = psprintf("select pg_catalog.pg_tablespace_size(%s)", quote_literal_cstr(NameStr(*tblspcName))); size += get_size_from_segDBs(sql); } if (size < 0) PG_RETURN_NULL(); PG_RETURN_INT64(size); }