PostgreSQL Source Code: src/bin/pg_upgrade/function.c Source File (original) (raw)

1

2

3

4

5

6

7

8

9

11

13#include "catalog/pg_language_d.h"

16

17

18

19

20

21

22

23

24

25

26

27

28static int

30{

31 const char *str1 = ((const LibraryInfo *) p1)->name;

32 const char *str2 = ((const LibraryInfo *) p2)->name;

33 size_t slen1 = strlen(str1);

34 size_t slen2 = strlen(str2);

35 int cmp = strcmp(str1, str2);

36

37 if (slen1 != slen2)

39 if (cmp != 0)

40 return cmp;

43}

44

45

46

47

49{

51 int totaltups;

52};

53

54

55

56

57

58

59static void

61{

63

65

68}

69

70

71

72

73

74

75

76

77

78void

80{

82 int dbnum;

83 int n_libinfos;

86 char *query;

87

89 state.totaltups = 0;

90

91 query = psprintf("SELECT DISTINCT probin "

92 "FROM pg_catalog.pg_proc "

93 "WHERE prolang = %u AND "

94 "probin IS NOT NULL AND "

95 "oid >= %u",

96 ClanguageId,

98

101

104

105

106

107

108

112

114 {

116 int ntups;

117 int rowno;

119

121 for (rowno = 0; rowno < ntups; rowno++)

122 {

123 char *lib = PQgetvalue(res, rowno, 0);

124

127

129 }

131

132

133

134

135

136

137

138 for (int slotno = 0; slotno < slot_arr->nslots; slotno++)

139 {

141 continue;

142

145

147 }

148 }

149

152

154}

155

156

157

158

159

160

161

162

163

164void

166{

168 int libnum;

169 int was_load_failure = false;

170 FILE *script = NULL;

172

173 prep_status("Checking for presence of required libraries");

174

175 snprintf(output_path, sizeof(output_path), "%s/%s",

177

178

179

180

181

182

183

186

188 {

190 int llen = strlen(lib);

193

194

196 {

197 strcpy(cmd, "LOAD '");

199 strcat(cmd, "'");

200

202

204 {

205 was_load_failure = true;

206

207 if (script == NULL && (script = fopen_priv(output_path, "w")) == NULL)

208 pg_fatal("could not open file \"%s\": %m", output_path);

209 fprintf(script, _("could not load library \"%s\": %s"),

210 lib,

212 }

213 else

214 was_load_failure = false;

215

217 }

218

219 if (was_load_failure)

220 fprintf(script, _("In database: %s\n"),

222 }

223

225

226 if (script)

227 {

228 fclose(script);

230 pg_fatal("Your installation references loadable libraries that are missing from the\n"

231 "new installation. You can add these libraries to the new installation,\n"

232 "or remove the functions using them from the old installation. A list of\n"

233 "problem libraries is in the file:\n"

234 " %s", output_path);

235 }

236 else

238}

#define AssertVariableIsOfType(varname, typename)

#define fprintf(file, fmt, msg)

void PQfinish(PGconn *conn)

char * PQerrorMessage(const PGconn *conn)

size_t PQescapeStringConn(PGconn *conn, char *to, const char *from, size_t length, int *error)

char * PQgetvalue(const PGresult *res, int tup_num, int field_num)

ExecStatusType PQresultStatus(const PGresult *res)

void PQclear(PGresult *res)

int PQntuples(const PGresult *res)

PGresult * PQexec(PGconn *conn, const char *query)

void * pg_malloc(size_t size)

char * pg_strdup(const char *in)

void check_loadable_libraries(void)

static void process_loadable_libraries(DbInfo *dbinfo, PGresult *res, void *arg)

static int library_name_compare(const void *p1, const void *p2)

void get_loadable_libraries(void)

int count_old_cluster_logical_slots(void)

static void check_ok(void)

static int pg_cmp_s32(int32 a, int32 b)

static int pg_cmp_size(size_t a, size_t b)

UpgradeTask * upgrade_task_create(void)

PGconn * connectToServer(ClusterInfo *cluster, const char *db_name)

void upgrade_task_run(const UpgradeTask *task, const ClusterInfo *cluster)

void void pg_log(eLogType type, const char *fmt,...) pg_attribute_printf(2

void upgrade_task_free(UpgradeTask *task)

#define fopen_priv(path, mode)

void(* UpgradeTaskProcessCB)(DbInfo *dbinfo, PGresult *res, void *arg)

void prep_status(const char *fmt,...) pg_attribute_printf(1

void upgrade_task_add_step(UpgradeTask *task, const char *query, UpgradeTaskProcessCB process_cb, bool free_result, void *arg)

#define qsort(a, b, c, d)

char * psprintf(const char *fmt,...)

static int cmp(const chr *x, const chr *y, size_t len)

LogicalSlotInfoArr slot_arr

#define FirstNormalObjectId