Datum pg_database_size_oid(PG_FUNCTION_ARGS) { Oid dbOid = PG_GETARG_OID(0); PG_RETURN_INT64(calculate_database_size(dbOid)); }
datum_t pg_database_size_name(PG_FUNC_ARGS) { struct name* dbName = ARG_NAME(0); oid_t dbOid = get_db_oid(NAME_TO_STR(*dbName), false); RET_INT64(calculate_database_size(dbOid)); }
Datum pg_database_size_name(PG_FUNCTION_ARGS) { int64 size = 0; Name dbName = PG_GETARG_NAME(0); Oid dbOid = get_database_oid(NameStr(*dbName)); if (!OidIsValid(dbOid)) ereport(ERROR, (errcode(ERRCODE_UNDEFINED_DATABASE), errmsg("database \"%s\" does not exist", NameStr(*dbName)))); size = calculate_database_size(dbOid); if (Gp_role == GP_ROLE_DISPATCH) { StringInfoData buffer; initStringInfo(&buffer); appendStringInfo(&buffer, "select sum(pg_database_size('%s'))::int8 from gp_dist_random('gp_id');", NameStr(*dbName)); size += get_size_from_segDBs(buffer.data); } PG_RETURN_INT64(size); }
Datum pg_database_size_name(PG_FUNCTION_ARGS) { Name dbName = PG_GETARG_NAME(0); Oid dbOid = get_database_oid(NameStr(*dbName), false); PG_RETURN_INT64(calculate_database_size(dbOid)); }
Datum pg_database_size_oid(PG_FUNCTION_ARGS) { int64 size = 0; Oid dbOid = PG_GETARG_OID(0); size = calculate_database_size(dbOid); PG_RETURN_INT64(size); }
Datum pg_database_size_oid(PG_FUNCTION_ARGS) { Oid dbOid = PG_GETARG_OID(0); int64 size; size = calculate_database_size(dbOid); if (size == 0) PG_RETURN_NULL(); PG_RETURN_INT64(size); }
Datum pg_database_size_name(PG_FUNCTION_ARGS) { Name dbName = PG_GETARG_NAME(0); Oid dbOid = get_database_oid(NameStr(*dbName), false); int64 size; size = calculate_database_size(dbOid); if (size == 0) PG_RETURN_NULL(); PG_RETURN_INT64(size); }
Datum pg_database_size_name(PG_FUNCTION_ARGS) { Name dbName = PG_GETARG_NAME(0); Oid dbOid = get_database_oid(NameStr(*dbName)); if (!OidIsValid(dbOid)) ereport(ERROR, (errcode(ERRCODE_UNDEFINED_DATABASE), errmsg("database \"%s\" does not exist", NameStr(*dbName)))); PG_RETURN_INT64(calculate_database_size(dbOid)); }
Datum pg_database_size_oid(PG_FUNCTION_ARGS) { int64 size = 0; Oid dbOid = PG_GETARG_OID(0); size = calculate_database_size(dbOid); if (Gp_role == GP_ROLE_DISPATCH) { StringInfoData buffer; initStringInfo(&buffer); appendStringInfo(&buffer, "select sum(pg_database_size(%u))::int8 from gp_dist_random('gp_id');", dbOid); size += get_size_from_segDBs(buffer.data); } PG_RETURN_INT64(size); }
Datum pg_database_size_oid(PG_FUNCTION_ARGS) { Oid dbOid = PG_GETARG_OID(0); int64 size; size = calculate_database_size(dbOid); if (Gp_role == GP_ROLE_DISPATCH) { char *sql; sql = psprintf("select pg_catalog.pg_database_size(%u)", dbOid); size += get_size_from_segDBs(sql); } if (size == 0) PG_RETURN_NULL(); PG_RETURN_INT64(size); }
Datum pg_database_size_name(PG_FUNCTION_ARGS) { int64 size = 0; Name dbName = PG_GETARG_NAME(0); Oid dbOid = get_database_oid(NameStr(*dbName), false); size = calculate_database_size(dbOid); if (Gp_role == GP_ROLE_DISPATCH) { StringInfoData buffer; initStringInfo(&buffer); appendStringInfo(&buffer, "select sum(pg_database_size('%s'))::int8 from gp_dist_random('gp_id');", NameStr(*dbName)); size += get_size_from_segDBs(buffer.data); } PG_RETURN_INT64(size); }
Datum pg_database_size_name(PG_FUNCTION_ARGS) { Name dbName = PG_GETARG_NAME(0); Oid dbOid = get_database_oid(NameStr(*dbName), false); int64 size; size = calculate_database_size(dbOid); if (Gp_role == GP_ROLE_DISPATCH) { char *sql; sql = psprintf("select pg_catalog.pg_database_size(%s)", quote_literal_cstr(NameStr(*dbName))); size += get_size_from_segDBs(sql); } if (size == 0) PG_RETURN_NULL(); PG_RETURN_INT64(size); }
datum_t pg_database_size_oid(PG_FUNC_ARGS) { oid_t dbOid = ARG_OID(0); RET_INT64(calculate_database_size(dbOid)); }