* getProcLangs * get basic information about every procedural language in the system * * numProcLangs is set to the number of langs read in * * NB: this must run after getFuncs() because we assume we can do * findFuncByOid(). */
| 9394 | * findFuncByOid(). |
| 9395 | */ |
| 9396 | ProcLangInfo * |
| 9397 | getProcLangs(Archive *fout, int *numProcLangs) |
| 9398 | { |
| 9399 | DumpOptions *dopt = fout->dopt; |
| 9400 | PGresult *res; |
| 9401 | int ntups; |
| 9402 | int i; |
| 9403 | PQExpBuffer query = createPQExpBuffer(); |
| 9404 | ProcLangInfo *planginfo; |
| 9405 | int i_tableoid; |
| 9406 | int i_oid; |
| 9407 | int i_lanname; |
| 9408 | int i_lanpltrusted; |
| 9409 | int i_lanplcallfoid; |
| 9410 | int i_laninline; |
| 9411 | int i_lanvalidator; |
| 9412 | int i_lanacl; |
| 9413 | int i_rlanacl; |
| 9414 | int i_initlanacl; |
| 9415 | int i_initrlanacl; |
| 9416 | int i_lanowner; |
| 9417 | |
| 9418 | /* |
| 9419 | * The laninline column was added in upstream 90000 but was backported to |
| 9420 | * Cloudberry 5, so the check needs to go further back than 90000. |
| 9421 | */ |
| 9422 | |
| 9423 | if (fout->remoteVersion >= 90600) |
| 9424 | { |
| 9425 | PQExpBuffer acl_subquery = createPQExpBuffer(); |
| 9426 | PQExpBuffer racl_subquery = createPQExpBuffer(); |
| 9427 | PQExpBuffer initacl_subquery = createPQExpBuffer(); |
| 9428 | PQExpBuffer initracl_subquery = createPQExpBuffer(); |
| 9429 | |
| 9430 | buildACLQueries(acl_subquery, racl_subquery, initacl_subquery, |
| 9431 | initracl_subquery, "l.lanacl", "l.lanowner", "'l'", |
| 9432 | dopt->binary_upgrade); |
| 9433 | |
| 9434 | /* pg_language has a laninline column */ |
| 9435 | appendPQExpBuffer(query, "SELECT l.tableoid, l.oid, " |
| 9436 | "l.lanname, l.lanpltrusted, l.lanplcallfoid, " |
| 9437 | "l.laninline, l.lanvalidator, " |
| 9438 | "%s AS lanacl, " |
| 9439 | "%s AS rlanacl, " |
| 9440 | "%s AS initlanacl, " |
| 9441 | "%s AS initrlanacl, " |
| 9442 | "(%s l.lanowner) AS lanowner " |
| 9443 | "FROM pg_language l " |
| 9444 | "LEFT JOIN pg_init_privs pip ON " |
| 9445 | "(l.oid = pip.objoid " |
| 9446 | "AND pip.classoid = 'pg_language'::regclass " |
| 9447 | "AND pip.objsubid = 0) " |
| 9448 | "WHERE l.lanispl " |
| 9449 | "ORDER BY l.oid", |
| 9450 | acl_subquery->data, |
| 9451 | racl_subquery->data, |
| 9452 | initacl_subquery->data, |
| 9453 | initracl_subquery->data, |
no test coverage detected