- Notifications
You must be signed in to change notification settings - Fork5
Commit9394d62
committed
I have been working with user defined types and user defined c
functions. One problem that I have encountered with the functionmanager is that it does not allow the user to define type conversionfunctions that convert between user types. For instance if mytype1,mytype2, and mytype3 are three Postgresql user types, and if I wish todefine Postgresql conversion functions likeI run into problems, because the Postgresql dynamic loader would lookfor a single link symbol, mytype3, for both pieces of object code. IfI just change the name of one of the Postgresql functions (to make thesymbols distinct), the automatic type conversion that Postgresql uses,for example, when matching operators to arguments no longer finds thetype conversion function.The solution that I propose, and have implemented in the attatchedpatch extends the CREATE FUNCTION syntax as follows. In the first caseabove I use the link symbol mytype2_to_mytype3 for the link objectthat implements the first conversion function, and define thePostgresql operator with the following syntaxThe patch includes changes to the parser to include the alteredsyntax, changes to the ProcedureStmt node in nodes/parsenodes.h,changes to commands/define.c to handle the extra information in the ASclause, and changes to utils/fmgr/dfmgr.c that alter the way that thedynamic loader figures out what link symbol to use. I store thestring for the link symbol in the prosrc text attribute of the pg_proctable which is currently unused in rows that reference dynamicallyloadedfunctions.Bernie Frankpitt1 parent63a8508 commit9394d62
File tree
9 files changed
+223
-83
lines changed- doc/src/sgml
- ref
- src
- backend
- commands
- parser
- utils/fmgr
- bin/psql
- include/nodes
- interfaces/ecpg/preproc
- tools/backend
9 files changed
+223
-83
lines changedLines changed: 70 additions & 20 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1 | 1 |
| |
2 |
| - | |
| 2 | + | |
3 | 3 |
| |
4 | 4 |
| |
5 | 5 |
| |
| |||
25 | 25 |
| |
26 | 26 |
| |
27 | 27 |
| |
28 |
| - | |
| 28 | + | |
29 | 29 |
| |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
30 | 36 |
| |
31 | 37 |
| |
32 | 38 |
| |
| |||
83 | 89 |
| |
84 | 90 |
| |
85 | 91 |
| |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
86 | 108 |
| |
87 | 109 |
| |
88 | 110 |
| |
| |||
165 | 187 |
| |
166 | 188 |
| |
167 | 189 |
| |
168 |
| - | |
169 |
| - | |
170 |
| - | |
171 |
| - | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
172 | 194 |
| |
173 | 195 |
| |
174 | 196 |
| |
| |||
181 | 203 |
| |
182 | 204 |
| |
183 | 205 |
| |
184 |
| - | |
185 |
| - | |
186 |
| - | |
187 |
| - | |
188 |
| - | |
189 |
| - | |
190 |
| - | |
191 |
| - | |
192 |
| - | |
193 |
| - | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
194 | 212 |
| |
195 | 213 |
| |
| 214 | + | |
196 | 215 |
| |
197 | 216 |
| |
198 | 217 |
| |
| |||
227 | 246 |
| |
228 | 247 |
| |
229 | 248 |
| |
230 |
| - | |
231 | 249 |
| |
232 | 250 |
| |
233 | 251 |
| |
| |||
238 | 256 |
| |
239 | 257 |
| |
240 | 258 |
| |
241 |
| - | |
242 | 259 |
| |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
243 | 294 |
| |
244 | 295 |
| |
245 | 296 |
| |
| |||
283 | 334 |
| |
284 | 335 |
| |
285 | 336 |
| |
286 |
| - | |
287 |
| - | |
| 337 | + | |
288 | 338 |
| |
289 | 339 |
| |
290 | 340 |
| |
|
Lines changed: 41 additions & 20 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
357 | 357 |
| |
358 | 358 |
| |
359 | 359 |
| |
360 |
| - | |
361 |
| - | |
362 |
| - | |
363 |
| - | |
364 |
| - | |
365 |
| - | |
366 |
| - | |
367 |
| - | |
368 |
| - | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
369 | 383 |
| |
370 | 384 |
| |
371 | 385 |
| |
372 |
| - | |
373 |
| - | |
374 |
| - | |
375 |
| - | |
376 |
| - | |
377 |
| - | |
378 |
| - | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
379 | 397 |
| |
380 | 398 |
| |
381 | 399 |
| |
| |||
960 | 978 |
| |
961 | 979 |
| |
962 | 980 |
| |
963 |
| - | |
964 |
| - | |
965 |
| - | |
966 |
| - | |
| 981 | + | |
| 982 | + | |
| 983 | + | |
| 984 | + | |
| 985 | + | |
| 986 | + | |
| 987 | + | |
967 | 988 |
| |
968 | 989 |
| |
969 | 990 |
| |
|
Lines changed: 29 additions & 7 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
9 | 9 |
| |
10 | 10 |
| |
11 | 11 |
| |
12 |
| - | |
| 12 | + | |
13 | 13 |
| |
14 | 14 |
| |
15 | 15 |
| |
| |||
178 | 178 |
| |
179 | 179 |
| |
180 | 180 |
| |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
181 | 191 |
| |
182 | 192 |
| |
183 |
| - | |
| 193 | + | |
184 | 194 |
| |
185 | 195 |
| |
| 196 | + | |
186 | 197 |
| |
187 | 198 |
| |
188 | 199 |
| |
189 |
| - | |
190 |
| - | |
191 |
| - | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
192 | 210 |
| |
193 | 211 |
| |
194 | 212 |
| |
195 |
| - | |
196 |
| - | |
| 213 | + | |
| 214 | + | |
197 | 215 |
| |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
198 | 220 |
| |
199 | 221 |
| |
200 | 222 |
| |
|
Lines changed: 9 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
10 | 10 |
| |
11 | 11 |
| |
12 | 12 |
| |
13 |
| - | |
| 13 | + | |
14 | 14 |
| |
15 | 15 |
| |
16 | 16 |
| |
| |||
163 | 163 |
| |
164 | 164 |
| |
165 | 165 |
| |
166 |
| - | |
| 166 | + | |
167 | 167 |
| |
168 | 168 |
| |
169 | 169 |
| |
| |||
1923 | 1923 |
| |
1924 | 1924 |
| |
1925 | 1925 |
| |
1926 |
| - | |
| 1926 | + | |
1927 | 1927 |
| |
1928 | 1928 |
| |
1929 | 1929 |
| |
| |||
1949 | 1949 |
| |
1950 | 1950 |
| |
1951 | 1951 |
| |
| 1952 | + | |
| 1953 | + | |
| 1954 | + | |
| 1955 | + | |
| 1956 | + | |
| 1957 | + | |
1952 | 1958 |
| |
1953 | 1959 |
| |
1954 | 1960 |
| |
|
Lines changed: 31 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
7 | 7 |
| |
8 | 8 |
| |
9 | 9 |
| |
10 |
| - | |
| 10 | + | |
11 | 11 |
| |
12 | 12 |
| |
13 | 13 |
| |
| |||
42 | 42 |
| |
43 | 43 |
| |
44 | 44 |
| |
45 |
| - | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
46 | 48 |
| |
| 49 | + | |
47 | 50 |
| |
48 | 51 |
| |
49 | 52 |
| |
| |||
90 | 93 |
| |
91 | 94 |
| |
92 | 95 |
| |
93 |
| - | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
94 | 122 |
| |
95 | 123 |
| |
96 | 124 |
| |
|
0 commit comments
Comments
(0)