* getTypeOutputInfo * * Get info needed for printing values of a type */
| 3505 | * Get info needed for printing values of a type |
| 3506 | */ |
| 3507 | void |
| 3508 | getTypeOutputInfo(Oid type, Oid *typOutput, bool *typIsVarlena) |
| 3509 | { |
| 3510 | HeapTuple typeTuple; |
| 3511 | Form_pg_type pt; |
| 3512 | |
| 3513 | typeTuple = SearchSysCache1(TYPEOID, ObjectIdGetDatum(type)); |
| 3514 | if (!HeapTupleIsValid(typeTuple)) |
| 3515 | elog(ERROR, "cache lookup failed for type %u", type); |
| 3516 | pt = (Form_pg_type) GETSTRUCT(typeTuple); |
| 3517 | |
| 3518 | if (!pt->typisdefined) |
| 3519 | ereport(ERROR, |
| 3520 | (errcode(ERRCODE_UNDEFINED_OBJECT), |
| 3521 | errmsg("type %s is only a shell", |
| 3522 | format_type_be(type)))); |
| 3523 | if (!OidIsValid(pt->typoutput)) |
| 3524 | ereport(ERROR, |
| 3525 | (errcode(ERRCODE_UNDEFINED_FUNCTION), |
| 3526 | errmsg("no output function available for type %s", |
| 3527 | format_type_be(type)))); |
| 3528 | |
| 3529 | *typOutput = pt->typoutput; |
| 3530 | *typIsVarlena = (!pt->typbyval) && (pt->typlen == -1); |
| 3531 | |
| 3532 | ReleaseSysCache(typeTuple); |
| 3533 | } |
| 3534 | |
| 3535 | /* |
| 3536 | * getTypeBinaryInputInfo |