aboutsummaryrefslogtreecommitdiff
path: root/doc/TODO.detail/schema
blob: b7c8464578597c2bdbd72b2fdba29c9f7b8b494a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
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
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356
5357
5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
5404
5405
5406
5407
5408
5409
5410
5411
5412
5413
5414
5415
5416
5417
5418
5419
5420
5421
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
5432
5433
5434
5435
5436
5437
5438
5439
5440
5441
5442
5443
5444
5445
5446
5447
5448
5449
5450
5451
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
5479
5480
5481
5482
5483
5484
5485
5486
5487
5488
5489
5490
5491
5492
5493
5494
5495
5496
5497
5498
5499
5500
5501
5502
5503
5504
5505
5506
5507
5508
5509
5510
5511
5512
5513
5514
5515
5516
5517
5518
5519
5520
5521
5522
5523
5524
5525
5526
5527
5528
5529
5530
5531
5532
5533
5534
5535
5536
5537
5538
5539
5540
5541
5542
5543
5544
5545
5546
5547
5548
5549
5550
5551
5552
5553
5554
5555
5556
5557
5558
5559
5560
5561
5562
5563
5564
5565
5566
5567
5568
5569
5570
5571
5572
5573
5574
5575
5576
5577
5578
5579
5580
5581
5582
5583
5584
5585
5586
5587
5588
5589
5590
5591
5592
5593
5594
5595
5596
5597
5598
5599
5600
5601
5602
5603
5604
5605
5606
5607
5608
5609
5610
5611
5612
5613
5614
5615
5616
5617
5618
5619
5620
5621
5622
5623
5624
5625
5626
5627
5628
5629
5630
5631
5632
5633
5634
5635
5636
5637
5638
5639
5640
5641
5642
5643
5644
5645
5646
5647
5648
5649
5650
5651
5652
5653
5654
5655
5656
5657
5658
5659
5660
5661
5662
5663
5664
5665
5666
5667
5668
5669
5670
5671
5672
5673
5674
5675
5676
5677
5678
5679
5680
5681
5682
5683
5684
5685
5686
5687
5688
5689
5690
5691
5692
5693
5694
5695
5696
5697
5698
5699
5700
5701
5702
5703
5704
5705
5706
5707
5708
5709
5710
5711
5712
5713
5714
5715
5716
5717
5718
5719
5720
5721
5722
5723
5724
5725
5726
5727
5728
5729
5730
5731
5732
5733
5734
5735
5736
5737
5738
5739
5740
5741
5742
5743
5744
5745
5746
5747
5748
5749
5750
5751
5752
5753
5754
5755
5756
5757
5758
5759
5760
5761
5762
5763
5764
5765
5766
5767
5768
5769
5770
5771
5772
5773
5774
5775
5776
5777
5778
5779
5780
5781
5782
5783
5784
5785
5786
5787
5788
5789
5790
5791
5792
5793
5794
5795
5796
5797
5798
5799
5800
5801
5802
5803
5804
5805
5806
5807
5808
5809
5810
5811
5812
5813
5814
5815
5816
5817
5818
5819
5820
5821
5822
5823
5824
5825
5826
5827
5828
5829
5830
5831
5832
5833
5834
5835
5836
5837
5838
5839
5840
5841
5842
5843
5844
5845
5846
5847
5848
5849
5850
5851
5852
5853
5854
5855
5856
5857
5858
5859
5860
5861
5862
5863
5864
5865
5866
5867
5868
5869
5870
5871
5872
5873
5874
5875
5876
5877
5878
5879
5880
5881
5882
5883
5884
5885
5886
5887
5888
5889
5890
5891
5892
5893
5894
5895
5896
5897
5898
5899
5900
5901
5902
5903
5904
5905
5906
5907
5908
5909
5910
5911
5912
5913
5914
5915
5916
5917
5918
5919
5920
5921
5922
5923
5924
5925
5926
5927
5928
5929
5930
5931
5932
5933
5934
5935
5936
5937
5938
5939
5940
5941
5942
5943
5944
5945
5946
5947
5948
5949
5950
5951
5952
5953
5954
5955
5956
5957
5958
5959
5960
5961
5962
5963
5964
5965
5966
5967
5968
5969
5970
5971
5972
5973
5974
5975
5976
5977
5978
5979
5980
5981
5982
5983
5984
5985
5986
5987
5988
5989
5990
5991
5992
5993
5994
5995
5996
5997
5998
5999
6000
6001
6002
6003
6004
6005
6006
6007
6008
6009
6010
6011
6012
6013
6014
6015
6016
6017
6018
6019
6020
6021
6022
6023
6024
6025
6026
6027
6028
6029
6030
6031
6032
6033
6034
6035
6036
6037
6038
6039
6040
6041
6042
6043
6044
6045
6046
6047
6048
6049
6050
6051
6052
6053
6054
6055
6056
6057
6058
6059
6060
6061
6062
6063
6064
6065
6066
6067
6068
6069
6070
6071
6072
6073
6074
6075
6076
6077
6078
6079
6080
6081
6082
6083
6084
6085
6086
6087
6088
6089
6090
6091
6092
6093
6094
6095
6096
6097
6098
6099
6100
6101
6102
6103
6104
6105
6106
6107
6108
6109
6110
6111
6112
6113
6114
6115
6116
6117
6118
6119
6120
6121
6122
6123
6124
6125
6126
6127
6128
6129
6130
6131
6132
6133
6134
6135
6136
6137
6138
6139
6140
6141
6142
6143
6144
6145
6146
6147
6148
6149
6150
6151
6152
6153
6154
6155
6156
6157
6158
6159
6160
6161
6162
6163
6164
6165
6166
6167
6168
6169
6170
6171
6172
6173
6174
6175
6176
6177
6178
6179
6180
6181
6182
6183
6184
6185
6186
6187
6188
6189
6190
6191
6192
6193
6194
6195
6196
6197
6198
6199
6200
6201
6202
6203
6204
6205
6206
6207
6208
6209
6210
6211
6212
6213
6214
6215
6216
6217
6218
6219
6220
6221
6222
6223
6224
6225
6226
6227
6228
6229
6230
6231
6232
6233
6234
6235
6236
6237
6238
6239
6240
6241
6242
6243
6244
6245
6246
6247
6248
6249
6250
6251
6252
6253
6254
6255
6256
6257
6258
6259
6260
6261
6262
6263
6264
6265
6266
6267
6268
6269
6270
6271
6272
6273
6274
6275
6276
6277
6278
6279
6280
6281
6282
6283
6284
6285
6286
6287
6288
6289
6290
6291
6292
6293
6294
6295
6296
6297
6298
6299
6300
6301
6302
6303
6304
6305
6306
6307
6308
6309
6310
6311
6312
6313
6314
6315
6316
6317
6318
6319
6320
6321
6322
6323
6324
6325
6326
6327
6328
6329
6330
6331
6332
6333
6334
6335
6336
6337
6338
6339
6340
6341
6342
6343
6344
6345
6346
6347
6348
6349
6350
6351
6352
6353
6354
6355
6356
6357
6358
6359
6360
6361
6362
6363
6364
6365
6366
6367
6368
6369
6370
6371
6372
6373
6374
6375
6376
6377
6378
6379
6380
6381
6382
6383
6384
6385
6386
6387
6388
6389
6390
6391
6392
6393
6394
6395
6396
6397
6398
6399
6400
6401
6402
6403
6404
6405
6406
6407
6408
6409
6410
6411
6412
6413
6414
6415
6416
6417
6418
6419
6420
6421
6422
6423
6424
6425
6426
6427
6428
6429
6430
6431
6432
6433
6434
6435
6436
6437
6438
6439
6440
6441
6442
6443
6444
6445
6446
6447
6448
6449
6450
6451
6452
6453
6454
6455
6456
6457
6458
6459
6460
6461
6462
6463
6464
6465
6466
6467
6468
6469
6470
6471
6472
6473
6474
6475
6476
6477
6478
6479
6480
6481
6482
6483
6484
6485
6486
6487
6488
6489
6490
6491
6492
6493
6494
6495
6496
6497
6498
6499
6500
6501
6502
6503
6504
6505
6506
6507
6508
6509
6510
6511
6512
6513
6514
6515
6516
6517
6518
6519
6520
6521
6522
6523
6524
6525
6526
6527
6528
6529
6530
6531
6532
6533
6534
6535
6536
6537
6538
6539
6540
6541
6542
6543
6544
6545
6546
6547
6548
6549
6550
6551
6552
6553
6554
6555
6556
6557
6558
6559
6560
6561
6562
6563
6564
6565
6566
6567
6568
6569
6570
6571
6572
6573
6574
6575
6576
6577
6578
6579
6580
6581
6582
6583
6584
6585
6586
6587
6588
6589
6590
6591
6592
6593
6594
6595
6596
6597
6598
6599
6600
6601
6602
6603
6604
6605
6606
6607
6608
6609
6610
6611
6612
6613
6614
6615
6616
6617
6618
6619
6620
6621
6622
6623
6624
6625
6626
6627
6628
6629
6630
6631
6632
6633
6634
6635
6636
6637
6638
6639
6640
6641
6642
6643
6644
6645
6646
6647
6648
6649
6650
6651
6652
6653
6654
6655
6656
6657
6658
6659
6660
6661
6662
6663
6664
6665
6666
6667
6668
6669
6670
6671
6672
6673
6674
6675
6676
6677
6678
6679
6680
6681
6682
6683
6684
6685
6686
6687
6688
6689
6690
6691
6692
6693
6694
6695
6696
6697
6698
6699
6700
6701
6702
6703
6704
6705
6706
6707
6708
6709
6710
6711
6712
6713
6714
6715
6716
6717
6718
6719
6720
6721
6722
6723
6724
6725
6726
6727
6728
6729
6730
6731
6732
6733
6734
6735
6736
6737
6738
6739
6740
6741
6742
6743
6744
6745
6746
6747
6748
6749
6750
6751
6752
6753
6754
6755
6756
6757
6758
6759
6760
6761
6762
6763
6764
6765
6766
6767
6768
6769
6770
6771
6772
6773
6774
6775
6776
6777
6778
6779
6780
6781
6782
6783
6784
6785
6786
6787
6788
6789
6790
6791
6792
6793
6794
6795
6796
6797
6798
6799
6800
6801
6802
6803
6804
6805
6806
6807
6808
6809
6810
6811
6812
6813
6814
6815
6816
6817
6818
6819
6820
6821
6822
6823
6824
6825
6826
6827
6828
6829
6830
6831
6832
6833
6834
6835
6836
6837
6838
6839
6840
6841
6842
6843
6844
6845
6846
6847
6848
6849
6850
6851
6852
6853
6854
6855
6856
6857
6858
6859
6860
6861
6862
6863
6864
6865
6866
6867
6868
6869
6870
6871
6872
6873
6874
6875
6876
6877
6878
6879
6880
6881
6882
6883
6884
6885
6886
6887
6888
6889
6890
6891
6892
6893
6894
6895
6896
6897
6898
6899
6900
6901
6902
6903
6904
6905
6906
6907
6908
6909
6910
6911
6912
6913
6914
6915
6916
6917
6918
6919
6920
6921
6922
6923
6924
6925
6926
6927
6928
6929
6930
6931
6932
6933
6934
6935
6936
6937
6938
6939
6940
6941
6942
6943
6944
6945
6946
6947
6948
6949
6950
6951
6952
6953
6954
6955
6956
6957
6958
6959
6960
6961
6962
6963
6964
6965
6966
6967
6968
6969
6970
6971
6972
6973
6974
6975
6976
6977
6978
6979
6980
6981
6982
6983
6984
6985
6986
6987
6988
6989
6990
6991
6992
6993
6994
6995
6996
6997
6998
6999
7000
7001
7002
7003
7004
7005
7006
7007
7008
7009
7010
7011
7012
7013
7014
7015
7016
7017
7018
7019
7020
7021
7022
7023
7024
7025
7026
7027
7028
7029
7030
7031
7032
7033
7034
7035
7036
7037
7038
7039
7040
7041
7042
7043
7044
7045
7046
7047
7048
7049
7050
7051
7052
7053
7054
7055
7056
7057
7058
7059
7060
7061
7062
7063
7064
7065
7066
7067
7068
7069
7070
7071
7072
7073
7074
7075
7076
7077
7078
7079
7080
7081
7082
7083
7084
7085
7086
7087
7088
7089
7090
7091
7092
7093
7094
7095
7096
7097
7098
7099
7100
7101
7102
7103
7104
7105
7106
7107
7108
7109
7110
7111
7112
7113
7114
7115
7116
7117
7118
7119
7120
7121
7122
7123
7124
7125
7126
7127
7128
7129
7130
7131
7132
7133
7134
7135
7136
7137
7138
7139
7140
7141
7142
7143
7144
7145
7146
7147
7148
7149
7150
7151
7152
7153
7154
7155
7156
7157
7158
7159
7160
7161
7162
7163
7164
7165
7166
7167
7168
7169
7170
7171
7172
7173
7174
7175
7176
7177
7178
7179
7180
7181
7182
7183
7184
7185
7186
7187
7188
7189
7190
7191
7192
7193
7194
7195
7196
7197
7198
7199
7200
7201
7202
7203
7204
7205
7206
7207
7208
7209
7210
7211
7212
7213
7214
7215
7216
7217
7218
7219
7220
7221
7222
7223
7224
7225
7226
7227
7228
7229
7230
7231
7232
7233
7234
7235
7236
7237
7238
7239
7240
7241
7242
7243
7244
7245
7246
7247
7248
7249
7250
7251
7252
7253
7254
7255
7256
7257
7258
7259
7260
7261
7262
7263
7264
7265
7266
7267
7268
7269
7270
7271
7272
7273
7274
7275
7276
7277
7278
7279
7280
7281
7282
7283
7284
7285
7286
7287
7288
7289
7290
7291
7292
7293
7294
7295
7296
7297
7298
7299
7300
7301
7302
7303
7304
7305
7306
7307
7308
7309
7310
7311
7312
7313
7314
7315
7316
7317
7318
7319
7320
7321
7322
7323
7324
7325
7326
7327
7328
7329
7330
7331
7332
7333
7334
7335
7336
7337
7338
7339
7340
7341
7342
7343
7344
7345
7346
7347
7348
7349
7350
7351
7352
7353
7354
7355
7356
7357
7358
7359
7360
7361
7362
7363
7364
7365
7366
7367
7368
7369
7370
7371
7372
7373
7374
7375
7376
7377
7378
7379
7380
7381
7382
7383
7384
7385
7386
7387
7388
7389
7390
7391
7392
7393
7394
7395
7396
7397
7398
7399
7400
7401
7402
7403
7404
7405
7406
7407
7408
7409
7410
7411
7412
7413
7414
7415
7416
7417
7418
7419
7420
7421
7422
7423
7424
7425
7426
7427
7428
7429
7430
7431
7432
7433
7434
7435
7436
7437
7438
7439
7440
7441
7442
7443
7444
7445
7446
7447
7448
7449
7450
7451
7452
7453
7454
7455
7456
7457
7458
7459
7460
7461
7462
7463
7464
7465
7466
7467
7468
7469
7470
7471
7472
7473
7474
7475
7476
7477
7478
7479
7480
7481
7482
7483
7484
7485
7486
7487
7488
7489
7490
7491
7492
7493
7494
7495
7496
7497
7498
7499
7500
7501
7502
7503
7504
7505
7506
7507
7508
7509
7510
7511
7512
7513
7514
7515
7516
7517
7518
7519
7520
7521
7522
7523
7524
7525
7526
7527
7528
7529
7530
7531
7532
7533
7534
7535
7536
7537
7538
7539
7540
7541
7542
7543
7544
7545
7546
7547
7548
7549
7550
7551
7552
7553
7554
7555
7556
7557
7558
7559
7560
7561
7562
7563
7564
7565
7566
7567
7568
7569
7570
7571
7572
7573
7574
7575
7576
7577
7578
7579
7580
7581
7582
7583
7584
7585
7586
7587
7588
7589
7590
7591
7592
7593
7594
7595
7596
7597
7598
7599
7600
7601
7602
7603
7604
7605
7606
7607
7608
7609
7610
7611
7612
7613
7614
7615
7616
7617
7618
7619
7620
7621
7622
7623
7624
7625
7626
7627
7628
7629
7630
7631
7632
7633
7634
7635
7636
7637
7638
7639
7640
7641
7642
7643
7644
7645
7646
7647
7648
7649
7650
7651
7652
7653
7654
7655
7656
7657
7658
7659
7660
7661
7662
7663
7664
7665
7666
7667
7668
7669
7670
7671
7672
7673
7674
7675
7676
7677
7678
7679
7680
7681
7682
7683
7684
7685
7686
7687
7688
7689
7690
7691
7692
7693
7694
7695
7696
7697
7698
7699
7700
7701
7702
7703
7704
7705
7706
7707
7708
7709
7710
7711
7712
7713
7714
7715
7716
7717
7718
7719
7720
7721
7722
7723
7724
7725
7726
7727
7728
7729
7730
7731
7732
7733
7734
7735
7736
7737
7738
7739
7740
7741
7742
7743
7744
7745
7746
7747
7748
7749
7750
7751
7752
7753
7754
7755
7756
7757
7758
7759
7760
7761
7762
7763
7764
7765
7766
7767
7768
7769
7770
7771
7772
7773
7774
7775
7776
7777
7778
7779
7780
7781
7782
7783
7784
7785
7786
7787
7788
7789
7790
7791
7792
7793
7794
7795
7796
7797
7798
7799
7800
7801
7802
7803
7804
7805
7806
7807
7808
7809
7810
7811
7812
7813
7814
7815
7816
7817
From ronz@ravensfield.com Tue May 22 17:35:37 2001
Return-path: <ronz@ravensfield.com>
Received: from carp.ravensfield.com ([209.41.227.126])
	by candle.pha.pa.us (8.10.1/8.10.1) with ESMTP id f4MLZaQ17913
	for <pgman@candle.pha.pa.us>; Tue, 22 May 2001 17:35:37 -0400 (EDT)
Received: from coho.ravensfield.com (coho [209.41.227.117])
	by carp.ravensfield.com (Postfix) with SMTP
	id 5C2A9800D; Tue, 22 May 2001 16:46:38 -0500 (EST)
Content-Type: text/plain;
  charset="iso-8859-1"
From: Andrew Rawnsley <ronz@ravensfield.com>
Organization: Ravensfield Geographic
To: Bruce Momjian <pgman@candle.pha.pa.us>
Subject: Re: [GENERAL] Queries across multiple databases (was: SELECT from a table in another database).
Date: Tue, 22 May 2001 17:37:25 -0400
X-Mailer: KMail [version 1.2]
cc: Tom Lane <tgl@sss.pgh.pa.us>
References: <200105220437.f4M4bUA00539@candle.pha.pa.us>
In-Reply-To: <200105220437.f4M4bUA00539@candle.pha.pa.us>
MIME-Version: 1.0
Message-ID: <01052217372504.01367@coho.ravensfield.com>
Content-Transfer-Encoding: 8bit
Status: ORr

On Tuesday 22 May 2001 12:37am, Bruce Momjian wrote:
> Can you send me a little sample of SCHEMA use?   

Pardon if this is more long-winded or tangental than you are looking for...

What may beconfusing many people (not excluding myself from time to time) is 
that cross-schema queries may have nothing to do with cross-database queries, 
which is an entirely different kettle of trout.... SCHEMAs as used by at 
least by Oracle and Sybase are nothing more than users/object owners (I have 
no experience with DB2 or Informix, or anything more exotic than that).

Just off the top of my head, what would satisfy most people would be to be 
able to refer to objects as OWNER.OBJECT, with owner being 'within' the 
database (i.e. DATABASE.OWNER.OBJECT, which is how Sybase does it. Oracle has 
no 'database' parallel like that).  Whether you do it Oracle-fashion and use 
the term SCHEMA for owner pretty universally or Sybase fashion and just pay 
lip service to the word doesn't really matter (unless there is a standards 
compliance issue). 

As to creating schemas...In Oracle you have to execute the CREATE SCHEMA 
AUTHORIZATION <user> while logged in as that user before you can add objects 
under that user's ownership. While it seems trivial, if you have a situation 
where you do not want to grant a user session rights, you have to grant them 
session rights, log in as them, execute CREATE SCHEMA..., then revoke the 
session rights. Bah. A table created by user X in schema Y is also owned by 
user Y, and its user Y that has to have many of the object rights to create 
that table.

In Sybase, its essentially the same except the only real use for the CREATE 
SCHEMA command is for compliance and to group some DDL commands together. 
Other than that, Sybase always refers to schemas as owners. You don't have to 
execute CREATE SCHEMA... to create objects - you just need the rights. I've 
never used it at least - the only thing I see in it is eliminating the need 
to type 'go' after every DDL command.

As for examples from Oracle space -

Here is a foreign key reference with delete triggers from a table in 
schema/user PROJECT to tables in schemas/users SERVICES and WEBCAL:

CREATE TABLE PROJECT.tasks_users (
� �event_id INTEGER REFERENCES WEBCAL.tasks(event_id) ON DELETE CASCADE,
� �user_id VARCHAR2(25) REFERENCES SERVICES.users(user_id) ON DELETE CASCADE,
� �confirmed CHAR(1),
� �PRIMARY KEY (event_id,user_id)
);

A join between tables in  would be 
SELECT � A.SAMPLE_ID, 
�������� ������� A.CONCENTRATION, 
�������� ������� A.CASNO, 
�������� ������� B.PARAMETER,
�������� ������� C.DESCRIPTION AS STYPE 
�������� FROM HAI.RESULTS A, SAMPLETRACK.PARAMETERS B, 
SAMPLETRACK.SAMPLE_TYPE C
�������� ������� WHERE A.CASNO = B.CASNO AND A.SAMPLE_TYPE = B.SAMPLE_TYPE

In both Oracle and Sybase, all the objects are in the same 'database' 
(instance in Oracle), as I assume they would be in Postgres.  There is I 
assume a name space issue - one should be able to create a FOO.BAR and a 
BAR.BAR in the same database.

> I may be adding it to
> 7.2 inside the same code that maps temp table names to real tables.
>

Excellent!  I see light at the end of the tunnel (I will say the Postgres 
maintainers are among the most solidly competent around - one never has any 
real doubts about the system's progress).

-- 
Regards,

Andrew Rawnsley
Ravensfield Digital Resource Group, Ltd.
(740) 587-0114
www.ravensfield.com

From reedstrm@rice.edu Wed May 23 10:59:42 2001
Return-path: <reedstrm@rice.edu>
Received: from ece.rice.edu (ece.rice.edu [128.42.4.34])
	by candle.pha.pa.us (8.10.1/8.10.1) with ESMTP id f4NExgQ05774
	for <pgman@candle.pha.pa.us>; Wed, 23 May 2001 10:59:42 -0400 (EDT)
Received: from wallace.ece.rice.edu (wallace.ece.rice.edu [128.42.12.154])
	by ece.rice.edu (Postfix) with ESMTP id A419F68A0E
	for <pgman@candle.pha.pa.us>; Wed, 23 May 2001 09:59:36 -0500 (CDT)
Received: from reedstrm by wallace.ece.rice.edu with local (Exim 3.22 #1 (Debian))
	id 152a41-0006E5-00
	for <pgman@candle.pha.pa.us>; Wed, 23 May 2001 09:56:41 -0500
Date: Wed, 23 May 2001 09:56:41 -0500
From: "Ross J. Reedstrom" <reedstrm@rice.edu>
To: Bruce Momjian <pgman@candle.pha.pa.us>
Subject: Re: [HACKERS] Re: [GENERAL] Re: [GENERAL] Queries across multiple databases ?(was: SELECT from a table in another database).
Message-ID: <20010523095641.D23741@rice.edu>
References: <004c01c0e214$ce6c4800$1001a8c0@archonet.com> <200105221131.f4MBVIc28574@candle.pha.pa.us>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
User-Agent: Mutt/1.3.17i
In-Reply-To: <200105221131.f4MBVIc28574@candle.pha.pa.us>; from pgman@candle.pha.pa.us on Tue, May 22, 2001 at 07:31:18AM -0400
Status: ORr

Bruce - 
Around the first of the year, I started playing around with a schema
implementation. As you may recall, my first crack at changing file storage
names about a year ago was motivated by the need to avoid collisions
once schema were available.

Anyway, now that Vadim has removed a lot of the internal dependence
on relname for keeping track of relations, using the new relfinenode
many places relname used to be used, it seems to me that adding a
parallel schemaname to all the data structures that use relname isn't
as cumbersome as Peter might think. I hadn't tackled the relcache yet:
perhaps concatenating the schemaname and relname to use as the hash key
is the way to go for that.

Unfortunately, all that code is now 4 months old, and on my machine
at home.  I has started with the rangetable entries, because hacked the
parser to allow 'SELECT * FROM schemaname.tablename' was easier than
'select schemaname.tablename.fieldname FROM', since the dot function
calling convention isn't allowed in the range list, while it is in the
target list. 

I seem to recall tripping up on the query plan printer, of all things,
before other, paying work pushed it aside. I'll see if I can update that
code to the current tree, and send you something, if you'd like.

Ross



On Tue, May 22, 2001 at 07:31:18AM -0400, Bruce Momjian wrote:
> > > I'm not sure whether it is quite the way to do it, but I'd have a better
> > > time with things if I could span databases in a single request. Are
> > > there theoretical problems with spanning databases in a single query? Is
> > > it a feature of bad database design & implementation?
> > 
> > I think the developers are planning full schema support for the relatively
> > near future (possibly even 7.2, but check the archives and see what's been
> > said). Although it looks easy to access a table from another database,
> > things can rapidly become more complicated as you start having to deal with
> > transactions, triggers, rules, constraints...
> 
> Schema is on my radar screen for 7.2.  I am waiting to do some research
> in what needs to be done, but my initial idea is to use the system cache
> to do namespace mapping, just like is done now for temp tables.
> 
> -- 
>   Bruce Momjian                        |  http://candle.pha.pa.us
>   pgman@candle.pha.pa.us               |  (610) 853-3000
>   +  If your life is a hard drive,     |  830 Blythe Avenue
>   +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
>     (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)

From pgsql-hackers-owner+M17793=candle.pha.pa.us=pgman@postgresql.org Fri Jan 18 19:40:47 2002
Return-path: <pgsql-hackers-owner+M17793=candle.pha.pa.us=pgman@postgresql.org>
Received: from server1.pgsql.org (www.postgresql.org [64.49.215.9])
	by candle.pha.pa.us (8.11.6/8.10.1) with SMTP id g0J0elU09208
	for <pgman@candle.pha.pa.us>; Fri, 18 Jan 2002 19:40:47 -0500 (EST)
Received: (qmail 94886 invoked by alias); 19 Jan 2002 00:40:45 -0000
Received: from unknown (HELO postgresql.org) (64.49.215.8)
  by www.postgresql.org with SMTP; 19 Jan 2002 00:40:45 -0000
Received: from sss.pgh.pa.us ([192.204.191.242])
	by postgresql.org (8.11.3/8.11.4) with ESMTP id g0J0TfV92793
	for <pgsql-hackers@postgreSQL.org>; Fri, 18 Jan 2002 19:29:41 -0500 (EST)
	(envelope-from tgl@sss.pgh.pa.us)
Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1])
	by sss.pgh.pa.us (8.11.4/8.11.4) with ESMTP id g0J0Th311096
	for <pgsql-hackers@postgreSQL.org>; Fri, 18 Jan 2002 19:29:44 -0500 (EST)
To: pgsql-hackers@postgresql.org
Subject: [HACKERS] Schemas vs. PostQUEL: resolving qualified identifiers
Date: Fri, 18 Jan 2002 19:29:43 -0500
Message-ID: <11093.1011400183@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR

I'm starting to think about how to do SQL-compatible schemas in Postgres.

One of the first issues that comes up is that Postgres has interpretations
of qualified (dotted) names that conflict with what the standard says to
do.  This stuff is a hangover from Berkeley days and PostQUEL.  Briefly,
since there are no schemas in PG, anytime we have a dotted name we know
that the first component *must* be a table name.  Successive components are
then resolved as either column or function names applied to whatever we
have so far.  For example,

	a.b.c	is equivalent to c(a.b) if c is a function

The equivalence works the other way too: you can write colname(tabname)
and it will be taken as tabname.colname (though this seems to work only
if tabname already has a rangetable entry).

This is not going to fly together with SQL92, which wants a.b.c to mean
schema a, table b, column c.

I believe we can resolve the conflict without breaking any cases that
are likely to be used much in practice.  Here's my proposal:

First, I'd like to allow the notation "table.*" to be used as a function
argument, representing passing a whole-row value to a function (the
function's argument would be declared as the table rowtype).  Presently
this is done by writing just the undecorated table name, but that is
ambiguous if the same name is also used as a column name in the query.
Also, we need this notation for use with qualified table names.

Having done that, we can resolve names appearing in expressions thus:

foo		First try to resolve as unqualified column name;
		if not found, try to resolve as unqualified table name
		(in which case this is a whole-row value, equivalent
		to foo.*).

foo.bar		foo is an unqualified table name.  Try first to resolve
		bar as a column name of foo; if not found, try to resolve
		bar as a function taking the rowtype of foo.

foo.bar.baz	This refers to table bar in schema foo.  baz is either
		a column or function name, as above.

foo.bar.baz.quux	Refers to table baz in schema bar in catalog foo.
		quux is either a column or function name, as above.

foo.*		foo is an unqualified table name; means whole-row value.

foo.bar.*	Whole row of table bar in schema foo.

foo.bar.baz.*	Whole row of table baz in schema bar in catalog foo.

The first two of these rules are the same as current behavior; the next
two are additions mandated by SQL92; the last three are a proposed
extension to allow unambiguous reference to whole-row values.

With these rules, we do not lose any functionality that we have now,
but some PostQUEL-ish constructs will need to be rewritten into an
equivalent form.

PostQUEL-isms that still work:

table.func	equivalent to func(table.*)

func(table)	equivalent to func(table.*), as long as table name
		doesn't match any column name of the query

PostQUEL-isms that no longer work:

table.col.func		Must rewrite as func(table.col)

table.func1.func2	Must rewrite as, eg, func2(func1(table.*))

While there are a couple of examples of the above two constructs in the
regression tests, I doubt they are used much in the real world.

Another PostQUEL-ism that I would like to remove is col(tab) to mean
tab.col; I'd prefer to restrict the function syntax to functions only.
We could continue to support this for unqualified table names, but
given the above rules it could not work for a qualified table name,
eg, col(schema.tab) would be misinterpreted.  Again, it seems unlikely
that many people are using this, so we may as well try to regularize
the syntax as much as we can.

You may wonder why I'm still allowing the construction tab.func ---
why not get rid of that too?  Well, mainly because I'd like to support
the Oracle-ish syntax for nextval: seqname.nextval.  Together with the
desire not to break existing code unnecessarily, that seems a good enough
reason to leave it in.

Comments?

			regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly

From pgsql-hackers-owner+M18054=candle.pha.pa.us=pgman@postgresql.org Wed Jan 23 14:15:06 2002
Return-path: <pgsql-hackers-owner+M18054=candle.pha.pa.us=pgman@postgresql.org>
Received: from server1.pgsql.org (www.postgresql.org [64.49.215.9])
	by candle.pha.pa.us (8.11.6/8.10.1) with SMTP id g0NJF5U00389
	for <pgman@candle.pha.pa.us>; Wed, 23 Jan 2002 14:15:05 -0500 (EST)
Received: (qmail 74462 invoked by alias); 23 Jan 2002 19:13:45 -0000
Received: from unknown (HELO postgresql.org) (64.49.215.8)
  by www.postgresql.org with SMTP; 23 Jan 2002 19:13:45 -0000
Received: from sss.pgh.pa.us ([192.204.191.242])
	by postgresql.org (8.11.3/8.11.4) with ESMTP id g0NJ0Fl67761
	for <pgsql-hackers@postgresql.org>; Wed, 23 Jan 2002 14:00:15 -0500 (EST)
	(envelope-from tgl@sss.pgh.pa.us)
Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1])
	by sss.pgh.pa.us (8.11.4/8.11.4) with ESMTP id g0NJ00f04506;
	Wed, 23 Jan 2002 14:00:01 -0500 (EST)
To: Fernando Nasser <fnasser@redhat.com>
cc: Zeugswetter Andreas SB SD <ZeugswetterA@spardat.at>,
   pgsql-hackers@postgresql.org
Subject: Re: [HACKERS] Schemas vs. PostQUEL: resolving qualified identifiers 
In-Reply-To: <3C4EFD15.882B0785@redhat.com> 
References: <46C15C39FEB2C44BA555E356FBCD6FA42128D9@m0114.s-mxs.net> <2521.1011798379@sss.pgh.pa.us> <3C4EFD15.882B0785@redhat.com>
Comments: In-reply-to Fernando Nasser <fnasser@redhat.com>
	message dated "Wed, 23 Jan 2002 13:12:37 -0500"
Date: Wed, 23 Jan 2002 14:00:00 -0500
Message-ID: <4503.1011812400@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR

Fernando Nasser <fnasser@redhat.com> writes:
> Tom Lane wrote:
>> Okay, but then how will you refer unambiguously to the rowtype object?

> What about casting with the keyord ROW?
> func(ROW table) 
> always refers to the row-type of table "table" even if there is
> a column called "table".

Strikes me as gratuituously different from the way everything else is
done.  We have .* and %ROWTYPE and so forth, and they're all suffixes.
The closest analogy to your ROW syntax is CAST, but it doesn't alter the
initial interpretation of its argument.

I was toying with the notion of inventing some new notation like
	table.**
I don't like double-asterisk much, but maybe there's some other symbol
we could use here?

			regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

From pgsql-hackers-owner+M18069=candle.pha.pa.us=pgman@postgresql.org Wed Jan 23 17:13:24 2002
Return-path: <pgsql-hackers-owner+M18069=candle.pha.pa.us=pgman@postgresql.org>
Received: from server1.pgsql.org (www.postgresql.org [64.49.215.9])
	by candle.pha.pa.us (8.11.6/8.10.1) with SMTP id g0NMDOU16966
	for <pgman@candle.pha.pa.us>; Wed, 23 Jan 2002 17:13:24 -0500 (EST)
Received: (qmail 49292 invoked by alias); 23 Jan 2002 22:13:23 -0000
Received: from unknown (HELO postgresql.org) (64.49.215.8)
  by www.postgresql.org with SMTP; 23 Jan 2002 22:13:23 -0000
Received: from cygnus.com (runyon.sfbay.redhat.com [205.180.230.5] (may be forged))
	by postgresql.org (8.11.3/8.11.4) with SMTP id g0NLvFl45904
	for <pgsql-hackers@postgresql.org>; Wed, 23 Jan 2002 16:57:15 -0500 (EST)
	(envelope-from fnasser@redhat.com)
Received: from redhat.com (totem.toronto.redhat.com [172.16.14.242])
	by runyon.cygnus.com (8.8.7-cygnus/8.8.7) with ESMTP id NAA18180;
	Wed, 23 Jan 2002 13:57:09 -0800 (PST)
Message-ID: <3C4F31B4.C7C9B2D6@redhat.com>
Date: Wed, 23 Jan 2002 16:57:08 -0500
From: Fernando Nasser <fnasser@redhat.com>
Organization: Red Hat , Inc. - Toronto
X-Mailer: Mozilla 4.78 [en] (X11; U; Linux 2.4.7-10smp i686)
X-Accept-Language: en
MIME-Version: 1.0
To: Tom Lane <tgl@sss.pgh.pa.us>
cc: Zeugswetter Andreas SB SD <ZeugswetterA@spardat.at>,
   pgsql-hackers@postgresql.org
Subject: Re: [HACKERS] Schemas vs. PostQUEL: resolving qualified identifiers
References: <46C15C39FEB2C44BA555E356FBCD6FA42128D9@m0114.s-mxs.net> <2521.1011798379@sss.pgh.pa.us> <3C4EFD15.882B0785@redhat.com> <4503.1011812400@sss.pgh.pa.us>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR

Tom Lane wrote:
> 
> Fernando Nasser <fnasser@redhat.com> writes:
> > Tom Lane wrote:
> >> Okay, but then how will you refer unambiguously to the rowtype object?
> 
> > What about casting with the keyord ROW?
> > func(ROW table)
> > always refers to the row-type of table "table" even if there is
> > a column called "table".
> 
> Strikes me as gratuituously different from the way everything else is
> done.  We have .* and %ROWTYPE and so forth, and they're all suffixes.
> The closest analogy to your ROW syntax is CAST, but it doesn't alter the
> initial interpretation of its argument.
> 

I didn't mean literally that way, I just wanted to add a keyword for
solving ambiguity (when there is one).

You are right, it should be:

func(table%ROWTYPE)  




-- 
Fernando Nasser
Red Hat - Toronto                       E-Mail:  fnasser@redhat.com
2323 Yonge Street, Suite #300
Toronto, Ontario   M4P 2C9

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/users-lounge/docs/faq.html

From pgsql-hackers-owner+M17920=candle.pha.pa.us=pgman@postgresql.org Mon Jan 21 16:45:17 2002
Return-path: <pgsql-hackers-owner+M17920=candle.pha.pa.us=pgman@postgresql.org>
Received: from server1.pgsql.org (www.postgresql.org [64.49.215.9])
	by candle.pha.pa.us (8.11.6/8.10.1) with SMTP id g0LLjHU16235
	for <pgman@candle.pha.pa.us>; Mon, 21 Jan 2002 16:45:17 -0500 (EST)
Received: (qmail 38745 invoked by alias); 21 Jan 2002 21:43:19 -0000
Received: from unknown (HELO postgresql.org) (64.49.215.8)
  by www.postgresql.org with SMTP; 21 Jan 2002 21:43:19 -0000
Received: from sss.pgh.pa.us ([192.204.191.242])
	by postgresql.org (8.11.3/8.11.4) with ESMTP id g0LLTql30573
	for <pgsql-hackers@postgreSQL.org>; Mon, 21 Jan 2002 16:29:53 -0500 (EST)
	(envelope-from tgl@sss.pgh.pa.us)
Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1])
	by sss.pgh.pa.us (8.11.4/8.11.4) with ESMTP id g0LLTrf11384
	for <pgsql-hackers@postgreSQL.org>; Mon, 21 Jan 2002 16:29:53 -0500 (EST)
To: pgsql-hackers@postgresql.org
Subject: [HACKERS] RFD: schemas and different kinds of Postgres objects
Date: Mon, 21 Jan 2002 16:29:52 -0500
Message-ID: <11381.1011648592@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR

Continuing to think about implementing SQL schemas for 7.3 ...

Today's topic for discussion: which types of Postgres objects should
belong to schemas, and which ones should have other name scopes?

Relations (tables, indexes, views, sequences) clearly belong to schemas.
Since each relation has an associated datatype with the same name, it
seems that datatypes must belong to schemas as well.  (Even if that
argument doesn't convince you, SQL99 says that user-defined datatypes
belong to schemas.)  However the situation is murkier for other kinds of
objects.

Here are all the kinds of named objects that exist in Postgres today,
with some comments on whether they should belong to schemas or not:

relations		Must be in schemas
types			Must be in schemas
databases		Databases contain schemas, not vice versa
users			Users are cross-database, so not in schemas
groups			User groups are cross-database, so not in schemas
languages		Probably should not be in schemas
access methods		Probably should not be in schemas
opclasses		See below
operators		See below
functions/procedures	See below
aggregates		Should treat same as regular functions
constraints		See below
rules			See below
triggers		See below
NOTIFY conditions	See below

Languages and access methods are not trivial to add to the system, so
there's not much risk of name conflicts, and no reason to make their name
scope less than global.

The situation is a lot murkier for operators and functions.  These should
probably be treated alike, since operators are just syntactic sugar for
functions.  I think the basic argument for making them schema-local is
that different users might conceivably want to define conflicting
functions or operators of the same name.  Against that, however, there
are a number of reasons for wanting to keep these objects database-wide.
First off there are syntactic problems.  Do you really want to write
		A schemaname.+ B
to qualify an ambiguous "+" operator?  Looks way too much like a syntax
error to me.  Allowing this would probably turn a lot of simple syntax
errors into things that get past the grammar and end up producing truly
confusing error messages.  Qualified function names also pose some
problems, not so much with
		schemaname.function(args)
which seems reasonable, but with the Berkeley-derived syntax that allows
"foo.function" to mean "function(foo)" --- there's no way to squeeze a
schema-name for the function into that.  (And you'll recall from my note
of the other day that we don't want to abandon this syntax entirely,
because people would like us to support "sequencename.nextval" for Oracle
compatibility.)  Notice that we are not forced to make functions/operators
schema-local just because datatypes are, because overloading will save the
day.  func(schema1.type1) and func(schema2.type1) are distinct functions
because the types are different, even if they live in the same function
namespace.  Finally, SQL99 doesn't appear to think that operator and
function names are schema-local; though that may just be because it hasn't
got user-defined operators AFAICT.

I am leaning towards keeping functions/operators database-wide, but would
like to hear comments.  Is there any real value in, eg, allowing different
users to define different "+" operators *on the same datatypes*?

Not sure about index opclasses.  Given that datatype names are
schema-local, one can think of scenarios where two users define similar
datatypes and then try to use the same index opclass name for both.
But it seems pretty unlikely.  I'd prefer to leave opclass names
database-wide for simplicity.  Comments?

As for constraints, currently we only support table-level constraints,
and we do not enforce any uniqueness at all on their names; multiple
constraints for the same table can have the same name (and if so, ALTER
TABLE DROP CONSTRAINT drops all matching names).  SQL92 requires named
constraints to have names that are unique within their schema, which is
okay for standalone assertions (which we haven't got) but seems quite
unnecessary for constraints attached to tables.  And what's really odd,
it appears to allow a table constraint to belong to a different schema
than the table it is on!  This is pretty bogus.  I'd prefer to ignore the
part of the spec that says that table constraint names can be qualified
names, and either keep our existing behavior or require constraint names
to be unique per-table.  Thoughts?

Rewrite rules are currently required to have a name unique within their
database.  We clearly don't want that to still be true in the schema
environment.  Personally I would like to make rules' names unique only
among rules on the same table (like we handle triggers).  That would
mean an incompatible change in the syntax of DROP RULE: it'd have to
become DROP RULE rule ON table, much like DROP TRIGGER.  Is that okay?
If not, probably we must make rulenames local to schemas and say they
implicitly belong to the schema of the associated table.

Triggers are already handled as being named uniquely among the triggers
of the same table.  This behavior is fine with me, and doesn't need to
be changed for schema support.

I can see some advantage to considering NOTIFY condition names to be local
to a schema, but I can also see risks of breaking existing applications.
Currently, "NOTIFY foo" will signal to "LISTEN foo" even if the two
processes belong to different users.  With an implicit schema qualifier
attached to foo, very likely this would fail to work.  Since NOTIFY names
aren't officially registered anywhere, the implicit qualifier would have
to correspond to the front schema of one's schema search path, and there'd
be no way for such processes to communicate if their search paths didn't
match.  I think people would end up always qualifying NOTIFY names with
a single schema name, which means we might as well continue to consider
them global.  On the other hand, if you assume that NOTIFY names are often
the names of tables, it'd make sense to allow them to be qualified.  Any
thoughts on this?

			regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

From pgsql-hackers-owner+M17929=candle.pha.pa.us=pgman@postgresql.org Mon Jan 21 19:13:39 2002
Return-path: <pgsql-hackers-owner+M17929=candle.pha.pa.us=pgman@postgresql.org>
Received: from server1.pgsql.org (www.postgresql.org [64.49.215.9])
	by candle.pha.pa.us (8.11.6/8.10.1) with SMTP id g0M0DcU03335
	for <pgman@candle.pha.pa.us>; Mon, 21 Jan 2002 19:13:38 -0500 (EST)
Received: (qmail 78739 invoked by alias); 22 Jan 2002 00:12:48 -0000
Received: from unknown (HELO postgresql.org) (64.49.215.8)
  by www.postgresql.org with SMTP; 22 Jan 2002 00:12:48 -0000
Received: from corvette.mascari.com (dhcp065-024-158-068.columbus.rr.com [65.24.158.68])
	by postgresql.org (8.11.3/8.11.4) with ESMTP id g0LNo9l76502
	for <pgsql-hackers@postgresql.org>; Mon, 21 Jan 2002 18:50:09 -0500 (EST)
	(envelope-from mascarm@mascari.com)
Received: from mascari.com (ferrari.mascari.com [192.168.2.1])
	by corvette.mascari.com (8.9.3/8.9.3) with ESMTP id SAA26029
	for <pgsql-hackers@postgresql.org>; Mon, 21 Jan 2002 18:45:34 -0500
Message-ID: <3C4CA81E.4D1D7BD9@mascari.com>
Date: Mon, 21 Jan 2002 18:45:34 -0500
From: Mike Mascari <mascarm@mascari.com>
X-Mailer: Mozilla 4.7 [en] (WinNT; I)
X-Accept-Language: en
MIME-Version: 1.0
To: pgsql-hackers@postgresql.org
Subject: Re: [HACKERS] RFD: schemas and different kinds of Postgres objects
References: <11381.1011648592@sss.pgh.pa.us>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR

Tom Lane wrote:
> 
> Continuing to think about implementing SQL schemas for 7.3 ...
> 
> Today's topic for discussion: which types of Postgres objects should
> belong to schemas, and which ones should have other name scopes?
...
> 
> I am leaning towards keeping functions/operators database-wide, but would
> like to hear comments.  Is there any real value in, eg, allowing different
> users to define different "+" operators *on the same datatypes*?

With regard to functions, I believe they should be schema specific.
Oracle allows the creation of procedures/functions in specific schema.
User2 may then execute user1's function as:

EXECUTE user1.myfunction();

However, as you suggest, the fully qualified naming of functions gets
messy. So Oracle allows (and I think we would need) PUBLIC SYNONYMs.
This allows user1 to do:

CREATE TABLE employees(key integer, name VARCHAR(20));

CREATE SEQUENCE s;

CREATE PROCEDURE newemployee(n IN VARCHAR)
AS 
BEGIN
INSERT INTO employees
SELECT s.nextval, n
FROM DUAL;
END;
/

GRANT INSERT ON employees TO user2;
GRANT EXECUTE ON newemployee TO user2;
CREATE PUBLIC SYNONYM newemployee FOR user1.newemployee;

Now, user2 just does:

EXECUTE newemployee(10);


In fact, with regard to the package discussion a while back, Oracle
allows this:

Database->Schema->Package->Procedure

and this:

Database->Schema->Procedure

and effectively this:

Database->Procedure via Database->PUBLIC Schema->Procedure

I really think that the main purpose of schemas is to prevent an
ill-informed or malicious user from engaging in unacceptable behavior.
By placing everything in schemas, it allows the Oracle DBA to have a
very fine-grained control over the ability of user1 to interfere with
user2. Before user1 above could pollute the global namespace, the dba
must have:

GRANT user1 CREATE PUBLIC SYNONYM

privilege, or created the synonym himself. This allows things like
pg_class to reside within their own schema, as well as all built-in
PostgreSQL functions. After the bootstrapping, PUBLIC SYNONYMs are
created for all of the system objects which should have global scope:

CREATE PUBLIC SYNONYM pg_class FOR system.pg_class;
CREATE PUBLIC SYNONYM abs(int) FOR system.abs(int);

One major benefit of Oracle is that the DBA, through the use of
STATEMENT privileges (i.e. GRANT CREATE TABLE to user1), resource
PROFILEs, and TABLESPACES can easily admin a database used by 20
different deparments and 1000 different users without the fear that one
might step on the other's toes. If the accounting department wants to
create an addtax() function, it shouldn't have to ask the receiving
deptartment to do so. 

Just my thoughts,

Mike Mascari
mascarm@mascari.com

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
    (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)

From pgsql-hackers-owner+M17928=candle.pha.pa.us=pgman@postgresql.org Mon Jan 21 19:13:39 2002
Return-path: <pgsql-hackers-owner+M17928=candle.pha.pa.us=pgman@postgresql.org>
Received: from server1.pgsql.org (www.postgresql.org [64.49.215.9])
	by candle.pha.pa.us (8.11.6/8.10.1) with SMTP id g0M0DcU03336
	for <pgman@candle.pha.pa.us>; Mon, 21 Jan 2002 19:13:38 -0500 (EST)
Received: (qmail 78777 invoked by alias); 22 Jan 2002 00:12:50 -0000
Received: from unknown (HELO postgresql.org) (64.49.215.8)
  by www.postgresql.org with SMTP; 22 Jan 2002 00:12:50 -0000
Received: from student.gvsu.edu ([148.61.7.124])
	by postgresql.org (8.11.3/8.11.4) with ESMTP id g0LNxBl77018
	for <pgsql-hackers@postgreSQL.org>; Mon, 21 Jan 2002 18:59:12 -0500 (EST)
	(envelope-from peter_e@gmx.net)
Received: from [148.61.250.18] [148.61.250.18] by student.gvsu.edu
	with Novonyx SMTP Server $Revision: 1.3 $; Mon, 21 Jan 2002 18:59:14 -0500 (EDT)
Date: Mon, 21 Jan 2002 19:01:13 -0500 (EST)
From: Peter Eisentraut <peter_e@gmx.net>
X-Sender: <peter@peter.localdomain>
To: Tom Lane <tgl@sss.pgh.pa.us>
cc: <pgsql-hackers@postgresql.org>
Subject: Re: [HACKERS] RFD: schemas and different kinds of Postgres objects
In-Reply-To: <11381.1011648592@sss.pgh.pa.us>
Message-ID: <Pine.LNX.4.30.0201211840260.687-100000@peter.localdomain>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR

Tom Lane writes:

> languages		Probably should not be in schemas
> access methods		Probably should not be in schemas
> opclasses		See below
> operators		See below
> functions/procedures	See below
> aggregates		Should treat same as regular functions
> constraints		See below
> rules			See below
> triggers		See below
> NOTIFY conditions	See below

Remember that a schema is a named representation of ownership, so anything
that can be owned must be in a schema.  (Unless you want to invent a
parallel universe for a different kind of ownership, which would be
incredibly confusing.)  Also remember that we wanted to use schemas as a
way to prevent unprivileged users from creating anything by default.  So
it would be much simpler if "everything" were in a schema.

I wouldn't worry so much about the invocation syntax -- if you don't like
ugly don't make ugly.  For instance, if you add a user-defined operator
you would probably either put it in the same schema with the rest of your
project or put it in some sort of a global or default schema (to be
determined) to make it available to the whole system, my assumption being
that either way you don't need to qualify the operator.  But the important
thing is that you *could* make cross-schema operator calls, say during
development or testing.

Consequentially, I opine that all of the things listed above should be in
a schema.  (Although I don't have a strong opinion about notifications,
yet.)

> namespace.  Finally, SQL99 doesn't appear to think that operator and
> function names are schema-local; though that may just be because it hasn't
> got user-defined operators AFAICT.

Check clause 10.4 <routine invocation>: routine names are (optionally)
schema qualified like everything else.

> Rewrite rules are currently required to have a name unique within their
> database.  We clearly don't want that to still be true in the schema
> environment.  Personally I would like to make rules' names unique only
> among rules on the same table (like we handle triggers).  That would
> mean an incompatible change in the syntax of DROP RULE: it'd have to
> become DROP RULE rule ON table, much like DROP TRIGGER.  Is that okay?
> If not, probably we must make rulenames local to schemas and say they
> implicitly belong to the schema of the associated table.

I'd rather make the opposite change (make trigger names schema-global)
because that aligns with SQL99 and it would make more sense for overall
consistency (e.g., you can't have indexes with the same names on different
tables).  The syntax change would also be backward compatible.  I think
either way, schema-global or table-global namespace, can be argued to be
more useful or more confusion-prone, so I side with the standard on this
one.

-- 
Peter Eisentraut   peter_e@gmx.net


---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly

From pgsql-hackers-owner+M17932=candle.pha.pa.us=pgman@postgresql.org Mon Jan 21 20:14:13 2002
Return-path: <pgsql-hackers-owner+M17932=candle.pha.pa.us=pgman@postgresql.org>
Received: from server1.pgsql.org (www.postgresql.org [64.49.215.9])
	by candle.pha.pa.us (8.11.6/8.10.1) with SMTP id g0M1ECU11565
	for <pgman@candle.pha.pa.us>; Mon, 21 Jan 2002 20:14:12 -0500 (EST)
Received: (qmail 88800 invoked by alias); 22 Jan 2002 01:14:11 -0000
Received: from unknown (HELO postgresql.org) (64.49.215.8)
  by www.postgresql.org with SMTP; 22 Jan 2002 01:14:11 -0000
Received: from sss.pgh.pa.us ([192.204.191.242])
	by postgresql.org (8.11.3/8.11.4) with ESMTP id g0M16kl87933
	for <pgsql-hackers@postgreSQL.org>; Mon, 21 Jan 2002 20:06:47 -0500 (EST)
	(envelope-from tgl@sss.pgh.pa.us)
Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1])
	by sss.pgh.pa.us (8.11.4/8.11.4) with ESMTP id g0M16Uf12242;
	Mon, 21 Jan 2002 20:06:30 -0500 (EST)
To: Peter Eisentraut <peter_e@gmx.net>
cc: pgsql-hackers@postgresql.org
Subject: Re: [HACKERS] RFD: schemas and different kinds of Postgres objects 
In-Reply-To: <Pine.LNX.4.30.0201211840260.687-100000@peter.localdomain> 
References: <Pine.LNX.4.30.0201211840260.687-100000@peter.localdomain>
Comments: In-reply-to Peter Eisentraut <peter_e@gmx.net>
	message dated "Mon, 21 Jan 2002 19:01:13 -0500"
Date: Mon, 21 Jan 2002 20:06:30 -0500
Message-ID: <12239.1011661590@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR

Peter Eisentraut <peter_e@gmx.net> writes:
> Remember that a schema is a named representation of ownership, so anything
> that can be owned must be in a schema.  (Unless you want to invent a
> parallel universe for a different kind of ownership, which would be
> incredibly confusing.)

I don't buy that premise.  It's true that SQL92 equates ownership of a
schema with ownership of the objects therein, but AFAICS we have no hope
of being forward-compatible with existing database setups (wherein there
can be multiple tables of different ownership all in a single namespace)
if we don't allow varying ownership within a schema.  I think we can
arrange things so that we are upward compatible with both SQL92 and
the old way.  Haven't worked out details yet though.

Have to run, more later.

			regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org

From pgsql-hackers-owner+M17933=candle.pha.pa.us=pgman@postgresql.org Mon Jan 21 20:42:40 2002
Return-path: <pgsql-hackers-owner+M17933=candle.pha.pa.us=pgman@postgresql.org>
Received: from server1.pgsql.org (www.postgresql.org [64.49.215.9])
	by candle.pha.pa.us (8.11.6/8.10.1) with SMTP id g0M1geU12708
	for <pgman@candle.pha.pa.us>; Mon, 21 Jan 2002 20:42:40 -0500 (EST)
Received: (qmail 92393 invoked by alias); 22 Jan 2002 01:42:38 -0000
Received: from unknown (HELO postgresql.org) (64.49.215.8)
  by www.postgresql.org with SMTP; 22 Jan 2002 01:42:38 -0000
Received: from p566.codebydesign.com (cx950878-a.fed1.sdca.home.com [24.11.158.40])
	by postgresql.org (8.11.3/8.11.4) with ESMTP id g0M1cZl91431
	for <pgsql-hackers@postgresql.org>; Mon, 21 Jan 2002 20:38:35 -0500 (EST)
	(envelope-from pharvey@codebydesign.com)
Received: from p12.codebydesign.com (p12.codebydesign.com [192.168.1.27])
	by p566.codebydesign.com (8.11.1/8.11.1) with SMTP id g0M2mmt12179;
	Mon, 21 Jan 2002 18:48:53 -0800
Content-Type: text/plain;
  charset="iso-8859-1"
From: Peter Harvey <pharvey@codebydesign.com>
Organization: CodeByDesign
To: Tom Lane <tgl@sss.pgh.pa.us>, Peter Eisentraut <peter_e@gmx.net>
Subject: Re: [HACKERS] RFD: schemas and different kinds of Postgres objects
Date: Mon, 21 Jan 2002 17:39:05 -0800
X-Mailer: KMail [version 1.2]
cc: pgsql-hackers@postgresql.org
References: <Pine.LNX.4.30.0201211840260.687-100000@peter.localdomain> <12239.1011661590@sss.pgh.pa.us>
In-Reply-To: <12239.1011661590@sss.pgh.pa.us>
MIME-Version: 1.0
Message-ID: <02012117390500.02279@p12.codebydesign.com>
Content-Transfer-Encoding: 8bit
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR

FYI: Applications like Data Architect would benefit from a consistent and 
complete interface to the schema. For example; I found that we had to bypass 
the DD views which exist (as I recall) because they did not give us all 
information we needed. So we selected stuff from the system tables directly. 
Yucky. Sorry I can not recall details but thought that I would mention this 
here. The MySQL 'SHOW' statements seem to work pretty well and shields us 
from changes to the system tables.

Peter

> I don't buy that premise.  It's true that SQL92 equates ownership of a
> schema with ownership of the objects therein, but AFAICS we have no hope
> of being forward-compatible with existing database setups (wherein there
> can be multiple tables of different ownership all in a single namespace)
> if we don't allow varying ownership within a schema.  I think we can
> arrange things so that we are upward compatible with both SQL92 and
> the old way.  Haven't worked out details yet though.
>
> Have to run, more later.

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org

From pgsql-hackers-owner+M17966=candle.pha.pa.us=pgman@postgresql.org Tue Jan 22 10:53:20 2002
Return-path: <pgsql-hackers-owner+M17966=candle.pha.pa.us=pgman@postgresql.org>
Received: from server1.pgsql.org (www.postgresql.org [64.49.215.9])
	by candle.pha.pa.us (8.11.6/8.10.1) with SMTP id g0MFrJU05739
	for <pgman@candle.pha.pa.us>; Tue, 22 Jan 2002 10:53:20 -0500 (EST)
Received: (qmail 83537 invoked by alias); 22 Jan 2002 15:53:00 -0000
Received: from unknown (HELO postgresql.org) (64.49.215.8)
  by www.postgresql.org with SMTP; 22 Jan 2002 15:53:00 -0000
Received: from cygnus.com (runyon.sfbay.redhat.com [205.180.230.5] (may be forged))
	by postgresql.org (8.11.3/8.11.4) with SMTP id g0MFoql80523
	for <pgsql-hackers@postgresql.org>; Tue, 22 Jan 2002 10:50:52 -0500 (EST)
	(envelope-from fnasser@redhat.com)
Received: from redhat.com (rtl.sfbay.redhat.com [205.180.230.21])
	by runyon.cygnus.com (8.8.7-cygnus/8.8.7) with ESMTP id HAA09903;
	Tue, 22 Jan 2002 07:50:43 -0800 (PST)
Message-ID: <3C4D8A39.FF79CDC4@redhat.com>
Date: Tue, 22 Jan 2002 10:50:17 -0500
From: Fernando Nasser <fnasser@redhat.com>
Organization: Red Hat Canada
X-Mailer: Mozilla 4.78 [en] (X11; U; Linux 2.4.9-13 i686)
X-Accept-Language: en
MIME-Version: 1.0
To: Tom Lane <tgl@sss.pgh.pa.us>
cc: Peter Eisentraut <peter_e@gmx.net>, pgsql-hackers@postgresql.org
Subject: Re: [HACKERS] RFD: schemas and different kinds of Postgres objects
References: <Pine.LNX.4.30.0201211840260.687-100000@peter.localdomain> <12239.1011661590@sss.pgh.pa.us>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR

Tom Lane wrote:
> 
> Peter Eisentraut <peter_e@gmx.net> writes:
> > Remember that a schema is a named representation of ownership, so anything
> > that can be owned must be in a schema.  (Unless you want to invent a
> > parallel universe for a different kind of ownership, which would be
> > incredibly confusing.)
> 
> I don't buy that premise.  It's true that SQL92 equates ownership of a
> schema with ownership of the objects therein, but AFAICS we have no hope
> of being forward-compatible with existing database setups (wherein there
> can be multiple tables of different ownership all in a single namespace)
> if we don't allow varying ownership within a schema.  I think we can
> arrange things so that we are upward compatible with both SQL92 and
> the old way.  Haven't worked out details yet though.
> 

Peter is right.  Schemas is just a practical way of creating things
under
the same authorization-id + crating a namespace so that different
authorization-ids can have objects with the same (unqualified name).

Quoting Date (pg. 221): "The schema authID for a given schema identifies
the owner of that schema (and hence the owner of everything described by
that schema also)."

It is very important that we reach a conclusion on this as it simplifies
things a lot.

Regards,
Fernando


P.S.: That is why I was telling you that, except for the namespace part,
we already have the groundwork for Entry-level SQL-Schemas (where the 
schema is always the authorization-id of the creator) -- it is just
a question of handling the "owner" appropriately.


-- 
Fernando Nasser
Red Hat Canada Ltd.                     E-Mail:  fnasser@redhat.com
2323 Yonge Street, Suite #300
Toronto, Ontario   M4P 2C9

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
    (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)

From pgsql-hackers-owner+M17973=candle.pha.pa.us=pgman@postgresql.org Tue Jan 22 11:26:13 2002
Return-path: <pgsql-hackers-owner+M17973=candle.pha.pa.us=pgman@postgresql.org>
Received: from server1.pgsql.org (www.postgresql.org [64.49.215.9])
	by candle.pha.pa.us (8.11.6/8.10.1) with SMTP id g0MGQCU09218
	for <pgman@candle.pha.pa.us>; Tue, 22 Jan 2002 11:26:12 -0500 (EST)
Received: (qmail 4629 invoked by alias); 22 Jan 2002 16:25:41 -0000
Received: from unknown (HELO postgresql.org) (64.49.215.8)
  by www.postgresql.org with SMTP; 22 Jan 2002 16:25:41 -0000
Received: from sss.pgh.pa.us ([192.204.191.242])
	by postgresql.org (8.11.3/8.11.4) with ESMTP id g0MGGTl95123
	for <pgsql-hackers@postgresql.org>; Tue, 22 Jan 2002 11:16:29 -0500 (EST)
	(envelope-from tgl@sss.pgh.pa.us)
Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1])
	by sss.pgh.pa.us (8.11.4/8.11.4) with ESMTP id g0MGGBf15342;
	Tue, 22 Jan 2002 11:16:11 -0500 (EST)
To: Fernando Nasser <fnasser@redhat.com>
cc: Peter Eisentraut <peter_e@gmx.net>, pgsql-hackers@postgresql.org
Subject: Re: [HACKERS] RFD: schemas and different kinds of Postgres objects 
In-Reply-To: <3C4D8A39.FF79CDC4@redhat.com> 
References: <Pine.LNX.4.30.0201211840260.687-100000@peter.localdomain> <12239.1011661590@sss.pgh.pa.us> <3C4D8A39.FF79CDC4@redhat.com>
Comments: In-reply-to Fernando Nasser <fnasser@redhat.com>
	message dated "Tue, 22 Jan 2002 10:50:17 -0500"
Date: Tue, 22 Jan 2002 11:16:11 -0500
Message-ID: <15339.1011716171@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR

Fernando Nasser <fnasser@redhat.com> writes:
> Tom Lane wrote:
>> I don't buy that premise.  It's true that SQL92 equates ownership of a
>> schema with ownership of the objects therein, but AFAICS we have no hope
>> of being forward-compatible with existing database setups (wherein there
>> can be multiple tables of different ownership all in a single namespace)
>> if we don't allow varying ownership within a schema.

> Quoting Date (pg. 221): "The schema authID for a given schema identifies
> the owner of that schema (and hence the owner of everything described by
> that schema also)."

Yes, I know what the spec says.  I also think we'll have a revolt on our
hands if we don't make it possible for existing Postgres applications to
continue working as they have in the past --- and that means allowing
tables of different ownerships to be accessible in a single namespace.

Although I haven't thought through the details yet, it seems to me that
a solution exists along these lines:

1. The creator of an object owns it.  (With some special cases, eg the
   superuser should be able to create a schema owned by someone else.)

2. Whether you can create an object in a schema that is owned by someone
   else depends on permissions attached to the schema.  By default only
   the owner of a schema can create anything in it.

3. SQL92-compatible behavior is achieved when everyone has their own
   schema and they don't grant each other create-in-schema rights.
   Backwards-compatible behavior is achieved when everyone uses a
   shared "public" schema.

We'd probably need GUC variable(s) to make it possible to choose which
behavior is the default.  I haven't thought much about exactly what
knobs should be provided.  I do think we will want at least these two
knobs:

1. A "search path" that is an ordered list of schemas to look in
   when trying to resolve an unqualified name.

2. A "default schema" variable that identifies the schema to create
   objects in, if a fully qualified name is not given.

The default creation location shouldn't be hardwired to equal the
front of the search path, because the front item of the search path
is probably always going to be a backend-local temporary schema
(this is where we'll create temporary tables).

The most dumbed-down version of this that would work is to reduce the
search path to just a fixed list of three locations: temp schema, a
selectable default schema (which is also the default creation location),
and a system schema (where pg_class and friends live).  But a
user-settable path wouldn't be any more effort to support, and might
offer some useful capability.

			regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly

From pgsql-hackers-owner+M17976=candle.pha.pa.us=pgman@postgresql.org Tue Jan 22 12:04:19 2002
Return-path: <pgsql-hackers-owner+M17976=candle.pha.pa.us=pgman@postgresql.org>
Received: from server1.pgsql.org (www.postgresql.org [64.49.215.9])
	by candle.pha.pa.us (8.11.6/8.10.1) with SMTP id g0MH4IU12377
	for <pgman@candle.pha.pa.us>; Tue, 22 Jan 2002 12:04:18 -0500 (EST)
Received: (qmail 20616 invoked by alias); 22 Jan 2002 17:04:13 -0000
Received: from unknown (HELO postgresql.org) (64.49.215.8)
  by www.postgresql.org with SMTP; 22 Jan 2002 17:04:13 -0000
Received: from cygnus.com (runyon.sfbay.redhat.com [205.180.230.5] (may be forged))
	by postgresql.org (8.11.3/8.11.4) with SMTP id g0MGiKl15781
	for <pgsql-hackers@postgresql.org>; Tue, 22 Jan 2002 11:44:20 -0500 (EST)
	(envelope-from fnasser@redhat.com)
Received: from redhat.com (rtl.sfbay.redhat.com [205.180.230.21])
	by runyon.cygnus.com (8.8.7-cygnus/8.8.7) with ESMTP id IAA14751;
	Tue, 22 Jan 2002 08:44:15 -0800 (PST)
Message-ID: <3C4D96C5.80BBF764@redhat.com>
Date: Tue, 22 Jan 2002 11:43:49 -0500
From: Fernando Nasser <fnasser@redhat.com>
Organization: Red Hat Canada
X-Mailer: Mozilla 4.78 [en] (X11; U; Linux 2.4.9-13 i686)
X-Accept-Language: en
MIME-Version: 1.0
To: Tom Lane <tgl@sss.pgh.pa.us>
cc: Peter Eisentraut <peter_e@gmx.net>, pgsql-hackers@postgresql.org
Subject: Re: [HACKERS] RFD: schemas and different kinds of Postgres objects
References: <Pine.LNX.4.30.0201211840260.687-100000@peter.localdomain> <12239.1011661590@sss.pgh.pa.us> <3C4D8A39.FF79CDC4@redhat.com> <15339.1011716171@sss.pgh.pa.us>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR

Tom Lane wrote:
> 
> > Quoting Date (pg. 221): "The schema authID for a given schema identifies
> > the owner of that schema (and hence the owner of everything described by
> > that schema also)."
> 
> Yes, I know what the spec says.  I also think we'll have a revolt on our
> hands if we don't make it possible for existing Postgres applications to
> continue working as they have in the past --- and that means allowing
> tables of different ownerships to be accessible in a single namespace.
> 

But them it is not SQL-Schemas.  Call it something else, "packages"
for instance.  The standard has lots of rules and other considerations
all around the document that depend on schemas have the meaning they 
assigned to it.

If someone wants to really make use of SQL-Schemas, he/she will need to 
reorg the database anyway, which will probably mean dumping the data,
massaging the DLL and recreating it.  I guess most users of SQL-Schemas
will be people creating new databases.

For the current users, (based on your idea below) a default behavior of
searching the current-AuthID schema, them the "default" schema them
"any"
schema will probably make things work.

Fernando

P.S.: Note that the standard has no GRANTs for SCHEMAs themselves; all
GRANTS go to the specific objects as before.


> Although I haven't thought through the details yet, it seems to me that
> a solution exists along these lines:
> 
> 1. The creator of an object owns it.  (With some special cases, eg the
>    superuser should be able to create a schema owned by someone else.)
> 
> 2. Whether you can create an object in a schema that is owned by someone
>    else depends on permissions attached to the schema.  By default only
>    the owner of a schema can create anything in it.
> 
> 3. SQL92-compatible behavior is achieved when everyone has their own
>    schema and they don't grant each other create-in-schema rights.
>    Backwards-compatible behavior is achieved when everyone uses a
>    shared "public" schema.
> 
> We'd probably need GUC variable(s) to make it possible to choose which
> behavior is the default.  I haven't thought much about exactly what
> knobs should be provided.  I do think we will want at least these two
> knobs:
> 
> 1. A "search path" that is an ordered list of schemas to look in
>    when trying to resolve an unqualified name.
> 
> 2. A "default schema" variable that identifies the schema to create
>    objects in, if a fully qualified name is not given.
> 
> The default creation location shouldn't be hardwired to equal the
> front of the search path, because the front item of the search path
> is probably always going to be a backend-local temporary schema
> (this is where we'll create temporary tables).
> 
> The most dumbed-down version of this that would work is to reduce the
> search path to just a fixed list of three locations: temp schema, a
> selectable default schema (which is also the default creation location),
> and a system schema (where pg_class and friends live).  But a
> user-settable path wouldn't be any more effort to support, and might
> offer some useful capability.
> 
>                         regards, tom lane
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo@postgresql.org so that your
> message can get through to the mailing list cleanly

-- 
Fernando Nasser
Red Hat Canada Ltd.                     E-Mail:  fnasser@redhat.com
2323 Yonge Street, Suite #300
Toronto, Ontario   M4P 2C9

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

From pgsql-hackers-owner+M17976=candle.pha.pa.us=pgman@postgresql.org Tue Jan 22 12:04:19 2002
Return-path: <pgsql-hackers-owner+M17976=candle.pha.pa.us=pgman@postgresql.org>
Received: from server1.pgsql.org (www.postgresql.org [64.49.215.9])
	by candle.pha.pa.us (8.11.6/8.10.1) with SMTP id g0MH4IU12378
	for <pgman@candle.pha.pa.us>; Tue, 22 Jan 2002 12:04:18 -0500 (EST)
Received: (qmail 20627 invoked by alias); 22 Jan 2002 17:04:13 -0000
Received: from unknown (HELO postgresql.org) (64.49.215.8)
  by www.postgresql.org with SMTP; 22 Jan 2002 17:04:13 -0000
Received: from sss.pgh.pa.us ([192.204.191.242])
	by postgresql.org (8.11.3/8.11.4) with ESMTP id g0MGpjl18339
	for <pgsql-hackers@postgresql.org>; Tue, 22 Jan 2002 11:51:45 -0500 (EST)
	(envelope-from tgl@sss.pgh.pa.us)
Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1])
	by sss.pgh.pa.us (8.11.4/8.11.4) with ESMTP id g0MGpUf15641;
	Tue, 22 Jan 2002 11:51:30 -0500 (EST)
To: Fernando Nasser <fnasser@redhat.com>
cc: Peter Eisentraut <peter_e@gmx.net>, pgsql-hackers@postgresql.org
Subject: Re: [HACKERS] RFD: schemas and different kinds of Postgres objects 
In-Reply-To: <3C4D96C5.80BBF764@redhat.com> 
References: <Pine.LNX.4.30.0201211840260.687-100000@peter.localdomain> <12239.1011661590@sss.pgh.pa.us> <3C4D8A39.FF79CDC4@redhat.com> <15339.1011716171@sss.pgh.pa.us> <3C4D96C5.80BBF764@redhat.com>
Comments: In-reply-to Fernando Nasser <fnasser@redhat.com>
	message dated "Tue, 22 Jan 2002 11:43:49 -0500"
Date: Tue, 22 Jan 2002 11:51:30 -0500
Message-ID: <15638.1011718290@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR

Fernando Nasser <fnasser@redhat.com> writes:
> But them it is not SQL-Schemas.  Call it something else, "packages"
> for instance.  The standard has lots of rules and other considerations
> all around the document that depend on schemas have the meaning they 
> assigned to it.

Where?  And are there any cases where it really matters?

> If someone wants to really make use of SQL-Schemas, he/she will need to 
> reorg the database anyway, which will probably mean dumping the data,
> massaging the DLL and recreating it.  I guess most users of SQL-Schemas
> will be people creating new databases.

No doubt.  That still leaves us with the problem of providing
backward-compatible behavior in an engine that is going to be designed
to support schemas.  I'm not sure what you think the implementation of
schemas is going to look like --- but I think it's not going to be
something that can be turned off or ignored.  Every table is going to
belong to some schema, and the old behavior has to be available within
that framework.

We are not working in a vacuum here, and that means that "implement
the specification and nothing but" is not a workable design approach.
We are going to end up with something that does the things SQL92 asks
for, but does other things too.

			regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

From pgsql-hackers-owner+M17980=candle.pha.pa.us=pgman@postgresql.org Tue Jan 22 15:34:09 2002
Return-path: <pgsql-hackers-owner+M17980=candle.pha.pa.us=pgman@postgresql.org>
Received: from server1.pgsql.org (www.postgresql.org [64.49.215.9])
	by candle.pha.pa.us (8.11.6/8.10.1) with SMTP id g0MKY7U05934
	for <pgman@candle.pha.pa.us>; Tue, 22 Jan 2002 15:34:07 -0500 (EST)
Received: (qmail 77926 invoked by alias); 22 Jan 2002 20:33:26 -0000
Received: from unknown (HELO postgresql.org) (64.49.215.8)
  by www.postgresql.org with SMTP; 22 Jan 2002 20:33:26 -0000
Received: from cygnus.com (runyon.sfbay.redhat.com [205.180.230.5] (may be forged))
	by postgresql.org (8.11.3/8.11.4) with SMTP id g0MKUrl76871
	for <pgsql-hackers@postgresql.org>; Tue, 22 Jan 2002 15:30:54 -0500 (EST)
	(envelope-from fnasser@redhat.com)
Received: from redhat.com (rtl.sfbay.redhat.com [205.180.230.21])
	by runyon.cygnus.com (8.8.7-cygnus/8.8.7) with ESMTP id MAA09466;
	Tue, 22 Jan 2002 12:30:46 -0800 (PST)
Message-ID: <3C4DCBDB.689D7201@redhat.com>
Date: Tue, 22 Jan 2002 15:30:20 -0500
From: Fernando Nasser <fnasser@redhat.com>
Organization: Red Hat Canada
X-Mailer: Mozilla 4.78 [en] (X11; U; Linux 2.4.9-13 i686)
X-Accept-Language: en
MIME-Version: 1.0
To: Tom Lane <tgl@sss.pgh.pa.us>
cc: Peter Eisentraut <peter_e@gmx.net>, pgsql-hackers@postgresql.org
Subject: Re: [HACKERS] RFD: schemas and different kinds of Postgres objects
References: <Pine.LNX.4.30.0201211840260.687-100000@peter.localdomain> <12239.1011661590@sss.pgh.pa.us> <3C4D8A39.FF79CDC4@redhat.com> <15339.1011716171@sss.pgh.pa.us> <3C4D96C5.80BBF764@redhat.com> <15638.1011718290@sss.pgh.pa.us>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR

OK, so the proposal is that we dissociate the ownership from the
namespace when we implement our version of SQL-Schemas, right?
This way an object will have both an owner and a schema (while in
the standard they are the same thing).

The important is not much to accommodate someone who is creating
schemas (a new thing, so objects can be created the "right" way)
but rather to accommodate current code that does not use schemas
and have several owners for the objects (which would all fall
into a "default" schema). Can you agree with that?

I was looking to see if we choose the proper defaults and search paths
and the "default" schema we could make it look for SQL-compliant code 
as if it was a vanilla SQL-Schemas implementation.

To support the current database schema definitions (without SQL-Schemas
and with different owners), things would be created with the current
user authorization id and will have its name defined in the "default"
SQL-Schema
namespace.  Also, when referring to an object if the name is not
qualified
with the schema name, the search would go through the schema with the
current authorization id (as required by the std) and proceed to check 
the "default" schema.

The only problem in the scenario above is that the standard says that 
when creating objects and not specifying the schema the schema name
should be assumed to be the current user authorization id (or whatever
authorization id the code is running as).  In our case it would go to
the default schema.  If someone wants the SQL std behavior then, he/she
must create things inside a CREATE SCHEMA statement or explicitly
qualify
with the schema name the objects being created.  Can we live with that?
Will we pass the conformance tests? (I saw tests that test the schema
name
that is assumed when referencing but I do not recall seeing one that
tests
what is assumed on creation -- things I saw were all created inside
CREATE SCHEMA statements.  Note, also, that passing the NIST tests
doesn't
make us compliant if we know that we are doing something different than
what is specified -- it just means that we got away with it :-)


-- 
Fernando Nasser
Red Hat Canada Ltd.                     E-Mail:  fnasser@redhat.com
2323 Yonge Street, Suite #300
Toronto, Ontario   M4P 2C9

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
    (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)

From pgsql-hackers-owner+M17982=candle.pha.pa.us=pgman@postgresql.org Tue Jan 22 15:46:46 2002
Return-path: <pgsql-hackers-owner+M17982=candle.pha.pa.us=pgman@postgresql.org>
Received: from server1.pgsql.org (www.postgresql.org [64.49.215.9])
	by candle.pha.pa.us (8.11.6/8.10.1) with SMTP id g0MKkhU07389
	for <pgman@candle.pha.pa.us>; Tue, 22 Jan 2002 15:46:44 -0500 (EST)
Received: (qmail 82732 invoked by alias); 22 Jan 2002 20:43:40 -0000
Received: from unknown (HELO postgresql.org) (64.49.215.8)
  by www.postgresql.org with SMTP; 22 Jan 2002 20:43:40 -0000
Received: from sss.pgh.pa.us ([192.204.191.242])
	by postgresql.org (8.11.3/8.11.4) with ESMTP id g0MKg8l81714
	for <pgsql-hackers@postgresql.org>; Tue, 22 Jan 2002 15:42:08 -0500 (EST)
	(envelope-from tgl@sss.pgh.pa.us)
Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1])
	by sss.pgh.pa.us (8.11.4/8.11.4) with ESMTP id g0MKfnf28202;
	Tue, 22 Jan 2002 15:41:49 -0500 (EST)
To: Fernando Nasser <fnasser@redhat.com>
cc: Peter Eisentraut <peter_e@gmx.net>, pgsql-hackers@postgresql.org
Subject: Re: [HACKERS] RFD: schemas and different kinds of Postgres objects 
In-Reply-To: <3C4DCBDB.689D7201@redhat.com> 
References: <Pine.LNX.4.30.0201211840260.687-100000@peter.localdomain> <12239.1011661590@sss.pgh.pa.us> <3C4D8A39.FF79CDC4@redhat.com> <15339.1011716171@sss.pgh.pa.us> <3C4D96C5.80BBF764@redhat.com> <15638.1011718290@sss.pgh.pa.us> <3C4DCBDB.689D7201@redhat.com>
Comments: In-reply-to Fernando Nasser <fnasser@redhat.com>
	message dated "Tue, 22 Jan 2002 15:30:20 -0500"
Date: Tue, 22 Jan 2002 15:41:49 -0500
Message-ID: <28199.1011732109@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR

Fernando Nasser <fnasser@redhat.com> writes:
> The only problem in the scenario above is that the standard says that 
> when creating objects and not specifying the schema the schema name
> should be assumed to be the current user authorization id (or whatever
> authorization id the code is running as).  In our case it would go to
> the default schema.  If someone wants the SQL std behavior then, he/she
> must create things inside a CREATE SCHEMA statement or explicitly
> qualify
> with the schema name the objects being created.  Can we live with
> that?

Huh?  You seem to be assuming that we need to support both the
historical Postgres behavior and the SQL-standard behavior with exactly
the same configuration switches.  That's not how I'm seeing it at all.
The way I'm envisioning it, you could get either the historical
behavior, or the standard's behavior, depending on how you set up the
configuration variables.  I don't see any particular reason to limit the
system to just those two cases, either, if the underlying implementation
has enough flexibility to support custom namespace configurations.

I believe that we could get the historical behavior with something like

	schema search path = ("public" schema, system schema);

	default creation schema = "public" schema

and the standard's behavior with something like

	schema search path = (user's own schema, system schema);

	default creation schema = user's own schema

(ignoring the issue of a schema for temp tables for the moment).

If you prefer to think of these things as "namespaces" rather than
"schemas", that's fine with me ... what we're talking about here
is an implementation that can support SQL-style schemas, but isn't
narrowly able to do only that.

			regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org

From pgsql-hackers-owner+M17985=candle.pha.pa.us=pgman@postgresql.org Tue Jan 22 16:15:56 2002
Return-path: <pgsql-hackers-owner+M17985=candle.pha.pa.us=pgman@postgresql.org>
Received: from server1.pgsql.org (www.postgresql.org [64.49.215.9])
	by candle.pha.pa.us (8.11.6/8.10.1) with SMTP id g0MLFrU10671
	for <pgman@candle.pha.pa.us>; Tue, 22 Jan 2002 16:15:53 -0500 (EST)
Received: (qmail 94223 invoked by alias); 22 Jan 2002 21:14:17 -0000
Received: from unknown (HELO postgresql.org) (64.49.215.8)
  by www.postgresql.org with SMTP; 22 Jan 2002 21:14:17 -0000
Received: from cygnus.com (runyon.sfbay.redhat.com [205.180.230.5] (may be forged))
	by postgresql.org (8.11.3/8.11.4) with SMTP id g0ML2fl90295
	for <pgsql-hackers@postgresql.org>; Tue, 22 Jan 2002 16:02:41 -0500 (EST)
	(envelope-from fnasser@redhat.com)
Received: from redhat.com (rtl.sfbay.redhat.com [205.180.230.21])
	by runyon.cygnus.com (8.8.7-cygnus/8.8.7) with ESMTP id NAA12269;
	Tue, 22 Jan 2002 13:02:34 -0800 (PST)
Message-ID: <3C4DD34F.CC4D8B6@redhat.com>
Date: Tue, 22 Jan 2002 16:02:07 -0500
From: Fernando Nasser <fnasser@redhat.com>
Organization: Red Hat Canada
X-Mailer: Mozilla 4.78 [en] (X11; U; Linux 2.4.9-13 i686)
X-Accept-Language: en
MIME-Version: 1.0
To: Tom Lane <tgl@sss.pgh.pa.us>
cc: Peter Eisentraut <peter_e@gmx.net>, pgsql-hackers@postgresql.org
Subject: Re: [HACKERS] RFD: schemas and different kinds of Postgres objects
References: <Pine.LNX.4.30.0201211840260.687-100000@peter.localdomain> <12239.1011661590@sss.pgh.pa.us> <3C4D8A39.FF79CDC4@redhat.com> <15339.1011716171@sss.pgh.pa.us> <3C4D96C5.80BBF764@redhat.com> <15638.1011718290@sss.pgh.pa.us> <3C4DCBDB.689D7201@redhat.com> <28199.1011732109@sss.pgh.pa.us>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR

Tom Lane wrote:
> 
> Huh?  You seem to be assuming that we need to support both the
> historical Postgres behavior and the SQL-standard behavior with exactly
> the same configuration switches.  That's not how I'm seeing it at all.
> The way I'm envisioning it, you could get either the historical
> behavior, or the standard's behavior, depending on how you set up the
> configuration variables.  

Then we can live just with the schema being the ownership.

Switches set to standard:

  schema search path = ("user's own schema", postgres)

  [ default creation schema = user's own schema ]  same as below,
                                                   we don't need this
switch

Switches set to historical:

  schema search path = (user's own schema, "any" schema, postgres)

  [ default creation schema = user's own schema ]

The searching in "any" schema (i.e., any owner) will let will find 
things that where defined the way they are today, i.e., possibly
by several different users.


P.S.: You can even add the "default" schema in the standard case and
I believe you are still compliant and can handle things easier:
  schema search path = ("user's own schema", postgres)


Maybe you could give an example of a case where the schema meaning
ownership breaks things.  Or what kind of additional things you have
in mind that would require orthogonal schema and ownership spaces.


Regards,
Fernando




-- 
Fernando Nasser
Red Hat Canada Ltd.                     E-Mail:  fnasser@redhat.com
2323 Yonge Street, Suite #300
Toronto, Ontario   M4P 2C9

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly

From pgsql-hackers-owner+M17986=candle.pha.pa.us=pgman@postgresql.org Tue Jan 22 16:23:41 2002
Return-path: <pgsql-hackers-owner+M17986=candle.pha.pa.us=pgman@postgresql.org>
Received: from server1.pgsql.org (www.postgresql.org [64.49.215.9])
	by candle.pha.pa.us (8.11.6/8.10.1) with SMTP id g0MLNbU11596
	for <pgman@candle.pha.pa.us>; Tue, 22 Jan 2002 16:23:38 -0500 (EST)
Received: (qmail 703 invoked by alias); 22 Jan 2002 21:23:31 -0000
Received: from unknown (HELO postgresql.org) (64.49.215.8)
  by www.postgresql.org with SMTP; 22 Jan 2002 21:23:31 -0000
Received: from sss.pgh.pa.us ([192.204.191.242])
	by postgresql.org (8.11.3/8.11.4) with ESMTP id g0MLEYl94662
	for <pgsql-hackers@postgresql.org>; Tue, 22 Jan 2002 16:14:34 -0500 (EST)
	(envelope-from tgl@sss.pgh.pa.us)
Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1])
	by sss.pgh.pa.us (8.11.4/8.11.4) with ESMTP id g0MLEGf28560;
	Tue, 22 Jan 2002 16:14:17 -0500 (EST)
To: Fernando Nasser <fnasser@redhat.com>
cc: Peter Eisentraut <peter_e@gmx.net>, pgsql-hackers@postgresql.org
Subject: Re: [HACKERS] RFD: schemas and different kinds of Postgres objects 
In-Reply-To: <3C4DD34F.CC4D8B6@redhat.com> 
References: <Pine.LNX.4.30.0201211840260.687-100000@peter.localdomain> <12239.1011661590@sss.pgh.pa.us> <3C4D8A39.FF79CDC4@redhat.com> <15339.1011716171@sss.pgh.pa.us> <3C4D96C5.80BBF764@redhat.com> <15638.1011718290@sss.pgh.pa.us> <3C4DCBDB.689D7201@redhat.com> <28199.1011732109@sss.pgh.pa.us> <3C4DD34F.CC4D8B6@redhat.com>
Comments: In-reply-to Fernando Nasser <fnasser@redhat.com>
	message dated "Tue, 22 Jan 2002 16:02:07 -0500"
Date: Tue, 22 Jan 2002 16:14:16 -0500
Message-ID: <28557.1011734056@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR

Fernando Nasser <fnasser@redhat.com> writes:
> Switches set to historical:

>   schema search path = (user's own schema, "any" schema, postgres)

>   [ default creation schema = user's own schema ]

> The searching in "any" schema (i.e., any owner) will let will find 
> things that where defined the way they are today, i.e., possibly
> by several different users.

No, it won't, because nothing will ever get put into that schema.
(At least not by existing pg_dump scripts, which are the things that
really need to see the historical behavior.)  The
default-creation-schema variable has got to point at any/public/
whatever-we-call it, or you do not have the historical behavior.

			regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly

From pgsql-hackers-owner+M17988=candle.pha.pa.us=pgman@postgresql.org Tue Jan 22 16:44:43 2002
Return-path: <pgsql-hackers-owner+M17988=candle.pha.pa.us=pgman@postgresql.org>
Received: from server1.pgsql.org (www.postgresql.org [64.49.215.9])
	by candle.pha.pa.us (8.11.6/8.10.1) with SMTP id g0MLifU13572
	for <pgman@candle.pha.pa.us>; Tue, 22 Jan 2002 16:44:41 -0500 (EST)
Received: (qmail 8653 invoked by alias); 22 Jan 2002 21:43:27 -0000
Received: from unknown (HELO postgresql.org) (64.49.215.8)
  by www.postgresql.org with SMTP; 22 Jan 2002 21:43:27 -0000
Received: from cygnus.com (runyon.sfbay.redhat.com [205.180.230.5] (may be forged))
	by postgresql.org (8.11.3/8.11.4) with SMTP id g0MLR6l02610
	for <pgsql-hackers@postgresql.org>; Tue, 22 Jan 2002 16:27:06 -0500 (EST)
	(envelope-from fnasser@redhat.com)
Received: from redhat.com (rtl.sfbay.redhat.com [205.180.230.21])
	by runyon.cygnus.com (8.8.7-cygnus/8.8.7) with ESMTP id NAA14337;
	Tue, 22 Jan 2002 13:27:00 -0800 (PST)
Message-ID: <3C4DD909.F26FD0D1@redhat.com>
Date: Tue, 22 Jan 2002 16:26:33 -0500
From: Fernando Nasser <fnasser@redhat.com>
Organization: Red Hat Canada
X-Mailer: Mozilla 4.78 [en] (X11; U; Linux 2.4.9-13 i686)
X-Accept-Language: en
MIME-Version: 1.0
To: Tom Lane <tgl@sss.pgh.pa.us>
cc: Peter Eisentraut <peter_e@gmx.net>, pgsql-hackers@postgresql.org
Subject: Re: [HACKERS] RFD: schemas and different kinds of Postgres objects
References: <Pine.LNX.4.30.0201211840260.687-100000@peter.localdomain> <12239.1011661590@sss.pgh.pa.us> <3C4D8A39.FF79CDC4@redhat.com> <15339.1011716171@sss.pgh.pa.us> <3C4D96C5.80BBF764@redhat.com> <15638.1011718290@sss.pgh.pa.us> <3C4DCBDB.689D7201@redhat.com> <28199.1011732109@sss.pgh.pa.us> <3C4DD34F.CC4D8B6@redhat.com> <28557.1011734056@sss.pgh.pa.us>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR

Tom Lane wrote:
> 
> Fernando Nasser <fnasser@redhat.com> writes:
> > Switches set to historical:
> 
> >   schema search path = (user's own schema, "any" schema, postgres)
> 
> >   [ default creation schema = user's own schema ]
> 
> > The searching in "any" schema (i.e., any owner) will let will find
> > things that where defined the way they are today, i.e., possibly
> > by several different users.
> 
> No, it won't, because nothing will ever get put into that schema.
> (At least not by existing pg_dump scripts, which are the things that
> really need to see the historical behavior.)  The
> default-creation-schema variable has got to point at any/public/
> whatever-we-call it, or you do not have the historical behavior.
> 

You did not understand what I meant by "any".  It is not a schema
called "any".  It is _any_ schema.

Example:

A creates a table (do not specify the schema) so it gets into
the schema named A (as per standard).

B refers to the table without qualifying it...

In the standard case:  look into schema B (=> not found), not in
postgres either.
ERROR: Inv. relation     As the standard requires.

In the historical mode:  look into schema B (=> not found), look into
ANY
schema (finds it in A).  Works as it is today.


Note that I only suggest looking in B first (in the historical case)
because
this will allow for the coexistence of the current mode with a
quasi-compliant
use of SQL-Schemas.  You only need to change the switch if you want
strict
compliance.



-- 
Fernando Nasser
Red Hat Canada Ltd.                     E-Mail:  fnasser@redhat.com
2323 Yonge Street, Suite #300
Toronto, Ontario   M4P 2C9

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

From pgsql-hackers-owner+M17987=candle.pha.pa.us=pgman@postgresql.org Tue Jan 22 16:45:30 2002
Return-path: <pgsql-hackers-owner+M17987=candle.pha.pa.us=pgman@postgresql.org>
Received: from server1.pgsql.org (www.postgresql.org [64.49.215.9])
	by candle.pha.pa.us (8.11.6/8.10.1) with SMTP id g0MLjSU13642
	for <pgman@candle.pha.pa.us>; Tue, 22 Jan 2002 16:45:29 -0500 (EST)
Received: (qmail 8533 invoked by alias); 22 Jan 2002 21:43:23 -0000
Received: from unknown (HELO postgresql.org) (64.49.215.8)
  by www.postgresql.org with SMTP; 22 Jan 2002 21:43:23 -0000
Received: from sss.pgh.pa.us ([192.204.191.242])
	by postgresql.org (8.11.3/8.11.4) with ESMTP id g0MLZ5l06911
	for <pgsql-hackers@postgresql.org>; Tue, 22 Jan 2002 16:35:05 -0500 (EST)
	(envelope-from tgl@sss.pgh.pa.us)
Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1])
	by sss.pgh.pa.us (8.11.4/8.11.4) with ESMTP id g0MLYlf28790;
	Tue, 22 Jan 2002 16:34:47 -0500 (EST)
To: Fernando Nasser <fnasser@redhat.com>
cc: Peter Eisentraut <peter_e@gmx.net>, pgsql-hackers@postgresql.org
Subject: Re: [HACKERS] RFD: schemas and different kinds of Postgres objects 
In-Reply-To: <3C4DD909.F26FD0D1@redhat.com> 
References: <Pine.LNX.4.30.0201211840260.687-100000@peter.localdomain> <12239.1011661590@sss.pgh.pa.us> <3C4D8A39.FF79CDC4@redhat.com> <15339.1011716171@sss.pgh.pa.us> <3C4D96C5.80BBF764@redhat.com> <15638.1011718290@sss.pgh.pa.us> <3C4DCBDB.689D7201@redhat.com> <28199.1011732109@sss.pgh.pa.us> <3C4DD34F.CC4D8B6@redhat.com> <28557.1011734056@sss.pgh.pa.us> <3C4DD909.F26FD0D1@redhat.com>
Comments: In-reply-to Fernando Nasser <fnasser@redhat.com>
	message dated "Tue, 22 Jan 2002 16:26:33 -0500"
Date: Tue, 22 Jan 2002 16:34:47 -0500
Message-ID: <28787.1011735287@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR

Fernando Nasser <fnasser@redhat.com> writes:
> In the historical mode:  look into schema B (=> not found), look into
> ANY schema (finds it in A).  Works as it is today.

No, it doesn't work the same as today, because in that implementation
both A and B can create the same tablename without complaint.  It then
becomes very unclear which instance other people will get (unless your
"any" placeholder somehow implies a search order).

The idea of being able to put an "any" placeholder into the search list
is an interesting one, though.  If we can resolve the ambiguity problem
it might be a useful feature.

I am a little troubled by the idea of placing "any" before the system
schema (what if JRandomLuser creates a table named "pg_class"?) but it
might be workable at the tail end of the path.

			regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

From pgsql-hackers-owner+M17991=candle.pha.pa.us=pgman@postgresql.org Tue Jan 22 17:13:49 2002
Return-path: <pgsql-hackers-owner+M17991=candle.pha.pa.us=pgman@postgresql.org>
Received: from server1.pgsql.org (www.postgresql.org [64.49.215.9])
	by candle.pha.pa.us (8.11.6/8.10.1) with SMTP id g0MMDmU19678
	for <pgman@candle.pha.pa.us>; Tue, 22 Jan 2002 17:13:49 -0500 (EST)
Received: (qmail 19170 invoked by alias); 22 Jan 2002 22:13:14 -0000
Received: from unknown (HELO postgresql.org) (64.49.215.8)
  by www.postgresql.org with SMTP; 22 Jan 2002 22:13:14 -0000
Received: from cygnus.com (runyon.sfbay.redhat.com [205.180.230.5] (may be forged))
	by postgresql.org (8.11.3/8.11.4) with SMTP id g0MM3ql17554
	for <pgsql-hackers@postgresql.org>; Tue, 22 Jan 2002 17:03:53 -0500 (EST)
	(envelope-from fnasser@redhat.com)
Received: from redhat.com (rtl.sfbay.redhat.com [205.180.230.21])
	by runyon.cygnus.com (8.8.7-cygnus/8.8.7) with ESMTP id OAA18084;
	Tue, 22 Jan 2002 14:03:46 -0800 (PST)
Message-ID: <3C4DE1A7.98860E96@redhat.com>
Date: Tue, 22 Jan 2002 17:03:19 -0500
From: Fernando Nasser <fnasser@redhat.com>
Organization: Red Hat Canada
X-Mailer: Mozilla 4.78 [en] (X11; U; Linux 2.4.9-13 i686)
X-Accept-Language: en
MIME-Version: 1.0
To: Tom Lane <tgl@sss.pgh.pa.us>
cc: Peter Eisentraut <peter_e@gmx.net>, pgsql-hackers@postgresql.org
Subject: Re: [HACKERS] RFD: schemas and different kinds of Postgres objects
References: <Pine.LNX.4.30.0201211840260.687-100000@peter.localdomain> <12239.1011661590@sss.pgh.pa.us> <3C4D8A39.FF79CDC4@redhat.com> <15339.1011716171@sss.pgh.pa.us> <3C4D96C5.80BBF764@redhat.com> <15638.1011718290@sss.pgh.pa.us> <3C4DCBDB.689D7201@redhat.com> <28199.1011732109@sss.pgh.pa.us> <3C4DD34F.CC4D8B6@redhat.com> <28557.1011734056@sss.pgh.pa.us> <3C4DD909.F26FD0D1@redhat.com> <28787.1011735287@sss.pgh.pa.us>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR

Tom Lane wrote:
> 
> Fernando Nasser <fnasser@redhat.com> writes:
> > In the historical mode:  look into schema B (=> not found), look into
> > ANY schema (finds it in A).  Works as it is today.
> 
> No, it doesn't work the same as today, because in that implementation
> both A and B can create the same tablename without complaint.

I agree that we won't be able to catch this as an error unless we turn 
another switch that requires unique names (there goes one of the
advantages
of having schemas, but there is always the option of leaving it on).

In this case it would be more close to the current behavior but what is
left of the SQL-Schemas will be more of a syntactic sugar (although it
can
be still used by the DBA to better organize the grant of privileges).

Anyway, it would be a DBA option to live with not detecting duplicate
names. And, I hope all our tools, graphical or not, will make it clear
what
is the schema things are defined into, so it would not be difficult to 
figure out what is going wrong if something goes wrong (and we can also
print the relation oid on messages).  

>  It then
> becomes very unclear which instance other people will get (unless your
> "any" placeholder somehow implies a search order).
> 

If someone is just using the current mode, there shouldn't be (all names
are
database-unique).

The only case where this situation can happen is if someone is trying
to use schemas and the historical non-schema organization in the same
database, right?  Can we make the search order per database?)

One possibility is to state that this is not recommended (one should 
organize things as schemas or not at all in a database) and say that 
the search order, besides the current AuthId, is unspecified (random). 

Another possibility is to allow only one object with that name in the
"any" space.  If someone means an object that was defined on a schema,
he/she can qualify the name with the schema (good practice).  The only
case where this is not possible is the legacy case, where there is 
exactly one object with that name anyway.

I prefer this second solution.

> The idea of being able to put an "any" placeholder into the search list
> is an interesting one, though.  If we can resolve the ambiguity problem
> it might be a useful feature.
> 

See above.

> I am a little troubled by the idea of placing "any" before the system
> schema (what if JRandomLuser creates a table named "pg_class"?) but it
> might be workable at the tail end of the path.
> 

Yes, I thought of that as I was typing, but it was not the important
point at that time.  You're right, should go at the end.

-- 
Fernando Nasser
Red Hat Canada Ltd.                     E-Mail:  fnasser@redhat.com
2323 Yonge Street, Suite #300
Toronto, Ontario   M4P 2C9

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/users-lounge/docs/faq.html

From pgsql-hackers-owner+M17993=candle.pha.pa.us=pgman@postgresql.org Tue Jan 22 18:44:53 2002
Return-path: <pgsql-hackers-owner+M17993=candle.pha.pa.us=pgman@postgresql.org>
Received: from server1.pgsql.org (www.postgresql.org [64.49.215.9])
	by candle.pha.pa.us (8.11.6/8.10.1) with SMTP id g0MNiqU29215
	for <pgman@candle.pha.pa.us>; Tue, 22 Jan 2002 18:44:53 -0500 (EST)
Received: (qmail 36986 invoked by alias); 22 Jan 2002 23:43:31 -0000
Received: from unknown (HELO postgresql.org) (64.49.215.8)
  by www.postgresql.org with SMTP; 22 Jan 2002 23:43:31 -0000
Received: from student.gvsu.edu ([148.61.7.124])
	by postgresql.org (8.11.3/8.11.4) with ESMTP id g0MNGYl30543
	for <pgsql-hackers@postgreSQL.org>; Tue, 22 Jan 2002 18:16:34 -0500 (EST)
	(envelope-from peter_e@gmx.net)
Received: from [148.61.250.147] [148.61.250.147] by student.gvsu.edu
	with Novonyx SMTP Server $Revision: 1.3 $; Tue, 22 Jan 2002 18:16:37 -0500 (EDT)
Date: Tue, 22 Jan 2002 18:18:38 -0500 (EST)
From: Peter Eisentraut <peter_e@gmx.net>
X-Sender: <peter@peter.localdomain>
To: Tom Lane <tgl@sss.pgh.pa.us>
cc: <pgsql-hackers@postgresql.org>
Subject: Re: [HACKERS] RFD: schemas and different kinds of Postgres objects
In-Reply-To: <12239.1011661590@sss.pgh.pa.us>
Message-ID: <Pine.LNX.4.30.0201221816130.686-100000@peter.localdomain>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR

Tom Lane writes:

> I don't buy that premise.  It's true that SQL92 equates ownership of a
> schema with ownership of the objects therein, but AFAICS we have no hope
> of being forward-compatible with existing database setups (wherein there
> can be multiple tables of different ownership all in a single namespace)
> if we don't allow varying ownership within a schema.

We could have a Boolean knob that says "if you don't find the object in
the default schema, search all other schemas".  That should provide all
the backward compatibility we need.  Moreover, I figure if we do it that
way, the whole schema implementation reduces itself mostly to parser work,
no complicated system catalog changes, no complex overhaul of the
privilege system -- at least initially.

-- 
Peter Eisentraut   peter_e@gmx.net


---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org

From pgsql-hackers-owner+M17992=candle.pha.pa.us=pgman@postgresql.org Tue Jan 22 18:34:48 2002
Return-path: <pgsql-hackers-owner+M17992=candle.pha.pa.us=pgman@postgresql.org>
Received: from server1.pgsql.org (www.postgresql.org [64.49.215.9])
	by candle.pha.pa.us (8.11.6/8.10.1) with SMTP id g0MNYmU28419
	for <pgman@candle.pha.pa.us>; Tue, 22 Jan 2002 18:34:48 -0500 (EST)
Received: (qmail 32848 invoked by alias); 22 Jan 2002 23:34:10 -0000
Received: from unknown (HELO postgresql.org) (64.49.215.8)
  by www.postgresql.org with SMTP; 22 Jan 2002 23:34:10 -0000
Received: from student.gvsu.edu ([148.61.7.124])
	by postgresql.org (8.11.3/8.11.4) with ESMTP id g0MNPUl31485
	for <pgsql-hackers@postgresql.org>; Tue, 22 Jan 2002 18:25:30 -0500 (EST)
	(envelope-from peter_e@gmx.net)
Received: from [148.61.250.147] [148.61.250.147] by student.gvsu.edu
	with Novonyx SMTP Server $Revision: 1.3 $; Tue, 22 Jan 2002 18:25:33 -0500 (EDT)
Date: Tue, 22 Jan 2002 18:27:35 -0500 (EST)
From: Peter Eisentraut <peter_e@gmx.net>
X-Sender: <peter@peter.localdomain>
To: Tom Lane <tgl@sss.pgh.pa.us>
cc: Fernando Nasser <fnasser@redhat.com>, <pgsql-hackers@postgresql.org>
Subject: Re: [HACKERS] RFD: schemas and different kinds of Postgres objects
In-Reply-To: <28787.1011735287@sss.pgh.pa.us>
Message-ID: <Pine.LNX.4.30.0201221824360.686-100000@peter.localdomain>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR

Tom Lane writes:

> No, it doesn't work the same as today, because in that implementation
> both A and B can create the same tablename without complaint.  It then
> becomes very unclear which instance other people will get (unless your
> "any" placeholder somehow implies a search order).

The "search any schema" switch is only intended for use with legacy
databases, where duplicate names don't occur anyway.  If someone uses it
with a new schema-using database design, then he kind of ought to know
that the switch probably doesn't make a whole lot of sense.  However, to
get reproduceable behaviour anyway we can just define a search order, such
as by schema name.

-- 
Peter Eisentraut   peter_e@gmx.net


---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org

From pgsql-hackers-owner+M17994=candle.pha.pa.us=pgman@postgresql.org Tue Jan 22 18:45:53 2002
Return-path: <pgsql-hackers-owner+M17994=candle.pha.pa.us=pgman@postgresql.org>
Received: from server1.pgsql.org (www.postgresql.org [64.49.215.9])
	by candle.pha.pa.us (8.11.6/8.10.1) with SMTP id g0MNjqU29324
	for <pgman@candle.pha.pa.us>; Tue, 22 Jan 2002 18:45:52 -0500 (EST)
Received: (qmail 37021 invoked by alias); 22 Jan 2002 23:43:34 -0000
Received: from unknown (HELO postgresql.org) (64.49.215.8)
  by www.postgresql.org with SMTP; 22 Jan 2002 23:43:34 -0000
Received: from sss.pgh.pa.us ([192.204.191.242])
	by postgresql.org (8.11.3/8.11.4) with ESMTP id g0MNVOl31958
	for <pgsql-hackers@postgreSQL.org>; Tue, 22 Jan 2002 18:31:24 -0500 (EST)
	(envelope-from tgl@sss.pgh.pa.us)
Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1])
	by sss.pgh.pa.us (8.11.4/8.11.4) with ESMTP id g0MNV8f29291;
	Tue, 22 Jan 2002 18:31:08 -0500 (EST)
To: Peter Eisentraut <peter_e@gmx.net>
cc: pgsql-hackers@postgresql.org
Subject: Re: [HACKERS] RFD: schemas and different kinds of Postgres objects 
In-Reply-To: <Pine.LNX.4.30.0201221816130.686-100000@peter.localdomain> 
References: <Pine.LNX.4.30.0201221816130.686-100000@peter.localdomain>
Comments: In-reply-to Peter Eisentraut <peter_e@gmx.net>
	message dated "Tue, 22 Jan 2002 18:18:38 -0500"
Date: Tue, 22 Jan 2002 18:31:08 -0500
Message-ID: <29288.1011742268@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR

Peter Eisentraut <peter_e@gmx.net> writes:
> Moreover, I figure if we do it that
> way, the whole schema implementation reduces itself mostly to parser work,
> no complicated system catalog changes, no complex overhaul of the
> privilege system -- at least initially.

Why are you guys so eager to save me work?  I'm not in the least
interested in implementing a "schema" feature that can only handle
the entry-level user == schema case.  Therefore, just relabeling the
owner column as schema isn't an interesting option.

I really don't see what's wrong with building a namespace mechanism
that is orthogonal to ownership and then using that to implement what
SQL92 wants.  I think this will be cleaner, simpler, and more flexible
than trying to equate ownership with namespace.

			regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

From pgsql-hackers-owner+M17997=candle.pha.pa.us=pgman@postgresql.org Tue Jan 22 19:13:42 2002
Return-path: <pgsql-hackers-owner+M17997=candle.pha.pa.us=pgman@postgresql.org>
Received: from server1.pgsql.org (www.postgresql.org [64.49.215.9])
	by candle.pha.pa.us (8.11.6/8.10.1) with SMTP id g0N0DgU01512
	for <pgman@candle.pha.pa.us>; Tue, 22 Jan 2002 19:13:42 -0500 (EST)
Received: (qmail 46269 invoked by alias); 23 Jan 2002 00:13:11 -0000
Received: from unknown (HELO postgresql.org) (64.49.215.8)
  by www.postgresql.org with SMTP; 23 Jan 2002 00:13:11 -0000
Received: from sss.pgh.pa.us ([192.204.191.242])
	by postgresql.org (8.11.3/8.11.4) with ESMTP id g0N02bl42634
	for <pgsql-hackers@postgresql.org>; Tue, 22 Jan 2002 19:02:37 -0500 (EST)
	(envelope-from tgl@sss.pgh.pa.us)
Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1])
	by sss.pgh.pa.us (8.11.4/8.11.4) with ESMTP id g0N02Kf29439;
	Tue, 22 Jan 2002 19:02:21 -0500 (EST)
To: Peter Eisentraut <peter_e@gmx.net>
cc: Fernando Nasser <fnasser@redhat.com>, pgsql-hackers@postgresql.org
Subject: Re: [HACKERS] RFD: schemas and different kinds of Postgres objects 
In-Reply-To: <Pine.LNX.4.30.0201221824360.686-100000@peter.localdomain> 
References: <Pine.LNX.4.30.0201221824360.686-100000@peter.localdomain>
Comments: In-reply-to Peter Eisentraut <peter_e@gmx.net>
	message dated "Tue, 22 Jan 2002 18:27:35 -0500"
Date: Tue, 22 Jan 2002 19:02:20 -0500
Message-ID: <29436.1011744140@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR

Peter Eisentraut <peter_e@gmx.net> writes:
> Tom Lane writes:
>> No, it doesn't work the same as today, because in that implementation
>> both A and B can create the same tablename without complaint.  It then
>> becomes very unclear which instance other people will get (unless your
>> "any" placeholder somehow implies a search order).

> The "search any schema" switch is only intended for use with legacy
> databases, where duplicate names don't occur anyway.

That's a mighty narrow view of the world.  Do you think that people had
better convert to SQL schemas before they ever again create a table?
The fact is that ordinary non-schema-aware usage will certainly lead to
the above scenario.

> that the switch probably doesn't make a whole lot of sense.  However, to
> get reproduceable behaviour anyway we can just define a search order, such
> as by schema name.

Or say that you get an "ambiguous reference" error if there is more than
one possible candidate in the "any" namespace.  (Although that opens the
door for innocent creation of a table foo by one user to break other
people's formerly-working queries that reference some other foo.)
Bottom line for me is that this is an untried concept.  I think the
concept of an "any" searchlist entry is risky enough that I don't much
want to hang the entire usability of the implementation on the
assumption that we won't find any fatal problems with "any".


However, the argument over whether SQL92's concept of ownership should
be taken as gospel is not really the argument I wanted to have in this
thread.  Is it possible to go back to the original point concerning
whether there should be different namespace boundaries for different
types of objects?  You aren't going to avoid those issues by saying that
namespace == ownership is good enough.

I'm particularly troubled by the idea of trying to apply this "any"
lookup concept to resolution of overloaded operators and functions.
Suppose I have a reference func(type1,type2) that I'm trying to resolve,
and I have an inexact match (one requiring coercion) in my own schema.
Do I look to the "any" schema to see if there are better matches?
If so, what happens if the "any" schema contains multiple possibilities
with identical signatures (presumably created by different users)?  ISTM
this will positively guarantee a resolution failure, since there's no
way for the resolver to prefer one over another.  Thus, by creating
a "func(foo,bar)" function --- quite legally --- JRandomLuser might
break other people's formerly working queries that use other functions
named func.  Although it's possible for this to happen now, it'll be
a lot more surprising if JRandomLuser thinks that his functions live
in his own private schema namespace.

I'm thinking that the overloading concept is not going to play well
at all with multiple namespaces for functions or operators, and that
we'd be best off to say that there is only one namespace (per database)
for these things.

			regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

From pgsql-hackers-owner+M17998=candle.pha.pa.us=pgman@postgresql.org Tue Jan 22 19:33:10 2002
Return-path: <pgsql-hackers-owner+M17998=candle.pha.pa.us=pgman@postgresql.org>
Received: from server1.pgsql.org (www.postgresql.org [64.49.215.9])
	by candle.pha.pa.us (8.11.6/8.10.1) with SMTP id g0N0X9U02302
	for <pgman@candle.pha.pa.us>; Tue, 22 Jan 2002 19:33:09 -0500 (EST)
Received: (qmail 52787 invoked by alias); 23 Jan 2002 00:33:08 -0000
Received: from unknown (HELO postgresql.org) (64.49.215.8)
  by www.postgresql.org with SMTP; 23 Jan 2002 00:33:08 -0000
Received: from ece.rice.edu (ece.rice.edu [128.42.4.34])
	by postgresql.org (8.11.3/8.11.4) with ESMTP id g0N0IEl49263
	for <pgsql-hackers@postgresql.org>; Tue, 22 Jan 2002 19:18:14 -0500 (EST)
	(envelope-from reedstrm@rice.edu)
Received: from localhost (localhost [127.0.0.1])
	by ece.rice.edu (Postfix) with ESMTP
	id A57FF68A57; Tue, 22 Jan 2002 18:18:14 -0600 (CST)
Received: from wallace.ece.rice.edu (wallace.ece.rice.edu [128.42.12.154])
	by ece.rice.edu (Postfix) with ESMTP
	id 393F168A1D; Tue, 22 Jan 2002 18:18:13 -0600 (CST)
Received: from reedstrm by wallace.ece.rice.edu with local (Exim 3.22 #1 (Debian))
	id 16TB7F-000292-00; Tue, 22 Jan 2002 18:18:13 -0600
Date: Tue, 22 Jan 2002 18:18:13 -0600
From: "Ross J. Reedstrom" <reedstrm@rice.edu>
To: Tom Lane <tgl@sss.pgh.pa.us>
cc: Peter Eisentraut <peter_e@gmx.net>, pgsql-hackers@postgresql.org
Subject: Re: [HACKERS] RFD: schemas and different kinds of Postgres objects
Message-ID: <20020123001812.GB7932@rice.edu>
Mail-Followup-To: "Ross J. Reedstrom" <reedstrm@ece.rice.edu>,
	Tom Lane <tgl@sss.pgh.pa.us>, Peter Eisentraut <peter_e@gmx.net>,
	pgsql-hackers@postgresql.org
References: <Pine.LNX.4.30.0201221816130.686-100000@peter.localdomain> <29288.1011742268@sss.pgh.pa.us>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <29288.1011742268@sss.pgh.pa.us>
User-Agent: Mutt/1.3.25i
X-Virus-Scanned: by AMaViS snapshot-20010714
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR

On Tue, Jan 22, 2002 at 06:31:08PM -0500, Tom Lane wrote:
> Peter Eisentraut <peter_e@gmx.net> writes:
> > Moreover, I figure if we do it that
> > way, the whole schema implementation reduces itself mostly to parser work,
> > no complicated system catalog changes, no complex overhaul of the
> > privilege system -- at least initially.
> 
> Why are you guys so eager to save me work?  I'm not in the least
> interested in implementing a "schema" feature that can only handle
> the entry-level user == schema case.  Therefore, just relabeling the
> owner column as schema isn't an interesting option.
> 
> I really don't see what's wrong with building a namespace mechanism
> that is orthogonal to ownership and then using that to implement what
> SQL92 wants.  I think this will be cleaner, simpler, and more flexible
> than trying to equate ownership with namespace.
> 

I'm with Tom on this: the extended Schema capability he's described
combines the best of both authentication mechanisms, IMHO. It give
us namespace separation ala the SQL standard, and individual object
ownership, like unix FS semantics. Only having ownership on the
'containers' strikes me as limiting, even if that is how the standard
describes it.

Ross

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

From pgsql-hackers-owner+M18002=candle.pha.pa.us=pgman@postgresql.org Tue Jan 22 20:33:04 2002
Return-path: <pgsql-hackers-owner+M18002=candle.pha.pa.us=pgman@postgresql.org>
Received: from server1.pgsql.org (www.postgresql.org [64.49.215.9])
	by candle.pha.pa.us (8.11.6/8.10.1) with SMTP id g0N1X3U05117
	for <pgman@candle.pha.pa.us>; Tue, 22 Jan 2002 20:33:03 -0500 (EST)
Received: (qmail 73320 invoked by alias); 23 Jan 2002 01:32:55 -0000
Received: from unknown (HELO postgresql.org) (64.49.215.8)
  by www.postgresql.org with SMTP; 23 Jan 2002 01:32:55 -0000
Received: from mail.netbsd.org (mail.netbsd.org [155.53.1.253])
	by postgresql.org (8.11.3/8.11.4) with SMTP id g0N1FDl69103
	for <pgsql-hackers@postgreSQL.org>; Tue, 22 Jan 2002 20:15:14 -0500 (EST)
	(envelope-from wrstuden@netbsd.org)
Received: (qmail 12961 invoked by uid 1130); 23 Jan 2002 01:15:07 -0000
Date: Tue, 22 Jan 2002 17:10:24 -0800 (PST)
From: Bill Studenmund <wrstuden@netbsd.org>
X-X-Sender: <wrstuden@vespasia.home-net.internetconnect.net>
To: Tom Lane <tgl@sss.pgh.pa.us>
cc: <pgsql-hackers@postgresql.org>
Subject: Re: [HACKERS] RFD: schemas and different kinds of Postgres objects
In-Reply-To: <11381.1011648592@sss.pgh.pa.us>
Message-ID: <Pine.NEB.4.33.0201221657270.5119-100000@vespasia.home-net.internetconnect.net>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR

On Mon, 21 Jan 2002, Tom Lane wrote:

> Continuing to think about implementing SQL schemas for 7.3 ...
>
> Today's topic for discussion: which types of Postgres objects should
> belong to schemas, and which ones should have other name scopes?
>
> Relations (tables, indexes, views, sequences) clearly belong to schemas.
> Since each relation has an associated datatype with the same name, it
> seems that datatypes must belong to schemas as well.  (Even if that
> argument doesn't convince you, SQL99 says that user-defined datatypes
> belong to schemas.)  However the situation is murkier for other kinds of
> objects.
>
> Here are all the kinds of named objects that exist in Postgres today,
> with some comments on whether they should belong to schemas or not:
>
> relations		Must be in schemas
> types			Must be in schemas
> databases		Databases contain schemas, not vice versa
> users			Users are cross-database, so not in schemas
> groups			User groups are cross-database, so not in schemas
> languages		Probably should not be in schemas
> access methods		Probably should not be in schemas
> opclasses		See below
> operators		See below
> functions/procedures	See below
> aggregates		Should treat same as regular functions
> constraints		See below
> rules			See below
> triggers		See below
> NOTIFY conditions	See below
>
> Languages and access methods are not trivial to add to the system, so
> there's not much risk of name conflicts, and no reason to make their name
> scope less than global.
>
> The situation is a lot murkier for operators and functions.  These should
> probably be treated alike, since operators are just syntactic sugar for
> functions.  I think the basic argument for making them schema-local is
> that different users might conceivably want to define conflicting
> functions or operators of the same name.  Against that, however, there
> are a number of reasons for wanting to keep these objects database-wide.
> First off there are syntactic problems.  Do you really want to write
> 		A schemaname.+ B
> to qualify an ambiguous "+" operator?  Looks way too much like a syntax
> error to me.  Allowing this would probably turn a lot of simple syntax
> errors into things that get past the grammar and end up producing truly
> confusing error messages.  Qualified function names also pose some
> problems, not so much with
> 		schemaname.function(args)
> which seems reasonable, but with the Berkeley-derived syntax that allows
> "foo.function" to mean "function(foo)" --- there's no way to squeeze a
> schema-name for the function into that.  (And you'll recall from my note

Why not? What's wrong with either schema.foo.function (==>
function(schema.foo)) or foo.schema.function (==> schema.function(foo))?
Tables and functions can't have the same names as schemas, so we will be
able to notice the schema names in there. Oh, and I worked out how to get
parse.y to be happy with x.y & x.y.z (schema.package.function) names. :-)

> of the other day that we don't want to abandon this syntax entirely,
> because people would like us to support "sequencename.nextval" for Oracle
> compatibility.)  Notice that we are not forced to make functions/operators
> schema-local just because datatypes are, because overloading will save the
> day.  func(schema1.type1) and func(schema2.type1) are distinct functions
> because the types are different, even if they live in the same function
> namespace.  Finally, SQL99 doesn't appear to think that operator and
> function names are schema-local; though that may just be because it hasn't
> got user-defined operators AFAICT.

Actually functions do have to be schema local. It's in the spec (don't
have exactly where with me).

> I am leaning towards keeping functions/operators database-wide, but would
> like to hear comments.  Is there any real value in, eg, allowing different
> users to define different "+" operators *on the same datatypes*?

Yes. It means that third-party developers can develop routines and then
operators based on them without having to worry about conflicts. Obviously
these two different operators would have to be in different schemas. Also,
it would mean that someone could ship replacement operators for built-in
operators. Say adding a + operator which throws exceptions on overflow.
:-)

> Not sure about index opclasses.  Given that datatype names are
> schema-local, one can think of scenarios where two users define similar
> datatypes and then try to use the same index opclass name for both.
> But it seems pretty unlikely.  I'd prefer to leave opclass names
> database-wide for simplicity.  Comments?

My vote would be to make them schema-specific. As Peter pointed out,
schemas are how you own things, so put them in a schema so we can keep
track of ownership.

Take care,

Bill


---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org

From pgsql-hackers-owner+M18001=candle.pha.pa.us=pgman@postgresql.org Tue Jan 22 20:23:11 2002
Return-path: <pgsql-hackers-owner+M18001=candle.pha.pa.us=pgman@postgresql.org>
Received: from server1.pgsql.org (www.postgresql.org [64.49.215.9])
	by candle.pha.pa.us (8.11.6/8.10.1) with SMTP id g0N1NAU04735
	for <pgman@candle.pha.pa.us>; Tue, 22 Jan 2002 20:23:10 -0500 (EST)
Received: (qmail 70414 invoked by alias); 23 Jan 2002 01:23:01 -0000
Received: from unknown (HELO postgresql.org) (64.49.215.8)
  by www.postgresql.org with SMTP; 23 Jan 2002 01:23:01 -0000
Received: from corvette.mascari.com (dhcp065-024-158-068.columbus.rr.com [65.24.158.68])
	by postgresql.org (8.11.3/8.11.4) with ESMTP id g0N1KBl69469
	for <pgsql-hackers@postgresql.org>; Tue, 22 Jan 2002 20:20:11 -0500 (EST)
	(envelope-from mascarm@mascari.com)
Received: from mascari.com (ferrari.mascari.com [192.168.2.1])
	by corvette.mascari.com (8.9.3/8.9.3) with ESMTP id UAA30752
	for <pgsql-hackers@postgresql.org>; Tue, 22 Jan 2002 20:15:29 -0500
Message-ID: <3C4E0EB1.1E3687FD@mascari.com>
Date: Tue, 22 Jan 2002 20:15:29 -0500
From: Mike Mascari <mascarm@mascari.com>
X-Mailer: Mozilla 4.7 [en] (WinNT; I)
X-Accept-Language: en
MIME-Version: 1.0
To: pgsql-hackers@postgresql.org
Subject: Re: [HACKERS] RFD: schemas and different kinds of Postgres objects
References: <Pine.LNX.4.30.0201221824360.686-100000@peter.localdomain> <29436.1011744140@sss.pgh.pa.us>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR

Tom Lane wrote:
> 
> I'm particularly troubled by the idea of trying to apply this "any"
> lookup concept to resolution of overloaded operators and functions.
> Suppose I have a reference func(type1,type2) that I'm trying to resolve,
> and I have an inexact match (one requiring coercion) in my own schema.
> Do I look to the "any" schema to see if there are better matches?
> If so, what happens if the "any" schema contains multiple possibilities
> with identical signatures (presumably created by different users)?  ISTM
> this will positively guarantee a resolution failure, since there's no
> way for the resolver to prefer one over another.  Thus, by creating
> a "func(foo,bar)" function --- quite legally --- JRandomLuser might
> break other people's formerly working queries that use other functions
> named func.  Although it's possible for this to happen now, it'll be
> a lot more surprising if JRandomLuser thinks that his functions live
> in his own private schema namespace.
>

So, in a nutshell, the price we pay for function overloading is the
inability to have schema-specific functions. Right? Possibly why Oracle
doesn't allow function overloading? As a user, I'd much rather have
schema-specific functions than only global. I'm not downplaying the
value of function overloading, but if I had the choice (which I guess I
can't/won't), I'd choose schema-specific functions over function
overloading...

Mike Mascari
mascarm@mascari.com

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

From pgsql-hackers-owner+M18003=candle.pha.pa.us=pgman@postgresql.org Tue Jan 22 20:52:52 2002
Return-path: <pgsql-hackers-owner+M18003=candle.pha.pa.us=pgman@postgresql.org>
Received: from server1.pgsql.org (www.postgresql.org [64.49.215.9])
	by candle.pha.pa.us (8.11.6/8.10.1) with SMTP id g0N1qqU05847
	for <pgman@candle.pha.pa.us>; Tue, 22 Jan 2002 20:52:52 -0500 (EST)
Received: (qmail 76088 invoked by alias); 23 Jan 2002 01:52:50 -0000
Received: from unknown (HELO postgresql.org) (64.49.215.8)
  by www.postgresql.org with SMTP; 23 Jan 2002 01:52:50 -0000
Received: from student.gvsu.edu ([148.61.7.124])
	by postgresql.org (8.11.3/8.11.4) with ESMTP id g0N1o8l75594
	for <pgsql-hackers@postgreSQL.org>; Tue, 22 Jan 2002 20:50:08 -0500 (EST)
	(envelope-from peter_e@gmx.net)
Received: from [148.61.250.147] [148.61.250.147] by student.gvsu.edu
	with Novonyx SMTP Server $Revision: 1.3 $; Tue, 22 Jan 2002 20:50:13 -0500 (EDT)
Date: Tue, 22 Jan 2002 20:52:14 -0500 (EST)
From: Peter Eisentraut <peter_e@gmx.net>
X-Sender: <peter@peter.localdomain>
To: Tom Lane <tgl@sss.pgh.pa.us>
cc: <pgsql-hackers@postgresql.org>
Subject: Re: [HACKERS] RFD: schemas and different kinds of Postgres objects
In-Reply-To: <29288.1011742268@sss.pgh.pa.us>
Message-ID: <Pine.LNX.4.30.0201222042400.686-100000@peter.localdomain>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR

Tom Lane writes:

> I really don't see what's wrong with building a namespace mechanism
> that is orthogonal to ownership and then using that to implement what
> SQL92 wants.  I think this will be cleaner, simpler, and more flexible
> than trying to equate ownership with namespace.

OK, I can accept that.  But then I want to get back at my original point,
namely that all database objects (except users and groups) should be in
schemas.  This is also cleaner, simpler, and more flexible.  There is
clearly demand for schema-local functions.  So I think that designing this
system from the premise that a schema-qualified operator call will look
strange is the wrong end to start at.

-- 
Peter Eisentraut   peter_e@gmx.net


---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

From pgsql-hackers-owner+M18006=candle.pha.pa.us=pgman@postgresql.org Wed Jan 23 00:13:21 2002
Return-path: <pgsql-hackers-owner+M18006=candle.pha.pa.us=pgman@postgresql.org>
Received: from server1.pgsql.org (www.postgresql.org [64.49.215.9])
	by candle.pha.pa.us (8.11.6/8.10.1) with SMTP id g0N5DLU26660
	for <pgman@candle.pha.pa.us>; Wed, 23 Jan 2002 00:13:21 -0500 (EST)
Received: (qmail 12536 invoked by alias); 23 Jan 2002 05:13:01 -0000
Received: from unknown (HELO postgresql.org) (64.49.215.8)
  by www.postgresql.org with SMTP; 23 Jan 2002 05:13:01 -0000
Received: from sss.pgh.pa.us ([192.204.191.242])
	by postgresql.org (8.11.3/8.11.4) with ESMTP id g0N58Cl11241
	for <pgsql-hackers@postgreSQL.org>; Wed, 23 Jan 2002 00:08:12 -0500 (EST)
	(envelope-from tgl@sss.pgh.pa.us)
Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1])
	by sss.pgh.pa.us (8.11.4/8.11.4) with ESMTP id g0N57vf00651;
	Wed, 23 Jan 2002 00:07:58 -0500 (EST)
To: Bill Studenmund <wrstuden@netbsd.org>
cc: pgsql-hackers@postgresql.org
Subject: Re: [HACKERS] RFD: schemas and different kinds of Postgres objects 
In-Reply-To: <Pine.NEB.4.33.0201221657270.5119-100000@vespasia.home-net.internetconnect.net> 
References: <Pine.NEB.4.33.0201221657270.5119-100000@vespasia.home-net.internetconnect.net>
Comments: In-reply-to Bill Studenmund <wrstuden@netbsd.org>
	message dated "Tue, 22 Jan 2002 17:10:24 -0800"
Date: Wed, 23 Jan 2002 00:07:57 -0500
Message-ID: <648.1011762477@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR

Bill Studenmund <wrstuden@netbsd.org> writes:
> Why not? What's wrong with either schema.foo.function (==>
> function(schema.foo)) or foo.schema.function (==> schema.function(foo))?

Neither is wrong in isolation, but how do you tell the difference?
More to the point, given input x.y.z, how do you tell which component
is what?

> Tables and functions can't have the same names as schemas,

News to me.  Where is that written on stone tablets?  Even if that's
considered an acceptable limitation from a purely functional point of
view, I don't like using it to disambiguate input.  The error messages
you'll get from incorrect input to an implementation that depends on
that to disambiguate cases will not be very helpful.

> Actually functions do have to be schema local. It's in the spec (don't
> have exactly where with me).

(A) I don't believe that; please cite chapter and verse; (B) even if
SQL92 thinks that's okay, we can't do it that way because of
backwards-compatibility issues.

> My vote would be to make them schema-specific. As Peter pointed out,
> schemas are how you own things,

Sorry, but this line of argument is trying to assume the very point in
dispute.

			regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org

From pgsql-hackers-owner+M18007=candle.pha.pa.us=pgman@postgresql.org Wed Jan 23 01:12:58 2002
Return-path: <pgsql-hackers-owner+M18007=candle.pha.pa.us=pgman@postgresql.org>
Received: from server1.pgsql.org (www.postgresql.org [64.49.215.9])
	by candle.pha.pa.us (8.11.6/8.10.1) with SMTP id g0N6CvU01868
	for <pgman@candle.pha.pa.us>; Wed, 23 Jan 2002 01:12:57 -0500 (EST)
Received: (qmail 21084 invoked by alias); 23 Jan 2002 06:13:00 -0000
Received: from unknown (HELO postgresql.org) (64.49.215.8)
  by www.postgresql.org with SMTP; 23 Jan 2002 06:13:00 -0000
Received: from student.gvsu.edu ([148.61.7.124])
	by postgresql.org (8.11.3/8.11.4) with ESMTP id g0N69Kl20384
	for <pgsql-hackers@postgreSQL.org>; Wed, 23 Jan 2002 01:09:20 -0500 (EST)
	(envelope-from peter_e@gmx.net)
Received: from [148.61.250.147] [148.61.250.147] by student.gvsu.edu
	with Novonyx SMTP Server $Revision: 1.3 $; Wed, 23 Jan 2002 01:09:18 -0500 (EDT)
Date: Wed, 23 Jan 2002 01:11:21 -0500 (EST)
From: Peter Eisentraut <peter_e@gmx.net>
X-Sender: <peter@peter.localdomain>
To: Tom Lane <tgl@sss.pgh.pa.us>
cc: Bill Studenmund <wrstuden@netbsd.org>, <pgsql-hackers@postgresql.org>
Subject: Re: [HACKERS] RFD: schemas and different kinds of Postgres objects
In-Reply-To: <648.1011762477@sss.pgh.pa.us>
Message-ID: <Pine.LNX.4.30.0201230058150.686-100000@peter.localdomain>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR

Tom Lane writes:

> > Actually functions do have to be schema local. It's in the spec (don't
> > have exactly where with me).
>
> (A) I don't believe that; please cite chapter and verse;

In SQL99, chapter 4 verse 23 it says

"An SQL-invoked routine is an element of an SQL-schema and is called a
schema-level routine."

> (B) even if
> SQL92 thinks that's okay, we can't do it that way because of
> backwards-compatibility issues.

I don't buy that.  If all you're looking for is preserving

foo.bar  <==>  bar(foo)

for compatibility, then you can simply say that "bar" cannot be
schema-qualified in the left form (so it needs to live in the current or
the default schema).  We currently only have one default schema, so that's
backward compatible.  I think this syntax is a mistake, so I don't feel
compelled to provide more than backwards compatibility.

-- 
Peter Eisentraut   peter_e@gmx.net


---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly

From pgsql-hackers-owner+M18008=candle.pha.pa.us=pgman@postgresql.org Wed Jan 23 04:13:30 2002
Return-path: <pgsql-hackers-owner+M18008=candle.pha.pa.us=pgman@postgresql.org>
Received: from server1.pgsql.org (www.postgresql.org [64.49.215.9])
	by candle.pha.pa.us (8.11.6/8.10.1) with SMTP id g0N9DTU17316
	for <pgman@candle.pha.pa.us>; Wed, 23 Jan 2002 04:13:29 -0500 (EST)
Received: (qmail 56495 invoked by alias); 23 Jan 2002 09:13:26 -0000
Received: from unknown (HELO postgresql.org) (64.49.215.8)
  by www.postgresql.org with SMTP; 23 Jan 2002 09:13:26 -0000
Received: from smxsat1.smxs.net (smxsat1.smxs.net [213.150.10.1])
	by postgresql.org (8.11.3/8.11.4) with ESMTP id g0N9BKl55718
	for <pgsql-hackers@postgresql.org>; Wed, 23 Jan 2002 04:11:21 -0500 (EST)
	(envelope-from ZeugswetterA@spardat.at)
Received: from m01x1.s-mxs.net [10.3.55.201]
	by smxsat1.smxs.net
	with XWall v3.18f ;
	Wed, 23 Jan 2002 10:12:42 +0100
Received: from m0102.s-mxs.net [10.3.55.2]
	by m01x1.s-mxs.net
	with XWall v3.18a ;
	Wed, 23 Jan 2002 10:11:14 +0100
Received: from m0114.s-mxs.net ([10.3.55.14]) by m0102.s-mxs.net with Microsoft SMTPSVC(5.0.2195.2966);
  Wed, 23 Jan 2002 10:11:13 +0100
X-MimeOLE: Produced By Microsoft Exchange V6.0.5762.3
content-class: urn:content-classes:message
MIME-Version: 1.0
Content-Type: text/plain;
	charset="iso-8859-1"
Subject: Re: [HACKERS] RFD: schemas and different kinds of Postgres objects 
Date: Wed, 23 Jan 2002 10:11:13 +0100
Message-ID: <46C15C39FEB2C44BA555E356FBCD6FA41EB4C2@m0114.s-mxs.net>
Thread-Topic: [HACKERS] RFD: schemas and different kinds of Postgres objects 
Thread-Index: AcGjixqphLJq/YpTSK6U7FZuNf4j3AAWxJvQ
From: "Zeugswetter Andreas SB SD" <ZeugswetterA@spardat.at>
To: "Tom Lane" <tgl@sss.pgh.pa.us>, "Fernando Nasser" <fnasser@redhat.com>
cc: "Peter Eisentraut" <peter_e@gmx.net>, <pgsql-hackers@postgresql.org>
X-OriginalArrivalTime: 23 Jan 2002 09:11:13.0579 (UTC) FILETIME=[E7DEA7B0:01C1A3ED]
Content-Transfer-Encoding: 8bit
X-MIME-Autoconverted: from quoted-printable to 8bit by postgresql.org id g0N9CTm55809
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR


> > Switches set to historical:
> 
> >   schema search path = (user's own schema, "any" schema, postgres)
> 
> >   [ default creation schema = user's own schema ]
> 
> > The searching in "any" schema (i.e., any owner) will let will find 
> > things that where defined the way they are today, i.e., possibly
> > by several different users.
> 
> No, it won't, because nothing will ever get put into that schema.
> (At least not by existing pg_dump scripts, which are the things that
> really need to see the historical behavior.)  The
> default-creation-schema variable has got to point at any/public/
> whatever-we-call it, or you do not have the historical behavior.

When configured for historical behavior would need to:
1. have search path: temp, any, system
2. guard against duplicate table names across all schemas (except temp schema)

Or are you thinking about a per session behavior ?
I would rather envision a per database behavior.

Maybe the easy way out would be a "default creation schema" property for 
each user, that would default to the username. If you want everything in one 
schema simply alter the users.

Andreas

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/users-lounge/docs/faq.html

From pgsql-hackers-owner+M18010=candle.pha.pa.us=pgman@postgresql.org Wed Jan 23 05:03:10 2002
Return-path: <pgsql-hackers-owner+M18010=candle.pha.pa.us=pgman@postgresql.org>
Received: from server1.pgsql.org (www.postgresql.org [64.49.215.9])
	by candle.pha.pa.us (8.11.6/8.10.1) with SMTP id g0NA39U22271
	for <pgman@candle.pha.pa.us>; Wed, 23 Jan 2002 05:03:09 -0500 (EST)
Received: (qmail 70600 invoked by alias); 23 Jan 2002 10:03:04 -0000
Received: from unknown (HELO postgresql.org) (64.49.215.8)
  by www.postgresql.org with SMTP; 23 Jan 2002 10:03:04 -0000
Received: from smxsat1.smxs.net (smxsat1.smxs.net [213.150.10.1])
	by postgresql.org (8.11.3/8.11.4) with ESMTP id g0N9xNl69597
	for <pgsql-hackers@postgresql.org>; Wed, 23 Jan 2002 04:59:24 -0500 (EST)
	(envelope-from ZeugswetterA@spardat.at)
Received: from m01x1.s-mxs.net [10.3.55.201]
	by smxsat1.smxs.net
	with XWall v3.18f ;
	Wed, 23 Jan 2002 11:00:47 +0100
Received: from m0103.s-mxs.net [10.3.55.3]
	by m01x1.s-mxs.net
	with XWall v3.18a ;
	Wed, 23 Jan 2002 10:59:19 +0100
Received: from m0114.s-mxs.net ([10.3.55.14]) by m0103.s-mxs.net with Microsoft SMTPSVC(5.0.2195.2966);
  Wed, 23 Jan 2002 10:59:18 +0100
X-MimeOLE: Produced By Microsoft Exchange V6.0.5762.3
content-class: urn:content-classes:message
MIME-Version: 1.0
Content-Type: text/plain;
	charset="iso-8859-1"
Subject: Re: [HACKERS] RFD: schemas and different kinds of Postgres objects
Date: Wed, 23 Jan 2002 10:59:18 +0100
Message-ID: <46C15C39FEB2C44BA555E356FBCD6FA42128DA@m0114.s-mxs.net>
Thread-Topic: [HACKERS] RFD: schemas and different kinds of Postgres objects
Thread-Index: AcGj1QtRzBpAfJVfQjCydtlooB5fgwAHyaDQ
From: "Zeugswetter Andreas SB SD" <ZeugswetterA@spardat.at>
To: "Peter Eisentraut" <peter_e@gmx.net>, "Tom Lane" <tgl@sss.pgh.pa.us>
cc: "Bill Studenmund" <wrstuden@netbsd.org>, <pgsql-hackers@postgresql.org>
X-OriginalArrivalTime: 23 Jan 2002 09:59:18.0969 (UTC) FILETIME=[9FB23A90:01C1A3F4]
Content-Transfer-Encoding: 8bit
X-MIME-Autoconverted: from quoted-printable to 8bit by postgresql.org id g0NA2d170062
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR


> I don't buy that.  If all you're looking for is preserving
> 
> foo.bar  <==>  bar(foo)
> 
> for compatibility, then you can simply say that "bar" cannot be
> schema-qualified in the left form (so it needs to live in the current or
> the default schema).  We currently only have one default schema, so that's
> backward compatible.  I think this syntax is a mistake, so I don't feel
> compelled to provide more than backwards compatibility.

This syntax is actually my favorite :-) I use it heavily for calculated
columns. I don't feel it is a mistake.

Andreas

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

From pgsql-hackers-owner+M18012=candle.pha.pa.us=pgman@postgresql.org Wed Jan 23 06:13:40 2002
Return-path: <pgsql-hackers-owner+M18012=candle.pha.pa.us=pgman@postgresql.org>
Received: from server1.pgsql.org (www.postgresql.org [64.49.215.9])
	by candle.pha.pa.us (8.11.6/8.10.1) with SMTP id g0NBDdU21327
	for <pgman@candle.pha.pa.us>; Wed, 23 Jan 2002 06:13:39 -0500 (EST)
Received: (qmail 81930 invoked by alias); 23 Jan 2002 11:13:12 -0000
Received: from unknown (HELO postgresql.org) (64.49.215.8)
  by www.postgresql.org with SMTP; 23 Jan 2002 11:13:12 -0000
Received: from mail_exchange.westcountrypublications.co.uk ([195.171.163.135])
	by postgresql.org (8.11.3/8.11.4) with ESMTP id g0NB70l80597
	for <pgsql-hackers@postgresql.org>; Wed, 23 Jan 2002 06:07:02 -0500 (EST)
	(envelope-from SHenshall@westcountrypublications.co.uk)
Received: by MAIL_EXCHANGE with Internet Mail Service (5.5.2650.21)
	id <DKQFH0AY>; Wed, 23 Jan 2002 11:03:18 -0000
Message-ID: <E2870D8CE1CCD311BAF50008C71EDE8E01F747A1@MAIL_EXCHANGE>
From: "Henshall, Stuart - WCP" <SHenshall@westcountrypublications.co.uk>
To: "'Tom Lane'" <tgl@sss.pgh.pa.us>, Peter Eisentraut <peter_e@gmx.net>
cc: Fernando Nasser <fnasser@redhat.com>, pgsql-hackers@postgresql.org
Subject: Re: [HACKERS] RFD: schemas and different kinds of Postgres objects 
Date: Wed, 23 Jan 2002 11:03:16 -0000
MIME-Version: 1.0
X-Mailer: Internet Mail Service (5.5.2650.21)
Content-Type: text/plain;
	charset="iso-8859-1"
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR



> -----Original Message-----
> From: Tom Lane [mailto:tgl@sss.pgh.pa.us]
> Sent: 23 January 2002 00:02
> To: Peter Eisentraut
> Cc: Fernando Nasser; pgsql-hackers@postgresql.org
> Subject: Re: RFD: schemas and different kinds of Postgres objects 
> 
> 
> Peter Eisentraut <peter_e@gmx.net> writes:
> > Tom Lane writes:
> >> No, it doesn't work the same as today, because in that 
> implementation
> >> both A and B can create the same tablename without 
> complaint.  It then
> >> becomes very unclear which instance other people will get 
> (unless your
> >> "any" placeholder somehow implies a search order).
> 
> > The "search any schema" switch is only intended for use with legacy
> > databases, where duplicate names don't occur anyway.
> 
> That's a mighty narrow view of the world.  Do you think that 
> people had
> better convert to SQL schemas before they ever again create a table?
> The fact is that ordinary non-schema-aware usage will 
> certainly lead to
> the above scenario.
> 
> > that the switch probably doesn't make a whole lot of sense. 
>  However, to
> > get reproduceable behaviour anyway we can just define a 
> search order, such
> > as by schema name.
> 
> Or say that you get an "ambiguous reference" error if there 
> is more than
> one possible candidate in the "any" namespace.  (Although 
> that opens the
> door for innocent creation of a table foo by one user to break other
> people's formerly-working queries that reference some other foo.)
> Bottom line for me is that this is an untried concept.  I think the
> concept of an "any" searchlist entry is risky enough that I don't much
> want to hang the entire usability of the implementation on the
> assumption that we won't find any fatal problems with "any".
> 
> 
> However, the argument over whether SQL92's concept of ownership should
> be taken as gospel is not really the argument I wanted to have in this
> thread.  Is it possible to go back to the original point concerning
> whether there should be different namespace boundaries for different
> types of objects?  You aren't going to avoid those issues by 
> saying that
> namespace == ownership is good enough.
> 
> I'm particularly troubled by the idea of trying to apply this "any"
> lookup concept to resolution of overloaded operators and functions.
> Suppose I have a reference func(type1,type2) that I'm trying 
> to resolve,
> and I have an inexact match (one requiring coercion) in my own schema.
> Do I look to the "any" schema to see if there are better matches?
> If so, what happens if the "any" schema contains multiple 
> possibilities
> with identical signatures (presumably created by different 
> users)?  ISTM
> this will positively guarantee a resolution failure, since there's no
> way for the resolver to prefer one over another.  Thus, by creating
> a "func(foo,bar)" function --- quite legally --- JRandomLuser might
> break other people's formerly working queries that use other functions
> named func.  Although it's possible for this to happen now, it'll be
> a lot more surprising if JRandomLuser thinks that his functions live
> in his own private schema namespace.
> 
> I'm thinking that the overloading concept is not going to play well
> at all with multiple namespaces for functions or operators, and that
> we'd be best off to say that there is only one namespace (per 
> database)
> for these things.
> 
> 			regards, tom lane
> 
Could you just have a general rule of search in order of age (by OID)? This
should prevent changes to existing operation when new definitions come along
(unless new definition is in new own schema or default).
Cheers,
- Stuart

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

From pgsql-hackers-owner+M18024=candle.pha.pa.us=pgman@postgresql.org Wed Jan 23 10:13:55 2002
Return-path: <pgsql-hackers-owner+M18024=candle.pha.pa.us=pgman@postgresql.org>
Received: from server1.pgsql.org (www.postgresql.org [64.49.215.9])
	by candle.pha.pa.us (8.11.6/8.10.1) with SMTP id g0NFDsU06028
	for <pgman@candle.pha.pa.us>; Wed, 23 Jan 2002 10:13:54 -0500 (EST)
Received: (qmail 39657 invoked by alias); 23 Jan 2002 15:13:28 -0000
Received: from unknown (HELO postgresql.org) (64.49.215.8)
  by www.postgresql.org with SMTP; 23 Jan 2002 15:13:28 -0000
Received: from sss.pgh.pa.us ([192.204.191.242])
	by postgresql.org (8.11.3/8.11.4) with ESMTP id g0NF1dl35283
	for <pgsql-hackers@postgresql.org>; Wed, 23 Jan 2002 10:01:40 -0500 (EST)
	(envelope-from tgl@sss.pgh.pa.us)
Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1])
	by sss.pgh.pa.us (8.11.4/8.11.4) with ESMTP id g0NExef02480;
	Wed, 23 Jan 2002 09:59:40 -0500 (EST)
To: "Henshall, Stuart - WCP" <SHenshall@westcountrypublications.co.uk>
cc: Peter Eisentraut <peter_e@gmx.net>, Fernando Nasser <fnasser@redhat.com>,
   pgsql-hackers@postgresql.org
Subject: Re: [HACKERS] RFD: schemas and different kinds of Postgres objects 
In-Reply-To: <E2870D8CE1CCD311BAF50008C71EDE8E01F747A1@MAIL_EXCHANGE> 
References: <E2870D8CE1CCD311BAF50008C71EDE8E01F747A1@MAIL_EXCHANGE>
Comments: In-reply-to "Henshall, Stuart - WCP" <SHenshall@westcountrypublications.co.uk>
	message dated "Wed, 23 Jan 2002 11:03:16 +0000"
Date: Wed, 23 Jan 2002 09:59:39 -0500
Message-ID: <2477.1011797979@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR

"Henshall, Stuart - WCP" <SHenshall@westcountrypublications.co.uk> writes:
> Could you just have a general rule of search in order of age (by OID)?

No, unless you plan to abandon the whole notion of resolving ambiguous
operator/function calls.  (Which'd cut down our TODO list a good bit ;-)
but I don't think users would be happy...)  OID/age ordering generally
has little to do with reasonable resolution behavior.

			regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly

From pgsql-hackers-owner+M18026=candle.pha.pa.us=pgman@postgresql.org Wed Jan 23 10:33:35 2002
Return-path: <pgsql-hackers-owner+M18026=candle.pha.pa.us=pgman@postgresql.org>
Received: from server1.pgsql.org (www.postgresql.org [64.49.215.9])
	by candle.pha.pa.us (8.11.6/8.10.1) with SMTP id g0NFXYU07736
	for <pgman@candle.pha.pa.us>; Wed, 23 Jan 2002 10:33:34 -0500 (EST)
Received: (qmail 44416 invoked by alias); 23 Jan 2002 15:33:29 -0000
Received: from unknown (HELO postgresql.org) (64.49.215.8)
  by www.postgresql.org with SMTP; 23 Jan 2002 15:33:29 -0000
Received: from sss.pgh.pa.us ([192.204.191.242])
	by postgresql.org (8.11.3/8.11.4) with ESMTP id g0NFVfl43926
	for <pgsql-hackers@postgreSQL.org>; Wed, 23 Jan 2002 10:31:41 -0500 (EST)
	(envelope-from tgl@sss.pgh.pa.us)
Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1])
	by sss.pgh.pa.us (8.11.4/8.11.4) with ESMTP id g0NFVQf02603;
	Wed, 23 Jan 2002 10:31:26 -0500 (EST)
To: Peter Eisentraut <peter_e@gmx.net>
cc: pgsql-hackers@postgresql.org, Fernando Nasser <fnasser@redhat.com>
Subject: Re: [HACKERS] RFD: schemas and different kinds of Postgres objects 
In-Reply-To: <Pine.LNX.4.30.0201222042400.686-100000@peter.localdomain> 
References: <Pine.LNX.4.30.0201222042400.686-100000@peter.localdomain>
Comments: In-reply-to Peter Eisentraut <peter_e@gmx.net>
	message dated "Tue, 22 Jan 2002 20:52:14 -0500"
Date: Wed, 23 Jan 2002 10:31:25 -0500
Message-ID: <2600.1011799885@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR

Peter Eisentraut <peter_e@gmx.net> writes:
> OK, I can accept that.  But then I want to get back at my original point,
> namely that all database objects (except users and groups) should be in
> schemas.  This is also cleaner, simpler, and more flexible.  There is
> clearly demand for schema-local functions.  So I think that designing this
> system from the premise that a schema-qualified operator call will look
> strange is the wrong end to start at.

Okay, a fair point --- or you could have used my own argument against
me: there's nothing wrong with designing a general mechanism and then
choosing not to expose all of the functionality.  So let's assume that
functions and operators live in namespaces, and that we have some kind
of search path across multiple namespaces for use when an unqualified
name is given.

Now, how is that going to play with resolution of ambiguous calls?

The most reasonable semantics I can think of are to collect all the
potential matches (matching op/func name) across all the searchable
namespaces, discarding only those that have exactly the same signature
as one in a prior namespace.  Thus, eg, plus(int4,int4) in an earlier
namespace would hide plus(int4,int4) in a later namespace in the search
path, but it wouldn't hide plus(int8,int8).  After we've collected all
the visible alternatives, do resolution based on argument types the same
way as we do now.

The only alternative semantics that seem defensible at all are to stop
at the first namespace that contains any matching-by-name op or func,
and do resolution using only the candidates available in that namespace.
That strikes me as not a good idea; for example, a user who defines a
"+" operator in his own schema for his own datatype would be quite
unhappy to find it masking all the "+" operators in the system schema.

I believe that this behavior would be fairly reasonable if our
backward-compatibility feature consists of a "public" namespace
that all users can write in.  OTOH I think it would not play at all
well if we use Fernando's idea of an "any" wildcard in the search
path.  (1) Imagine the case where we have some users who are using
the backward-compatible behavior while others have set up private
namespaces.  If Joe SmartGuy creates a "+" operator in his private
namespace, it'll be visible to people using the "any" wildcard and
possibly cause resolution-ambiguity failures for them, even though
Joe deliberately did what he should do to avoid that.  (2) "any"
creates the problem of resolving multiple functions with identical
signatures in different namespaces, with no reasonable rule for
making the choice.

So I'm still of the opinion that an "any" wildcard is too risky a
solution for our backwards-compatibility problem.

			regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

From pgsql-hackers-owner+M18030=candle.pha.pa.us=pgman@postgresql.org Wed Jan 23 11:35:41 2002
Return-path: <pgsql-hackers-owner+M18030=candle.pha.pa.us=pgman@postgresql.org>
Received: from server1.pgsql.org (www.postgresql.org [64.49.215.9])
	by candle.pha.pa.us (8.11.6/8.10.1) with SMTP id g0NGZeU13512
	for <pgman@candle.pha.pa.us>; Wed, 23 Jan 2002 11:35:40 -0500 (EST)
Received: (qmail 91981 invoked by alias); 23 Jan 2002 16:34:06 -0000
Received: from unknown (HELO postgresql.org) (64.49.215.8)
  by www.postgresql.org with SMTP; 23 Jan 2002 16:34:06 -0000
Received: from sss.pgh.pa.us ([192.204.191.242])
	by postgresql.org (8.11.3/8.11.4) with ESMTP id g0NFjNl67457
	for <pgsql-hackers@postgresql.org>; Wed, 23 Jan 2002 10:45:58 -0500 (EST)
	(envelope-from tgl@sss.pgh.pa.us)
Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1])
	by sss.pgh.pa.us (8.11.4/8.11.4) with ESMTP id g0NFiYf02680;
	Wed, 23 Jan 2002 10:44:34 -0500 (EST)
To: "Zeugswetter Andreas SB SD" <ZeugswetterA@spardat.at>
cc: "Fernando Nasser" <fnasser@redhat.com>,
   "Peter Eisentraut" <peter_e@gmx.net>, pgsql-hackers@postgresql.org
Subject: Re: [HACKERS] RFD: schemas and different kinds of Postgres objects 
In-Reply-To: <46C15C39FEB2C44BA555E356FBCD6FA41EB4C2@m0114.s-mxs.net> 
References: <46C15C39FEB2C44BA555E356FBCD6FA41EB4C2@m0114.s-mxs.net>
Comments: In-reply-to "Zeugswetter Andreas SB SD" <ZeugswetterA@spardat.at>
	message dated "Wed, 23 Jan 2002 10:11:13 +0100"
Date: Wed, 23 Jan 2002 10:44:34 -0500
Message-ID: <2677.1011800674@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: ORr

"Zeugswetter Andreas SB SD" <ZeugswetterA@spardat.at> writes:
> When configured for historical behavior would need to:
> 1. have search path: temp, any, system
> 2. guard against duplicate table names across all schemas (except temp schema)

This would be a *whole* lot simpler if we forgot the notion of "any"
and made the search order look like

	(temp, private, public, system)

where the public namespace is world-writable but the private per-user
ones are (typically at least) not.

It occurs to me that we can get both backward-compatible and SQL92
semantics with this same search path; the only thing that needs to
be different in the two cases is whether the default place to create
objects is your private schema or the public one.  If you don't ever
use your private schema then it doesn't matter if it's on the search
path or not.  I would still prefer that the search path be a settable
option, since a paranoid person might well wish to not have public in
his path at all ... but the default could be as-above.

> Or are you thinking about a per session behavior ?
> I would rather envision a per database behavior.
> Maybe the easy way out would be a "default creation schema" property for 
> each user, that would default to the username. If you want everything in one 
> schema simply alter the users.

I hadn't really gotten to the point of thinking about exactly what and
where the control knobs should be.  I suspect you are right that we will
want the default behavior to be selectable on a per-user or per-database
basis, which seems to eliminate the option of using GUC (at least in its
current form).  We could easily add a field to pg_shadow or pg_database
respectively to determine the default behavior.  It'd be nice though if
the behavior could be changed after connection by a SET statement, which
would be lots easier if the setting were GUC-controlled.  Peter, you see
any way to resolve that?

			regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly

From pgsql-hackers-owner+M18034=candle.pha.pa.us=pgman@postgresql.org Wed Jan 23 11:50:22 2002
Return-path: <pgsql-hackers-owner+M18034=candle.pha.pa.us=pgman@postgresql.org>
Received: from server1.pgsql.org (www.postgresql.org [64.49.215.9])
	by candle.pha.pa.us (8.11.6/8.10.1) with SMTP id g0NGoLU15032
	for <pgman@candle.pha.pa.us>; Wed, 23 Jan 2002 11:50:21 -0500 (EST)
Received: (qmail 1716 invoked by alias); 23 Jan 2002 16:50:05 -0000
Received: from unknown (HELO postgresql.org) (64.49.215.8)
  by www.postgresql.org with SMTP; 23 Jan 2002 16:50:05 -0000
Received: from megazone.bigpanda.com (megazone.bigpanda.com [63.150.15.178])
	by postgresql.org (8.11.3/8.11.4) with ESMTP id g0NGZgl93351
	for <pgsql-hackers@postgreSQL.org>; Wed, 23 Jan 2002 11:35:42 -0500 (EST)
	(envelope-from sszabo@megazone23.bigpanda.com)
Received: by megazone.bigpanda.com (Postfix, from userid 1001)
	id ABA27D5E5; Wed, 23 Jan 2002 08:35:47 -0800 (PST)
Received: from localhost (localhost [127.0.0.1])
	by megazone.bigpanda.com (Postfix) with ESMTP
	id 9D3E55BF5; Wed, 23 Jan 2002 08:35:47 -0800 (PST)
Date: Wed, 23 Jan 2002 08:35:47 -0800 (PST)
From: Stephan Szabo <sszabo@megazone23.bigpanda.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
cc: Peter Eisentraut <peter_e@gmx.net>, <pgsql-hackers@postgresql.org>,
   Fernando Nasser <fnasser@redhat.com>
Subject: Re: [HACKERS] RFD: schemas and different kinds of Postgres objects
In-Reply-To: <2600.1011799885@sss.pgh.pa.us>
Message-ID: <20020123083152.W18169-100000@megazone23.bigpanda.com>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR


On Wed, 23 Jan 2002, Tom Lane wrote:

> The only alternative semantics that seem defensible at all are to stop
> at the first namespace that contains any matching-by-name op or func,
> and do resolution using only the candidates available in that namespace.
> That strikes me as not a good idea; for example, a user who defines a
> "+" operator in his own schema for his own datatype would be quite
> unhappy to find it masking all the "+" operators in the system schema.
>
> I believe that this behavior would be fairly reasonable if our
> backward-compatibility feature consists of a "public" namespace
> that all users can write in.  OTOH I think it would not play at all
> well if we use Fernando's idea of an "any" wildcard in the search
> path.  (1) Imagine the case where we have some users who are using
> the backward-compatible behavior while others have set up private
> namespaces.  If Joe SmartGuy creates a "+" operator in his private
> namespace, it'll be visible to people using the "any" wildcard and
> possibly cause resolution-ambiguity failures for them, even though
> Joe deliberately did what he should do to avoid that.  (2) "any"
> creates the problem of resolving multiple functions with identical
> signatures in different namespaces, with no reasonable rule for
> making the choice.

Wouldn't it make sense to prefer operators/functions earlier in the search
path for resolving ambiguity.  So if you had plus(int4, int4) in my
schema and plus(int8, int8) in system, and they'd otherwise cause an
ambiguity failure for the query, use the plus(int4, int4) on mine. It
seems not too far from having the search path shadow later exact matches.



---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

From pgsql-hackers-owner+M18041=candle.pha.pa.us=pgman@postgresql.org Wed Jan 23 12:18:50 2002
Return-path: <pgsql-hackers-owner+M18041=candle.pha.pa.us=pgman@postgresql.org>
Received: from server1.pgsql.org (www.postgresql.org [64.49.215.9])
	by candle.pha.pa.us (8.11.6/8.10.1) with SMTP id g0NHInU20563
	for <pgman@candle.pha.pa.us>; Wed, 23 Jan 2002 12:18:49 -0500 (EST)
Received: (qmail 17817 invoked by alias); 23 Jan 2002 17:14:34 -0000
Received: from unknown (HELO postgresql.org) (64.49.215.8)
  by www.postgresql.org with SMTP; 23 Jan 2002 17:14:34 -0000
Received: from sss.pgh.pa.us ([192.204.191.242])
	by postgresql.org (8.11.3/8.11.4) with ESMTP id g0NHC6l15615
	for <pgsql-hackers@postgreSQL.org>; Wed, 23 Jan 2002 12:12:06 -0500 (EST)
	(envelope-from tgl@sss.pgh.pa.us)
Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1])
	by sss.pgh.pa.us (8.11.4/8.11.4) with ESMTP id g0NGkwf03162;
	Wed, 23 Jan 2002 11:46:58 -0500 (EST)
To: Stephan Szabo <sszabo@megazone23.bigpanda.com>
cc: Peter Eisentraut <peter_e@gmx.net>, pgsql-hackers@postgresql.org,
   Fernando Nasser <fnasser@redhat.com>
Subject: Re: [HACKERS] RFD: schemas and different kinds of Postgres objects 
In-Reply-To: <20020123083152.W18169-100000@megazone23.bigpanda.com> 
References: <20020123083152.W18169-100000@megazone23.bigpanda.com>
Comments: In-reply-to Stephan Szabo <sszabo@megazone23.bigpanda.com>
	message dated "Wed, 23 Jan 2002 08:35:47 -0800"
Date: Wed, 23 Jan 2002 11:46:58 -0500
Message-ID: <3159.1011804418@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR

Stephan Szabo <sszabo@megazone23.bigpanda.com> writes:
> Wouldn't it make sense to prefer operators/functions earlier in the search
> path for resolving ambiguity.  So if you had plus(int4, int4) in my
> schema and plus(int8, int8) in system, and they'd otherwise cause an
> ambiguity failure for the query, use the plus(int4, int4) on mine. It
> seems not too far from having the search path shadow later exact matches.

Given the complexity of the resolution rules (cf.
http://developer.postgresql.org/docs/postgres/typeconv.html),
it's not clear that we can determine exactly which "later" entry ought
to be blamed for causing a resolution failure.  I'd be interested to
hear Lockhart's opinion on this --- but my gut feeling is we don't
want to go there.  The resolution rules are already complicated enough,
and I think layering an additional mechanism like that onto them might
make the behavior totally unpredictable.

Another problem is that this would probably cause earlier namespace
entries to be over-preferred.  For example, suppose that the system
namespace has plus(int4,int4) and plus(int8,int8) and you choose to
define plus(int4,int8) locally.  I believe you'd suddenly find yours
being used for *any* cross-datatype addition, including cases that
had nothing obvious to do with either int4 or int8 ...

			regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org

From pgsql-hackers-owner+M18040=candle.pha.pa.us=pgman@postgresql.org Wed Jan 23 12:18:51 2002
Return-path: <pgsql-hackers-owner+M18040=candle.pha.pa.us=pgman@postgresql.org>
Received: from server1.pgsql.org (www.postgresql.org [64.49.215.9])
	by candle.pha.pa.us (8.11.6/8.10.1) with SMTP id g0NHIoU20594
	for <pgman@candle.pha.pa.us>; Wed, 23 Jan 2002 12:18:51 -0500 (EST)
Received: (qmail 17832 invoked by alias); 23 Jan 2002 17:14:34 -0000
Received: from unknown (HELO postgresql.org) (64.49.215.8)
  by www.postgresql.org with SMTP; 23 Jan 2002 17:14:34 -0000
Received: from mx1.relaypoint.net (ns2.generalbroadband.com [64.32.62.5])
	by postgresql.org (8.11.3/8.11.4) with ESMTP id g0NGu6l05540
	for <pgsql-hackers@postgresql.org>; Wed, 23 Jan 2002 11:56:06 -0500 (EST)
	(envelope-from jconway@cox.net)
Received: from [206.19.64.3] (account jconway@wwc.com HELO cox.net)
  by mx1.relaypoint.net (CommuniGate Pro SMTP 3.4.8)
  with ESMTP id 2510369; Wed, 23 Jan 2002 08:56:10 -0800
Message-ID: <3C4EEB2F.8040803@cox.net>
Date: Wed, 23 Jan 2002 08:56:15 -0800
From: "Joe Conway (wwc)" <jconway@cox.net>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:0.9.6+) Gecko/20011219
X-Accept-Language: en-us
MIME-Version: 1.0
To: Tom Lane <tgl@sss.pgh.pa.us>
cc: Zeugswetter Andreas SB SD <ZeugswetterA@spardat.at>,
   Fernando Nasser <fnasser@redhat.com>, Peter Eisentraut <peter_e@gmx.net>,
   pgsql-hackers@postgresql.org
Subject: Re: [HACKERS] RFD: schemas and different kinds of Postgres objects
References: <46C15C39FEB2C44BA555E356FBCD6FA41EB4C2@m0114.s-mxs.net> <2677.1011800674@sss.pgh.pa.us>
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR

Tom Lane wrote:

> 
> This would be a *whole* lot simpler if we forgot the notion of "any"
> and made the search order look like
> 
> 	(temp, private, public, system)
> 
> where the public namespace is world-writable but the private per-user
> ones are (typically at least) not.
> 
> It occurs to me that we can get both backward-compatible and SQL92
> semantics with this same search path; the only thing that needs to
> be different in the two cases is whether the default place to create
> objects is your private schema or the public one.  If you don't ever
> use your private schema then it doesn't matter if it's on the search
> path or not.  I would still prefer that the search path be a settable
> option, since a paranoid person might well wish to not have public in
> his path at all ... but the default could be as-above.
> 


I think it would be desirable to be able to restrict users from 
"publishing" objects into the public schema. As an admin, I'd like some 
control over the objects in this namespace. Hand-in-hand with this would 
be the ability for the superuser to move (or "promote") an object from a 
private schema to the public one. This would allow a user to develop 
their own objects without interfering with others, but then make it 
public with the superuser's assistance.

The search path you suggest above would then lead to the behavior that 
unqualified references to objects will see my own objects before the 
public ones, and other people's private objects must be explicitly 
qualified.

Joe




---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

From pgsql-hackers-owner+M18042=candle.pha.pa.us=pgman@postgresql.org Wed Jan 23 12:18:45 2002
Return-path: <pgsql-hackers-owner+M18042=candle.pha.pa.us=pgman@postgresql.org>
Received: from server1.pgsql.org (www.postgresql.org [64.49.215.9])
	by candle.pha.pa.us (8.11.6/8.10.1) with SMTP id g0NHIiU20532
	for <pgman@candle.pha.pa.us>; Wed, 23 Jan 2002 12:18:45 -0500 (EST)
Received: (qmail 17765 invoked by alias); 23 Jan 2002 17:14:31 -0000
Received: from unknown (HELO postgresql.org) (64.49.215.8)
  by www.postgresql.org with SMTP; 23 Jan 2002 17:14:31 -0000
Received: from sss.pgh.pa.us ([192.204.191.242])
	by postgresql.org (8.11.3/8.11.4) with ESMTP id g0NH1Tl11512
	for <pgsql-hackers@postgresql.org>; Wed, 23 Jan 2002 12:01:29 -0500 (EST)
	(envelope-from tgl@sss.pgh.pa.us)
Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1])
	by sss.pgh.pa.us (8.11.4/8.11.4) with ESMTP id g0NH0vf03329;
	Wed, 23 Jan 2002 12:00:57 -0500 (EST)
To: "Joe Conway (wwc)" <jconway@cox.net>
cc: Zeugswetter Andreas SB SD <ZeugswetterA@spardat.at>,
   Fernando Nasser <fnasser@redhat.com>, Peter Eisentraut <peter_e@gmx.net>,
   pgsql-hackers@postgresql.org
Subject: Re: [HACKERS] RFD: schemas and different kinds of Postgres objects 
In-Reply-To: <3C4EEB2F.8040803@cox.net> 
References: <46C15C39FEB2C44BA555E356FBCD6FA41EB4C2@m0114.s-mxs.net> <2677.1011800674@sss.pgh.pa.us> <3C4EEB2F.8040803@cox.net>
Comments: In-reply-to "Joe Conway (wwc)" <jconway@cox.net>
	message dated "Wed, 23 Jan 2002 08:56:15 -0800"
Date: Wed, 23 Jan 2002 12:00:56 -0500
Message-ID: <3326.1011805256@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR

"Joe Conway (wwc)" <jconway@cox.net> writes:
> I think it would be desirable to be able to restrict users from 
> "publishing" objects into the public schema.

Sure.  I'm envisioning that namespaces will have ACLs --- that's what
will keep private namespaces private.  So, while public would by default
be world-writable (at least in the backwards-compatibility case),
there'd be nothing stopping you from marking it as read-only to some
users.

Come to think of it, that's still another reason not to have an "any"
wildcard: there's no way to put any restrictions on what appears in
such a namespace.

			regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

From pgsql-hackers-owner+M18043=candle.pha.pa.us=pgman@postgresql.org Wed Jan 23 12:22:29 2002
Return-path: <pgsql-hackers-owner+M18043=candle.pha.pa.us=pgman@postgresql.org>
Received: from server1.pgsql.org (www.postgresql.org [64.49.215.9])
	by candle.pha.pa.us (8.11.6/8.10.1) with SMTP id g0NHMSU21118
	for <pgman@candle.pha.pa.us>; Wed, 23 Jan 2002 12:22:28 -0500 (EST)
Received: (qmail 17648 invoked by alias); 23 Jan 2002 17:14:27 -0000
Received: from unknown (HELO postgresql.org) (64.49.215.8)
  by www.postgresql.org with SMTP; 23 Jan 2002 17:14:27 -0000
Received: from megazone.bigpanda.com (megazone.bigpanda.com [63.150.15.178])
	by postgresql.org (8.11.3/8.11.4) with ESMTP id g0NH9Ul15308
	for <pgsql-hackers@postgreSQL.org>; Wed, 23 Jan 2002 12:09:30 -0500 (EST)
	(envelope-from sszabo@megazone23.bigpanda.com)
Received: by megazone.bigpanda.com (Postfix, from userid 1001)
	id E7DB9D5E5; Wed, 23 Jan 2002 09:09:35 -0800 (PST)
Received: from localhost (localhost [127.0.0.1])
	by megazone.bigpanda.com (Postfix) with ESMTP
	id DD82F5BF5; Wed, 23 Jan 2002 09:09:35 -0800 (PST)
Date: Wed, 23 Jan 2002 09:09:35 -0800 (PST)
From: Stephan Szabo <sszabo@megazone23.bigpanda.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
cc: Peter Eisentraut <peter_e@gmx.net>, <pgsql-hackers@postgresql.org>,
   Fernando Nasser <fnasser@redhat.com>
Subject: Re: [HACKERS] RFD: schemas and different kinds of Postgres objects
In-Reply-To: <3159.1011804418@sss.pgh.pa.us>
Message-ID: <20020123085959.U18688-100000@megazone23.bigpanda.com>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR


On Wed, 23 Jan 2002, Tom Lane wrote:

> Stephan Szabo <sszabo@megazone23.bigpanda.com> writes:
> > Wouldn't it make sense to prefer operators/functions earlier in the search
> > path for resolving ambiguity.  So if you had plus(int4, int4) in my
> > schema and plus(int8, int8) in system, and they'd otherwise cause an
> > ambiguity failure for the query, use the plus(int4, int4) on mine. It
> > seems not too far from having the search path shadow later exact matches.
>
> Given the complexity of the resolution rules (cf.
> http://developer.postgresql.org/docs/postgres/typeconv.html),
> it's not clear that we can determine exactly which "later" entry ought
> to be blamed for causing a resolution failure.  I'd be interested to
> hear Lockhart's opinion on this --- but my gut feeling is we don't
> want to go there.  The resolution rules are already complicated enough,
> and I think layering an additional mechanism like that onto them might
> make the behavior totally unpredictable.

> Another problem is that this would probably cause earlier namespace
> entries to be over-preferred.  For example, suppose that the system
> namespace has plus(int4,int4) and plus(int8,int8) and you choose to
> define plus(int4,int8) locally.  I believe you'd suddenly find yours
> being used for *any* cross-datatype addition, including cases that
> had nothing obvious to do with either int4 or int8 ...

Well, what I'd been thinking of would have been similar to anywhere it
says "If only one candidate matches", becoming "If the earliest search
path entry with at least one candidate matching has only one
matching candidate ..." But that would cause the plus(int4, int8) to get
used in any cross-datatype case that could coerce and didn't have a
stronger match (ie, one of the arguments exactly matching a plus argument
per b or c) so that's probably not good enough.




---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly

From pgsql-hackers-owner+M18058=candle.pha.pa.us=pgman@postgresql.org Wed Jan 23 14:45:20 2002
Return-path: <pgsql-hackers-owner+M18058=candle.pha.pa.us=pgman@postgresql.org>
Received: from server1.pgsql.org (www.postgresql.org [64.49.215.9])
	by candle.pha.pa.us (8.11.6/8.10.1) with SMTP id g0NJjJU03694
	for <pgman@candle.pha.pa.us>; Wed, 23 Jan 2002 14:45:19 -0500 (EST)
Received: (qmail 89208 invoked by alias); 23 Jan 2002 19:43:44 -0000
Received: from unknown (HELO postgresql.org) (64.49.215.8)
  by www.postgresql.org with SMTP; 23 Jan 2002 19:43:44 -0000
Received: from mail.netbsd.org (mail.netbsd.org [155.53.1.253])
	by postgresql.org (8.11.3/8.11.4) with SMTP id g0NJd7l87615
	for <pgsql-hackers@postgreSQL.org>; Wed, 23 Jan 2002 14:39:07 -0500 (EST)
	(envelope-from wrstuden@netbsd.org)
Received: (qmail 11757 invoked by uid 1130); 23 Jan 2002 19:39:07 -0000
Date: Wed, 23 Jan 2002 11:34:23 -0800 (PST)
From: Bill Studenmund <wrstuden@netbsd.org>
X-X-Sender: <wrstuden@vespasia.home-net.internetconnect.net>
To: Tom Lane <tgl@sss.pgh.pa.us>
cc: Peter Eisentraut <peter_e@gmx.net>, <pgsql-hackers@postgresql.org>
Subject: Re: [HACKERS] RFD: schemas and different kinds of Postgres objects
In-Reply-To: <12239.1011661590@sss.pgh.pa.us>
Message-ID: <Pine.NEB.4.33.0201221710360.5119-100000@vespasia.home-net.internetconnect.net>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR

On Mon, 21 Jan 2002, Tom Lane wrote:

> Peter Eisentraut <peter_e@gmx.net> writes:
> > Remember that a schema is a named representation of ownership, so anything
> > that can be owned must be in a schema.  (Unless you want to invent a
> > parallel universe for a different kind of ownership, which would be
> > incredibly confusing.)
>
> I don't buy that premise.  It's true that SQL92 equates ownership of a
> schema with ownership of the objects therein, but AFAICS we have no hope
> of being forward-compatible with existing database setups (wherein there
> can be multiple tables of different ownership all in a single namespace)
> if we don't allow varying ownership within a schema.  I think we can
> arrange things so that we are upward compatible with both SQL92 and
> the old way.  Haven't worked out details yet though.

Yes we most certianly can! :-)

One of the things schemas have to support is essentially a PATH specifier.
So all we need to do is have all of the schemas created in a new DB have
path specifiers pulling in all of the other schemas. Thus we can make a
schema-savy system act as if it has only one namespace.

Back when Zembu was paying me to work on this, I envisioned a script or
tool you'd feed a DB dump, and it would do the schema fixup, including
adding PATH directives to all schemas, so they all see everything.

Since you have to pg_dump when updating, all this adds is running one tool
during an upgrade. And then existing apps would work. :-)

Take care,

Bill



---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org

From pgsql-hackers-owner+M18059=candle.pha.pa.us=pgman@postgresql.org Wed Jan 23 15:15:34 2002
Return-path: <pgsql-hackers-owner+M18059=candle.pha.pa.us=pgman@postgresql.org>
Received: from server1.pgsql.org (www.postgresql.org [64.49.215.9])
	by candle.pha.pa.us (8.11.6/8.10.1) with SMTP id g0NKFXU06599
	for <pgman@candle.pha.pa.us>; Wed, 23 Jan 2002 15:15:34 -0500 (EST)
Received: (qmail 357 invoked by alias); 23 Jan 2002 20:13:55 -0000
Received: from unknown (HELO postgresql.org) (64.49.215.8)
  by www.postgresql.org with SMTP; 23 Jan 2002 20:13:55 -0000
Received: from sss.pgh.pa.us ([192.204.191.242])
	by postgresql.org (8.11.3/8.11.4) with ESMTP id g0NJvXl94681
	for <pgsql-hackers@postgreSQL.org>; Wed, 23 Jan 2002 14:57:33 -0500 (EST)
	(envelope-from tgl@sss.pgh.pa.us)
Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1])
	by sss.pgh.pa.us (8.11.4/8.11.4) with ESMTP id g0NJvEf05081;
	Wed, 23 Jan 2002 14:57:14 -0500 (EST)
To: Bill Studenmund <wrstuden@netbsd.org>
cc: Peter Eisentraut <peter_e@gmx.net>, pgsql-hackers@postgresql.org
Subject: Re: [HACKERS] RFD: schemas and different kinds of Postgres objects 
In-Reply-To: <Pine.NEB.4.33.0201221710360.5119-100000@vespasia.home-net.internetconnect.net> 
References: <Pine.NEB.4.33.0201221710360.5119-100000@vespasia.home-net.internetconnect.net>
Comments: In-reply-to Bill Studenmund <wrstuden@netbsd.org>
	message dated "Wed, 23 Jan 2002 11:34:23 -0800"
Date: Wed, 23 Jan 2002 14:57:14 -0500
Message-ID: <5078.1011815834@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR

Bill Studenmund <wrstuden@netbsd.org> writes:
> One of the things schemas have to support is essentially a PATH specifier.

Yes, but...

> So all we need to do is have all of the schemas created in a new DB have
> path specifiers pulling in all of the other schemas. Thus we can make a
> schema-savy system act as if it has only one namespace.

When you create a new user, do all those path specifiers for the
existing users magically update themselves?  Seems like maintenance
would be a pain.

Fernando's "any" idea is probably a cleaner way to handle it if we
wanted to do things like that.  But I still think it'll be safer and
more controllable if we provide a "public" namespace instead; see
followup discussions.

			regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
    (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)

From pgsql-hackers-owner+M18061=candle.pha.pa.us=pgman@postgresql.org Wed Jan 23 16:04:22 2002
Return-path: <pgsql-hackers-owner+M18061=candle.pha.pa.us=pgman@postgresql.org>
Received: from server1.pgsql.org (www.postgresql.org [64.49.215.9])
	by candle.pha.pa.us (8.11.6/8.10.1) with SMTP id g0NL4LU11265
	for <pgman@candle.pha.pa.us>; Wed, 23 Jan 2002 16:04:21 -0500 (EST)
Received: (qmail 21187 invoked by alias); 23 Jan 2002 21:03:47 -0000
Received: from unknown (HELO postgresql.org) (64.49.215.8)
  by www.postgresql.org with SMTP; 23 Jan 2002 21:03:47 -0000
Received: from mail.netbsd.org (mail.netbsd.org [155.53.1.253])
	by postgresql.org (8.11.3/8.11.4) with SMTP id g0NKkVl14074
	for <pgsql-hackers@postgreSQL.org>; Wed, 23 Jan 2002 15:46:32 -0500 (EST)
	(envelope-from wrstuden@netbsd.org)
Received: (qmail 21707 invoked by uid 1130); 23 Jan 2002 20:46:32 -0000
Date: Wed, 23 Jan 2002 12:41:48 -0800 (PST)
From: Bill Studenmund <wrstuden@netbsd.org>
X-X-Sender: <wrstuden@vespasia.home-net.internetconnect.net>
To: Tom Lane <tgl@sss.pgh.pa.us>
cc: <pgsql-hackers@postgresql.org>
Subject: Re: [HACKERS] RFD: schemas and different kinds of Postgres objects
In-Reply-To: <648.1011762477@sss.pgh.pa.us>
Message-ID: <Pine.NEB.4.33.0201231134290.7050-100000@vespasia.home-net.internetconnect.net>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR

On Wed, 23 Jan 2002, Tom Lane wrote:

> Bill Studenmund <wrstuden@netbsd.org> writes:
> > Why not? What's wrong with either schema.foo.function (==>
> > function(schema.foo)) or foo.schema.function (==> schema.function(foo))?
>
> Neither is wrong in isolation, but how do you tell the difference?
> More to the point, given input x.y.z, how do you tell which component
> is what?

See below.

> > Tables and functions can't have the same names as schemas,
>
> News to me.  Where is that written on stone tablets?  Even if that's

I'm still trying to find the quote, but I found it a few months ago. I'm
looking in SQL99, which is 1100+ pages for section 2. :-)

> considered an acceptable limitation from a purely functional point of
> view, I don't like using it to disambiguate input.  The error messages
> you'll get from incorrect input to an implementation that depends on
> that to disambiguate cases will not be very helpful.

?? Depends on how we do it. As I see it, we have four cases. In the
x.y.z.p.q, we have:

1) No table name, but a function name. It's a function call.

2) A table name, but no function name. It's a table reference.

3) Both a table name & function name, and the function is first. I think
this case is an error (I don't think we support function.foo ==
function(foo))

4) Both a table name & function name, and the table is first. This is
foo.function.

Ok, there is a fifth case, no function nor table names, which is an error.

> > Actually functions do have to be schema local. It's in the spec (don't
> > have exactly where with me).
>
> (A) I don't believe that; please cite chapter and verse; (B) even if

Peter got to that one first.

> SQL92 thinks that's okay, we can't do it that way because of
> backwards-compatibility issues.

Why do backwards-compatability issues keep us from doing it?

Yes, I understand we have apps now with different users owning things
(tables, functions) which they all can access, just like they were in one
unified name space. With real schemas, they are in differen namespaces.
But as long as the routines, tables, triggers & such in each schema can
find things in the other schemas as if they were in one namespace, where
is the problem? We just have the app gain PATH directives to path in all
the other schemas.

The app runs, even though there are different schemas involved. Where is
the problem?

> > My vote would be to make them schema-specific. As Peter pointed out,
> > schemas are how you own things,
>
> Sorry, but this line of argument is trying to assume the very point in
> dispute.

When you started this thread, you said you were thinking about
"implementing SQL schemas." Are these "SQL schemas" going to follow the
spec or not? SQL'99 is rather clear that ownership happens at the schema
level. Peter spent quite a lot of time last October pounding that into my
head, and after I looked at the spec, I found he was 100% correct.

If these schemas are to follow the standards, ownership happens at the
schema level. If ownership happens elsewhere, whatever we're doing is not
following the standard. Unfortunatly it's that cut & dried. So why should
we call them "SQL schemas" if we aren't following the SQL spec?

Take care,

Bill


---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org

From pgsql-hackers-owner+M18061=candle.pha.pa.us=pgman@postgresql.org Wed Jan 23 16:04:22 2002
Return-path: <pgsql-hackers-owner+M18061=candle.pha.pa.us=pgman@postgresql.org>
Received: from server1.pgsql.org (www.postgresql.org [64.49.215.9])
	by candle.pha.pa.us (8.11.6/8.10.1) with SMTP id g0NL4LU11264
	for <pgman@candle.pha.pa.us>; Wed, 23 Jan 2002 16:04:21 -0500 (EST)
Received: (qmail 21192 invoked by alias); 23 Jan 2002 21:03:48 -0000
Received: from unknown (HELO postgresql.org) (64.49.215.8)
  by www.postgresql.org with SMTP; 23 Jan 2002 21:03:48 -0000
Received: from sss.pgh.pa.us ([192.204.191.242])
	by postgresql.org (8.11.3/8.11.4) with ESMTP id g0NKvHl19546
	for <pgsql-hackers@postgreSQL.org>; Wed, 23 Jan 2002 15:57:17 -0500 (EST)
	(envelope-from tgl@sss.pgh.pa.us)
Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1])
	by sss.pgh.pa.us (8.11.4/8.11.4) with ESMTP id g0NKvGf08536;
	Wed, 23 Jan 2002 15:57:16 -0500 (EST)
To: Bill Studenmund <wrstuden@netbsd.org>
cc: pgsql-hackers@postgresql.org
Subject: Re: [HACKERS] RFD: schemas and different kinds of Postgres objects 
In-Reply-To: <Pine.NEB.4.33.0201231134290.7050-100000@vespasia.home-net.internetconnect.net> 
References: <Pine.NEB.4.33.0201231134290.7050-100000@vespasia.home-net.internetconnect.net>
Comments: In-reply-to Bill Studenmund <wrstuden@netbsd.org>
	message dated "Wed, 23 Jan 2002 12:41:48 -0800"
Date: Wed, 23 Jan 2002 15:57:16 -0500
Message-ID: <8533.1011819436@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR

Bill Studenmund <wrstuden@netbsd.org> writes:
> On Wed, 23 Jan 2002, Tom Lane wrote:
>> Bill Studenmund <wrstuden@netbsd.org> writes:
> Why not? What's wrong with either schema.foo.function (==>
> function(schema.foo)) or foo.schema.function (==> schema.function(foo))?
>> 
>> Neither is wrong in isolation, but how do you tell the difference?
>> More to the point, given input x.y.z, how do you tell which component
>> is what?

> ?? Depends on how we do it. As I see it, we have four cases. In the
> x.y.z.p.q, we have:

> 1) No table name, but a function name. It's a function call.

> 2) A table name, but no function name. It's a table reference.

No, you're missing the point.  Which of x,y,z,p,q is the name we
are going to test to see if it is a table or function?  And which
of these names is a schema name --- if you don't even know that,
it's hard to argue that checking to see if some name is known is
a well-defined operation.

> When you started this thread, you said you were thinking about
> "implementing SQL schemas." Are these "SQL schemas" going to follow the
> spec or not?

If you use only the SQL-defined operations, after setting up any
configuration variables we may invent in the way we will document as
necessary for SQL-compatible behavior, then you will get SQL-compatible
behavior.  I do not think that precludes having an underlying
implementation that sees the world differently than SQL does and
supports non-SQL behaviors too.  (For that matter, I'm sure there is
text somewhere in the spec that points out that the spec intends to
define user-visible behavior, not implementation.)

			regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
    (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)

From pgsql-hackers-owner+M18062=candle.pha.pa.us=pgman@postgresql.org Wed Jan 23 16:14:05 2002
Return-path: <pgsql-hackers-owner+M18062=candle.pha.pa.us=pgman@postgresql.org>
Received: from server1.pgsql.org (www.postgresql.org [64.49.215.9])
	by candle.pha.pa.us (8.11.6/8.10.1) with SMTP id g0NLE4U12279
	for <pgman@candle.pha.pa.us>; Wed, 23 Jan 2002 16:14:04 -0500 (EST)
Received: (qmail 25791 invoked by alias); 23 Jan 2002 21:13:41 -0000
Received: from unknown (HELO postgresql.org) (64.49.215.8)
  by www.postgresql.org with SMTP; 23 Jan 2002 21:13:41 -0000
Received: from mail.netbsd.org (mail.netbsd.org [155.53.1.253])
	by postgresql.org (8.11.3/8.11.4) with SMTP id g0NL3Jl20482
	for <pgsql-hackers@postgreSQL.org>; Wed, 23 Jan 2002 16:03:19 -0500 (EST)
	(envelope-from wrstuden@netbsd.org)
Received: (qmail 27532 invoked by uid 1130); 23 Jan 2002 21:03:16 -0000
Date: Wed, 23 Jan 2002 12:58:33 -0800 (PST)
From: Bill Studenmund <wrstuden@netbsd.org>
X-X-Sender: <wrstuden@vespasia.home-net.internetconnect.net>
To: Tom Lane <tgl@sss.pgh.pa.us>
cc: Peter Eisentraut <peter_e@gmx.net>, <pgsql-hackers@postgresql.org>
Subject: Re: [HACKERS] RFD: schemas and different kinds of Postgres objects
In-Reply-To: <5078.1011815834@sss.pgh.pa.us>
Message-ID: <Pine.NEB.4.33.0201231242120.7050-100000@vespasia.home-net.internetconnect.net>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR

On Wed, 23 Jan 2002, Tom Lane wrote:

> Bill Studenmund <wrstuden@netbsd.org> writes:
> > One of the things schemas have to support is essentially a PATH specifier.
>
> Yes, but...
>
> > So all we need to do is have all of the schemas created in a new DB have
> > path specifiers pulling in all of the other schemas. Thus we can make a
> > schema-savy system act as if it has only one namespace.
>
> When you create a new user, do all those path specifiers for the
> existing users magically update themselves?  Seems like maintenance
> would be a pain.

No, they don't. But why should they? Why should they need to?

Either we're migrating an existing app, for which adding PATH directives
with a helper program before restore works, or we're making a new app. If
you're designing an app for a schema-savy system, you need to think about
schemas.

> Fernando's "any" idea is probably a cleaner way to handle it if we
> wanted to do things like that.  But I still think it'll be safer and
> more controllable if we provide a "public" namespace instead; see
> followup discussions.

Why? Why is it needed? What would public let you do that PATH and ACLs
wouldn't?

The only reason I can see it's needed is so that people can make new apps
for a schema-savy PostgreSQL while ignoring the schemas. That strikes me
as bad. I agree that schemas shouldn't interfeer with things, but to let
folks just blow them off seems equally bad.

Also, it wouldn't be SQL'99 schemas. It can still be done, but it's
solving a problem that the other SQL'99 databases don't seem to have.

Take care,

Bill


---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

From pgsql-hackers-owner+M18065=candle.pha.pa.us=pgman@postgresql.org Wed Jan 23 16:33:45 2002
Return-path: <pgsql-hackers-owner+M18065=candle.pha.pa.us=pgman@postgresql.org>
Received: from server1.pgsql.org (www.postgresql.org [64.49.215.9])
	by candle.pha.pa.us (8.11.6/8.10.1) with SMTP id g0NLXiU14151
	for <pgman@candle.pha.pa.us>; Wed, 23 Jan 2002 16:33:44 -0500 (EST)
Received: (qmail 32278 invoked by alias); 23 Jan 2002 21:33:41 -0000
Received: from unknown (HELO postgresql.org) (64.49.215.8)
  by www.postgresql.org with SMTP; 23 Jan 2002 21:33:41 -0000
Received: from mail.netbsd.org (mail.netbsd.org [155.53.1.253])
	by postgresql.org (8.11.3/8.11.4) with SMTP id g0NLKGl28778
	for <pgsql-hackers@postgreSQL.org>; Wed, 23 Jan 2002 16:20:16 -0500 (EST)
	(envelope-from wrstuden@netbsd.org)
Received: (qmail 665 invoked by uid 1130); 23 Jan 2002 21:20:17 -0000
Date: Wed, 23 Jan 2002 13:15:33 -0800 (PST)
From: Bill Studenmund <wrstuden@netbsd.org>
X-X-Sender: <wrstuden@vespasia.home-net.internetconnect.net>
To: Tom Lane <tgl@sss.pgh.pa.us>
cc: <pgsql-hackers@postgresql.org>
Subject: Re: [HACKERS] RFD: schemas and different kinds of Postgres objects
In-Reply-To: <8533.1011819436@sss.pgh.pa.us>
Message-ID: <Pine.NEB.4.33.0201231259150.7050-100000@vespasia.home-net.internetconnect.net>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR

On Wed, 23 Jan 2002, Tom Lane wrote:

> Bill Studenmund <wrstuden@netbsd.org> writes:
> > On Wed, 23 Jan 2002, Tom Lane wrote:
> >> Bill Studenmund <wrstuden@netbsd.org> writes:
> > Why not? What's wrong with either schema.foo.function (==>
> > function(schema.foo)) or foo.schema.function (==> schema.function(foo))?
> >>
> >> Neither is wrong in isolation, but how do you tell the difference?
> >> More to the point, given input x.y.z, how do you tell which component
> >> is what?
>
> > ?? Depends on how we do it. As I see it, we have four cases. In the
> > x.y.z.p.q, we have:
>
> > 1) No table name, but a function name. It's a function call.
>
> > 2) A table name, but no function name. It's a table reference.
>
> No, you're missing the point.  Which of x,y,z,p,q is the name we
> are going to test to see if it is a table or function?  And which
> of these names is a schema name --- if you don't even know that,
> it's hard to argue that checking to see if some name is known is
> a well-defined operation.

No, I'm not. :-) You test enough of them to figure out what case you have.
Yes, it might be a bit of work, but it's doable.

Actually, it's not that hard. In foo.funcname, do we support anything
AFTER the funcname? I don't think so. If there were a parenthesis, then we
have a function call. If it's an operator or something else, we have
either a table reference, or a foo.funcname function call. So all we have
to do is see if p.q (last two elements) is a schema.function, or of q is a
function pathed into our current schema. If yes, we have foo.function. If
not, then we have some table reference.

> > When you started this thread, you said you were thinking about
> > "implementing SQL schemas." Are these "SQL schemas" going to follow the
> > spec or not?
>
> If you use only the SQL-defined operations, after setting up any
> configuration variables we may invent in the way we will document as
> necessary for SQL-compatible behavior, then you will get SQL-compatible
> behavior.  I do not think that precludes having an underlying
> implementation that sees the world differently than SQL does and
> supports non-SQL behaviors too.  (For that matter, I'm sure there is
> text somewhere in the spec that points out that the spec intends to
> define user-visible behavior, not implementation.)

While I agree in principle, that quote is from talking about ownership. I
don't see how we can gloss over ownership. :-)

Also, why support two different behaviors? That means 1) there's code
bloat since the backend has to support both. 2) Support is harder as major
DB behaviors will change depending on these settings. 3) I still haven't
seen anything this variant behavior would do that can't be done with
schema paths and access control lists, other than it would let people keep
thinking about things as they do now.

That latter reason doesn't strike me as a good one. Yes, it will take some
getting used to to wrap minds around schemas, but once done, I don't think
it will be that hard. Yes, the documentation will need work, and the
tutorial will need changing (And Bruce will need to release a new edition
of his book :-) , but once that's done, I don't think working with real
schemas will be that hard. So why not just do things right from the
begining?

Take care,

Bill


---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org

From pgsql-hackers-owner+M18064=candle.pha.pa.us=pgman@postgresql.org Wed Jan 23 16:23:32 2002
Return-path: <pgsql-hackers-owner+M18064=candle.pha.pa.us=pgman@postgresql.org>
Received: from server1.pgsql.org (www.postgresql.org [64.49.215.9])
	by candle.pha.pa.us (8.11.6/8.10.1) with SMTP id g0NLNVU13386
	for <pgman@candle.pha.pa.us>; Wed, 23 Jan 2002 16:23:31 -0500 (EST)
Received: (qmail 29442 invoked by alias); 23 Jan 2002 21:23:26 -0000
Received: from unknown (HELO postgresql.org) (64.49.215.8)
  by www.postgresql.org with SMTP; 23 Jan 2002 21:23:26 -0000
Received: from stubee.d2hosting.net (d2hosting.net [66.70.41.160])
	by postgresql.org (8.11.3/8.11.4) with ESMTP id g0NLGVl28360
	for <pgsql-hackers@postgresql.org>; Wed, 23 Jan 2002 16:16:31 -0500 (EST)
	(envelope-from tswan-lst@ics.olemiss.edu)
Received: from ics.olemiss.edu (adsl-81-102-77.jan.bellsouth.net [65.81.102.77])
	by stubee.d2hosting.net (8.11.6/linuxconf) with ESMTP id g0NLGLT00962;
	Wed, 23 Jan 2002 15:16:22 -0600
Message-ID: <3C4F2824.90709@ics.olemiss.edu>
Date: Wed, 23 Jan 2002 15:16:20 -0600
From: Thomas Swan <tswan-lst@ics.olemiss.edu>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:0.9.7+) Gecko/20020123
X-Accept-Language: en-us
MIME-Version: 1.0
To: Tom Lane <tgl@sss.pgh.pa.us>
cc: Stephan Szabo <sszabo@megazone23.bigpanda.com>,
   Peter Eisentraut <peter_e@gmx.net>, pgsql-hackers@postgresql.org,
   Fernando Nasser <fnasser@redhat.com>
Subject: Re: [HACKERS] RFD: schemas and different kinds of Postgres objects
References: <20020123083152.W18169-100000@megazone23.bigpanda.com> <3159.1011804418@sss.pgh.pa.us>
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <title></title>
</head>
<body>
Tom Lane wrote:<br>
<blockquote type="cite" cite="mid:3159.1011804418@sss.pgh.pa.us">
  <pre wrap="">Stephan Szabo <a class="moz-txt-link-rfc2396E" href="mailto:sszabo@megazone23.bigpanda.com">&lt;sszabo@megazone23.bigpanda.com&gt;</a> writes:<br></pre>
  <blockquote type="cite">
    <pre wrap="">Wouldn't it make sense to prefer operators/functions earlier in the search<br>path for resolving ambiguity.  So if you had plus(int4, int4) in my<br>schema and plus(int8, int8) in system, and they'd otherwise cause an<br>ambiguity failure for the query, use the plus(int4, int4) on mine. It<br>seems not too far from having the search path shadow later exact matches.<br></pre>
    </blockquote>
    <pre wrap=""><!----><br>Given the complexity of the resolution rules (cf.<br><a class="moz-txt-link-freetext" href="http://developer.postgresql.org/docs/postgres/typeconv.html">http://developer.postgresql.org/docs/postgres/typeconv.html</a>),<br>it's not clear that we can determine exactly which "later" entry ought<br>to be blamed for causing a resolution failure.  I'd be interested to<br>hear Lockhart's opinion on this --- but my gut feeling is we don't<br>want to go there.  The resolution rules are already complicated enough,<br>and I think layering an additional mechanism like that onto them might<br>make the behavior totally unpredictable.<br><br>Another problem is that this would probably cause earlier namespace<br>entries to be over-preferred.  For example, suppose that the system<br>namespace has plus(int4,int4) and plus(int8,int8) and you choose to<br>define plus(int4,int8) locally.  I believe you'd suddenly find yours<br>being used for *any* cross-datatype addit
ion, including cases that<br>had nothing obvious to do with either int4 or int8 ...<br></pre>
    </blockquote>
This is a good example. &nbsp;The other option is to use&nbsp; name, arg1, arg2...
as a hunt path for function call resolution. &nbsp;This would depend on when datatype
promotion is occuring (i.e. int4 to int8, int8 to int4, etc... )<br>
    <br>
Then you could just be really hard and say that only exact and trivial conversion
matches in user space will be used . &nbsp; <br>
    <br>
There is no easy answer for this, but whatever rules are initiated need to
be something that someone can step through to solve w/o a machine.<br>
    <br>
I do think you will ultimately need a search utility that provides 'which'
functionality. &nbsp; (Given my namespace, which function in what namespace is
going to be called.)<br>
    <blockquote type="cite" cite="mid:3159.1011804418@sss.pgh.pa.us">
      <pre wrap=""><br><br>			regards, tom lane<br><br>---------------------------(end of broadcast)---------------------------<br>TIP 1: subscribe and unsubscribe commands go to <a class="moz-txt-link-abbreviated" href="mailto:majordomo@postgresql.org">majordomo@postgresql.org</a><br></pre>
      </blockquote>
      <br>
      <br>
      </body>
      </html>


From pgsql-hackers-owner+M18066=candle.pha.pa.us=pgman@postgresql.org Wed Jan 23 16:45:11 2002
Return-path: <pgsql-hackers-owner+M18066=candle.pha.pa.us=pgman@postgresql.org>
Received: from server1.pgsql.org (www.postgresql.org [64.49.215.9])
	by candle.pha.pa.us (8.11.6/8.10.1) with SMTP id g0NLjAU15010
	for <pgman@candle.pha.pa.us>; Wed, 23 Jan 2002 16:45:11 -0500 (EST)
Received: (qmail 39170 invoked by alias); 23 Jan 2002 21:43:48 -0000
Received: from unknown (HELO postgresql.org) (64.49.215.8)
  by www.postgresql.org with SMTP; 23 Jan 2002 21:43:48 -0000
Received: from sss.pgh.pa.us ([192.204.191.242])
	by postgresql.org (8.11.3/8.11.4) with ESMTP id g0NLQpl30489
	for <pgsql-hackers@postgreSQL.org>; Wed, 23 Jan 2002 16:26:51 -0500 (EST)
	(envelope-from tgl@sss.pgh.pa.us)
Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1])
	by sss.pgh.pa.us (8.11.4/8.11.4) with ESMTP id g0NLQXf08750;
	Wed, 23 Jan 2002 16:26:33 -0500 (EST)
To: Bill Studenmund <wrstuden@netbsd.org>
cc: Peter Eisentraut <peter_e@gmx.net>, pgsql-hackers@postgresql.org
Subject: Re: [HACKERS] RFD: schemas and different kinds of Postgres objects 
In-Reply-To: <Pine.NEB.4.33.0201231242120.7050-100000@vespasia.home-net.internetconnect.net> 
References: <Pine.NEB.4.33.0201231242120.7050-100000@vespasia.home-net.internetconnect.net>
Comments: In-reply-to Bill Studenmund <wrstuden@netbsd.org>
	message dated "Wed, 23 Jan 2002 12:58:33 -0800"
Date: Wed, 23 Jan 2002 16:26:33 -0500
Message-ID: <8747.1011821193@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR

Bill Studenmund <wrstuden@netbsd.org> writes:
> Either we're migrating an existing app, for which adding PATH directives
> with a helper program before restore works, or we're making a new app.

Sorry, I don't accept that either-or proposition.  People will expect to
be able to continue to use 7.3 as they have used Postgres in the past.
Among other things that will mean being able to add new users to an
existing installation.  If we say "you can't do much of anything in 7.3
until you upgrade all your applications to schema-awareness", then we're
going to have lots of unhappy users.

>> Fernando's "any" idea is probably a cleaner way to handle it if we
>> wanted to do things like that.  But I still think it'll be safer and
>> more controllable if we provide a "public" namespace instead; see
>> followup discussions.

> Why? Why is it needed? What would public let you do that PATH and ACLs
> wouldn't?

Public gives you a place to put the ACL determining what people can do
with publicly-visible names.  See, eg, comments from Joe Conway.
Without a specific public namespace to put ACLs on, a dbadmin has very
little control over interuser interactions.  Please note that the
facility we are talking about offering here is not available in existing
Postgres nor in SQL92, but that doesn't make it evil or unreasonable.

Basically my point here is that the SQL spec is not the be-all and
end-all of database development.  (Have you read C. J. Date's commentary
on it, for example?)  We have a proven useful concept of object ownership
in existing Postgres, and I see no need to remove that facility in
pursuit of slavish adherence to a specification.  If it were a project
goal to rip out everything in Postgres that is not mentioned in the
SQL spec, we could have a much smaller distribution ... with lots fewer
users.

			regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

From pgsql-hackers-owner+M18067=candle.pha.pa.us=pgman@postgresql.org Wed Jan 23 17:04:34 2002
Return-path: <pgsql-hackers-owner+M18067=candle.pha.pa.us=pgman@postgresql.org>
Received: from server1.pgsql.org (www.postgresql.org [64.49.215.9])
	by candle.pha.pa.us (8.11.6/8.10.1) with SMTP id g0NM4XU16392
	for <pgman@candle.pha.pa.us>; Wed, 23 Jan 2002 17:04:33 -0500 (EST)
Received: (qmail 47125 invoked by alias); 23 Jan 2002 22:04:32 -0000
Received: from unknown (HELO postgresql.org) (64.49.215.8)
  by www.postgresql.org with SMTP; 23 Jan 2002 22:04:32 -0000
Received: from sss.pgh.pa.us ([192.204.191.242])
	by postgresql.org (8.11.3/8.11.4) with ESMTP id g0NLk1l42602
	for <pgsql-hackers@postgreSQL.org>; Wed, 23 Jan 2002 16:46:01 -0500 (EST)
	(envelope-from tgl@sss.pgh.pa.us)
Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1])
	by sss.pgh.pa.us (8.11.4/8.11.4) with ESMTP id g0NLk1f08845;
	Wed, 23 Jan 2002 16:46:01 -0500 (EST)
To: Bill Studenmund <wrstuden@netbsd.org>
cc: pgsql-hackers@postgresql.org
Subject: Re: [HACKERS] RFD: schemas and different kinds of Postgres objects 
In-Reply-To: <Pine.NEB.4.33.0201231259150.7050-100000@vespasia.home-net.internetconnect.net> 
References: <Pine.NEB.4.33.0201231259150.7050-100000@vespasia.home-net.internetconnect.net>
Comments: In-reply-to Bill Studenmund <wrstuden@netbsd.org>
	message dated "Wed, 23 Jan 2002 13:15:33 -0800"
Date: Wed, 23 Jan 2002 16:46:01 -0500
Message-ID: <8842.1011822361@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR

Bill Studenmund <wrstuden@netbsd.org> writes:
>> No, you're missing the point.  Which of x,y,z,p,q is the name we
>> are going to test to see if it is a table or function?

> No, I'm not. :-) You test enough of them to figure out what case you have.

There could be multiple valid interpretations.  When you can't even
figure out where to start, it's too squishy for me.  Code complexity
isn't really the issue here, it's whether a user can understand what's
going on.

> Actually, it's not that hard. In foo.funcname, do we support anything
> AFTER the funcname? I don't think so. If there were a parenthesis, then we
> have a function call. If it's an operator or something else, we have
> either a table reference, or a foo.funcname function call. So all we have
> to do is see if p.q (last two elements) is a schema.function, or of q is a
> function pathed into our current schema. If yes, we have foo.function. If
> not, then we have some table reference.

Now wait a sec.  What you started out with was the claim

> Why not? What's wrong with either schema.foo.function (==>
> function(schema.foo)) or foo.schema.function (==> schema.function(foo))?

The issue was not figuring out whether the last component was a function
name or not, it was to determine what the other components were, and in
particular whether the function name should be presumed to be qualified
(by the next-to-last component taken as a schema name) or unqualified.
That in turns changes your assumptions about which of the components
further left are table names, schema names, or catalog names.

> ... I don't think working with real
> schemas will be that hard. So why not just do things right from the
> begining?

If I thought that SQL's model of ownership == namespace was "right",
then we probably wouldn't be having this argument.  I think the spec
pretty much sucks in this particular department, and I don't see why
we should restrict our implementation to support only the spec's
braindead world view.  Especially not when it makes the implementation
harder, not easier, because we end up needing to add in weird frammishes
to have some semblance of backwards-compatibility too.

Please give me some good reasons (not "the spec says so") why it's
a good idea to treat ownership of a namespace as equivalent to ownership
of the objects in it, and why decoupling the concepts at the
implementation level isn't a reasonable thing to do.

			regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
    (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)

From pgsql-hackers-owner+M18070=candle.pha.pa.us=pgman@postgresql.org Wed Jan 23 17:43:52 2002
Return-path: <pgsql-hackers-owner+M18070=candle.pha.pa.us=pgman@postgresql.org>
Received: from server1.pgsql.org (www.postgresql.org [64.49.215.9])
	by candle.pha.pa.us (8.11.6/8.10.1) with SMTP id g0NMhpU18760
	for <pgman@candle.pha.pa.us>; Wed, 23 Jan 2002 17:43:51 -0500 (EST)
Received: (qmail 53592 invoked by alias); 23 Jan 2002 22:43:08 -0000
Received: from unknown (HELO postgresql.org) (64.49.215.8)
  by www.postgresql.org with SMTP; 23 Jan 2002 22:43:08 -0000
Received: from mail.netbsd.org (mail.netbsd.org [155.53.1.253])
	by postgresql.org (8.11.3/8.11.4) with SMTP id g0NMP4l51662
	for <pgsql-hackers@postgreSQL.org>; Wed, 23 Jan 2002 17:25:04 -0500 (EST)
	(envelope-from wrstuden@netbsd.org)
Received: (qmail 9718 invoked by uid 1130); 23 Jan 2002 22:25:06 -0000
Date: Wed, 23 Jan 2002 14:20:22 -0800 (PST)
From: Bill Studenmund <wrstuden@netbsd.org>
X-X-Sender: <wrstuden@vespasia.home-net.internetconnect.net>
To: Tom Lane <tgl@sss.pgh.pa.us>
cc: <pgsql-hackers@postgresql.org>
Subject: Re: [HACKERS] RFD: schemas and different kinds of Postgres objects
In-Reply-To: <8842.1011822361@sss.pgh.pa.us>
Message-ID: <Pine.NEB.4.33.0201231344110.7050-100000@vespasia.home-net.internetconnect.net>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR

On Wed, 23 Jan 2002, Tom Lane wrote:

> Bill Studenmund <wrstuden@netbsd.org> writes:
> >> No, you're missing the point.  Which of x,y,z,p,q is the name we
> >> are going to test to see if it is a table or function?
>
> > No, I'm not. :-) You test enough of them to figure out what case you have.
>
> There could be multiple valid interpretations.  When you can't even
> figure out where to start, it's too squishy for me.  Code complexity
> isn't really the issue here, it's whether a user can understand what's
> going on.
>
> > Actually, it's not that hard. In foo.funcname, do we support anything
> > AFTER the funcname? I don't think so. If there were a parenthesis, then we
> > have a function call. If it's an operator or something else, we have
> > either a table reference, or a foo.funcname function call. So all we have
> > to do is see if p.q (last two elements) is a schema.function, or of q is a
> > function pathed into our current schema. If yes, we have foo.function. If
> > not, then we have some table reference.
>
> Now wait a sec.  What you started out with was the claim
>
> > Why not? What's wrong with either schema.foo.function (==>
> > function(schema.foo)) or foo.schema.function (==> schema.function(foo))?
>
> The issue was not figuring out whether the last component was a function
> name or not, it was to determine what the other components were, and in
> particular whether the function name should be presumed to be qualified
> (by the next-to-last component taken as a schema name) or unqualified.
> That in turns changes your assumptions about which of the components
> further left are table names, schema names, or catalog names.

Then you choose. Choose a search order, and document it. If you are going
to go back into a corner full of so much ambiguity, then document your way
out.

You can make it easier restricting say catalogs and schemas to have
different names, or schemas, tables, and functions can't have the same
name. For this, I'd suggest following Oracle's example. I don't think you
can go too wrong using Oracle's behavior to break ties & ambiguities.

> > ... I don't think working with real
> > schemas will be that hard. So why not just do things right from the
> > begining?
>
> If I thought that SQL's model of ownership == namespace was "right",
> then we probably wouldn't be having this argument.  I think the spec
> pretty much sucks in this particular department, and I don't see why
> we should restrict our implementation to support only the spec's
> braindead world view.  Especially not when it makes the implementation
> harder, not easier, because we end up needing to add in weird frammishes
> to have some semblance of backwards-compatibility too.

?? What weird fammishes from ownership?

It actually makes things (slightly) simpler. All of the owner fields
disapear from most system tables, because the owner is implied by the
containing schema.

Also, what is braindead about the spec? Yes, it's not what I would choose,
and it's different from what PG does now. But it's just that, different.
Given all of the ACL abilities (if the superuser wants user X to be able
to create objects in table Y of schema Z, s/he makes it so), why does it
matter who owns the object?

> Please give me some good reasons (not "the spec says so") why it's
> a good idea to treat ownership of a namespace as equivalent to ownership
> of the objects in it, and why decoupling the concepts at the
> implementation level isn't a reasonable thing to do.

Can you really give a good reason other than, "I don't like it?"

Absent the existance of specs, it's a matter of choice. Having all of the
ownership happen at the schema level or at the individual item level, it's
six of one, half-dozen of the other.

But there is a spec. A spec that, as far as I can tell, all other
schema-claming DBs follow. So why shouldn't we follow it? Yes, you don't
like it. But is this really supposed to be about personal desires, or
about the resulting DB?

Take care,

Bill


---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly

From pgsql-hackers-owner+M18072=candle.pha.pa.us=pgman@postgresql.org Wed Jan 23 18:14:00 2002
Return-path: <pgsql-hackers-owner+M18072=candle.pha.pa.us=pgman@postgresql.org>
Received: from server1.pgsql.org (www.postgresql.org [64.49.215.9])
	by candle.pha.pa.us (8.11.6/8.10.1) with SMTP id g0NNDxU20711
	for <pgman@candle.pha.pa.us>; Wed, 23 Jan 2002 18:14:00 -0500 (EST)
Received: (qmail 61874 invoked by alias); 23 Jan 2002 23:13:20 -0000
Received: from unknown (HELO postgresql.org) (64.49.215.8)
  by www.postgresql.org with SMTP; 23 Jan 2002 23:13:20 -0000
Received: from mail.netbsd.org (mail.netbsd.org [155.53.1.253])
	by postgresql.org (8.11.3/8.11.4) with SMTP id g0NMitl56697
	for <pgsql-hackers@postgreSQL.org>; Wed, 23 Jan 2002 17:44:55 -0500 (EST)
	(envelope-from wrstuden@netbsd.org)
Received: (qmail 10914 invoked by uid 1130); 23 Jan 2002 22:44:56 -0000
Date: Wed, 23 Jan 2002 14:40:12 -0800 (PST)
From: Bill Studenmund <wrstuden@netbsd.org>
X-X-Sender: <wrstuden@vespasia.home-net.internetconnect.net>
To: Tom Lane <tgl@sss.pgh.pa.us>
cc: Peter Eisentraut <peter_e@gmx.net>, <pgsql-hackers@postgresql.org>,
   Fernando Nasser <fnasser@redhat.com>
Subject: Re: [HACKERS] RFD: schemas and different kinds of Postgres objects
In-Reply-To: <2600.1011799885@sss.pgh.pa.us>
Message-ID: <Pine.NEB.4.33.0201231435300.7050-100000@vespasia.home-net.internetconnect.net>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR

On Wed, 23 Jan 2002, Tom Lane wrote:

> Peter Eisentraut <peter_e@gmx.net> writes:
> > OK, I can accept that.  But then I want to get back at my original point,
> > namely that all database objects (except users and groups) should be in
> > schemas.  This is also cleaner, simpler, and more flexible.  There is
> > clearly demand for schema-local functions.  So I think that designing this
> > system from the premise that a schema-qualified operator call will look
> > strange is the wrong end to start at.
>
> Okay, a fair point --- or you could have used my own argument against
> me: there's nothing wrong with designing a general mechanism and then
> choosing not to expose all of the functionality.  So let's assume that
> functions and operators live in namespaces, and that we have some kind
> of search path across multiple namespaces for use when an unqualified
> name is given.
>
> Now, how is that going to play with resolution of ambiguous calls?
>
> The most reasonable semantics I can think of are to collect all the
> potential matches (matching op/func name) across all the searchable
> namespaces, discarding only those that have exactly the same signature
> as one in a prior namespace.  Thus, eg, plus(int4,int4) in an earlier
> namespace would hide plus(int4,int4) in a later namespace in the search
> path, but it wouldn't hide plus(int8,int8).  After we've collected all
> the visible alternatives, do resolution based on argument types the same
> way as we do now.
>
> The only alternative semantics that seem defensible at all are to stop
> at the first namespace that contains any matching-by-name op or func,
> and do resolution using only the candidates available in that namespace.
> That strikes me as not a good idea; for example, a user who defines a
> "+" operator in his own schema for his own datatype would be quite
> unhappy to find it masking all the "+" operators in the system schema.

There is a third behavior which is almost the first one. And it's the one
I use for function matching in the package diffs I made oh so long ago.
:-)

You look in the first namespace for all candidates. If one matches, you
use it. If two or more match, you throw the error we throw now. If none
match, you move on to the next namespace and repeat the search there.

It's what the code does now. It's not that hard. It's just essentially
turning part of the function lookup into a for loop over the namespaces.
:-)

It's easier than gathering everything as you only gather one namespace's
worth of matches at once.

Take care,

Bill


---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/users-lounge/docs/faq.html

From pgsql-hackers-owner+M18071=candle.pha.pa.us=pgman@postgresql.org Wed Jan 23 18:14:06 2002
Return-path: <pgsql-hackers-owner+M18071=candle.pha.pa.us=pgman@postgresql.org>
Received: from server1.pgsql.org (www.postgresql.org [64.49.215.9])
	by candle.pha.pa.us (8.11.6/8.10.1) with SMTP id g0NNE5U20779
	for <pgman@candle.pha.pa.us>; Wed, 23 Jan 2002 18:14:06 -0500 (EST)
Received: (qmail 62072 invoked by alias); 23 Jan 2002 23:13:28 -0000
Received: from unknown (HELO postgresql.org) (64.49.215.8)
  by www.postgresql.org with SMTP; 23 Jan 2002 23:13:28 -0000
Received: from mail.netbsd.org (mail.netbsd.org [155.53.1.253])
	by postgresql.org (8.11.3/8.11.4) with SMTP id g0NMsEl57927
	for <pgsql-hackers@postgresql.org>; Wed, 23 Jan 2002 17:54:14 -0500 (EST)
	(envelope-from wrstuden@netbsd.org)
Received: (qmail 13221 invoked by uid 1130); 23 Jan 2002 22:54:16 -0000
Date: Wed, 23 Jan 2002 14:49:32 -0800 (PST)
From: Bill Studenmund <wrstuden@netbsd.org>
X-X-Sender: <wrstuden@vespasia.home-net.internetconnect.net>
To: Tom Lane <tgl@sss.pgh.pa.us>
cc: Zeugswetter Andreas SB SD <ZeugswetterA@spardat.at>,
   Fernando Nasser <fnasser@redhat.com>, Peter Eisentraut <peter_e@gmx.net>,
   <pgsql-hackers@postgresql.org>
Subject: Re: [HACKERS] RFD: schemas and different kinds of Postgres objects
In-Reply-To: <2677.1011800674@sss.pgh.pa.us>
Message-ID: <Pine.NEB.4.33.0201231443440.7050-100000@vespasia.home-net.internetconnect.net>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR

On Wed, 23 Jan 2002, Tom Lane wrote:

> "Zeugswetter Andreas SB SD" <ZeugswetterA@spardat.at> writes:
> > When configured for historical behavior would need to:
> > 1. have search path: temp, any, system
> > 2. guard against duplicate table names across all schemas (except temp schema)
>
> This would be a *whole* lot simpler if we forgot the notion of "any"
> and made the search order look like
>
> 	(temp, private, public, system)
>
> where the public namespace is world-writable but the private per-user
> ones are (typically at least) not.
>
> It occurs to me that we can get both backward-compatible and SQL92
> semantics with this same search path; the only thing that needs to
> be different in the two cases is whether the default place to create
> objects is your private schema or the public one.  If you don't ever
> use your private schema then it doesn't matter if it's on the search
> path or not.  I would still prefer that the search path be a settable
> option, since a paranoid person might well wish to not have public in
> his path at all ... but the default could be as-above.

s/public/DEFAULT/ and add a way (createdb option) to make the default ACL
on DEFAULT such that anyone can create things and we are in agreement.

One of the parts of the schema system I'd envisioned (and tried to make)
was that there would be an IMPLIMENTATION_SCHEMA which owned all
built-ins, and a DEFAULT schema which was owned by the superuser. Making
the default schema path for a schema
IMPLIMENTATION_SCHEMA:<SCHEMA_NAME>:DEFAULT is fine.

Making the default schema for creation settable to DEFAULT would be fine,
and I think would remove objection. :-)

Take care,

Bill


---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/users-lounge/docs/faq.html

From pgsql-hackers-owner+M18073=candle.pha.pa.us=pgman@postgresql.org Wed Jan 23 18:14:19 2002
Return-path: <pgsql-hackers-owner+M18073=candle.pha.pa.us=pgman@postgresql.org>
Received: from server1.pgsql.org (www.postgresql.org [64.49.215.9])
	by candle.pha.pa.us (8.11.6/8.10.1) with SMTP id g0NNEIU20817
	for <pgman@candle.pha.pa.us>; Wed, 23 Jan 2002 18:14:18 -0500 (EST)
Received: (qmail 61956 invoked by alias); 23 Jan 2002 23:13:23 -0000
Received: from unknown (HELO postgresql.org) (64.49.215.8)
  by www.postgresql.org with SMTP; 23 Jan 2002 23:13:23 -0000
Received: from mail.netbsd.org (mail.netbsd.org [155.53.1.253])
	by postgresql.org (8.11.3/8.11.4) with SMTP id g0NN0Cl58411
	for <pgsql-hackers@postgreSQL.org>; Wed, 23 Jan 2002 18:00:12 -0500 (EST)
	(envelope-from wrstuden@netbsd.org)
Received: (qmail 14480 invoked by uid 1130); 23 Jan 2002 23:00:14 -0000
Date: Wed, 23 Jan 2002 14:55:29 -0800 (PST)
From: Bill Studenmund <wrstuden@netbsd.org>
X-X-Sender: <wrstuden@vespasia.home-net.internetconnect.net>
To: Tom Lane <tgl@sss.pgh.pa.us>
cc: Peter Eisentraut <peter_e@gmx.net>, <pgsql-hackers@postgresql.org>
Subject: Re: [HACKERS] RFD: schemas and different kinds of Postgres objects
In-Reply-To: <8747.1011821193@sss.pgh.pa.us>
Message-ID: <Pine.NEB.4.33.0201231420310.7050-100000@vespasia.home-net.internetconnect.net>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR

On Wed, 23 Jan 2002, Tom Lane wrote:

> Bill Studenmund <wrstuden@netbsd.org> writes:
> > Either we're migrating an existing app, for which adding PATH directives
> > with a helper program before restore works, or we're making a new app.
>
> Sorry, I don't accept that either-or proposition.  People will expect to
> be able to continue to use 7.3 as they have used Postgres in the past.
> Among other things that will mean being able to add new users to an
> existing installation.  If we say "you can't do much of anything in 7.3
> until you upgrade all your applications to schema-awareness", then we're
> going to have lots of unhappy users.

"upgrad[ing] .. to schema-awareness" is adding the PATHs to the schema
creates. You then have a unified namespace (to the apps perspective). The
migration tool I mentioned should be able to do this (and will need to be
present).

As PostgreSQL changes, people are going to have to learn to deal with new
features. I really don't think that dealing with schemas is going to be
that hard. Also, at Zembu, all of the apps we looked at had maybe two or
three schemas. These are big apps. If they can live with just a few
schemas, why do we need so many that maintainance is a pain?

Also, what is this new user going to do *IN THE EXISTING APP*? Either the
user is going to change existing tables, for which adding the user to the
ACLs (or better yet to a group) will work, or the new user is going to own
new tables. If the new user is owning new tables, then you have to change
the app to refer to them. If the upgrade to 7.3 included a, "quick
tutorial about the new schema support," the author should be able to adapt
easily.

> >> Fernando's "any" idea is probably a cleaner way to handle it if we
> >> wanted to do things like that.  But I still think it'll be safer and
> >> more controllable if we provide a "public" namespace instead; see
> >> followup discussions.
>
> > Why? Why is it needed? What would public let you do that PATH and ACLs
> > wouldn't?
>
> Public gives you a place to put the ACL determining what people can do
> with publicly-visible names.  See, eg, comments from Joe Conway.
> Without a specific public namespace to put ACLs on, a dbadmin has very
> little control over interuser interactions.  Please note that the
> facility we are talking about offering here is not available in existing
> Postgres nor in SQL92, but that doesn't make it evil or unreasonable.

I think the existance of a DEFAULT schema (which is a real schema, not a
special namespace) would also aleviate the above concerns.

> Basically my point here is that the SQL spec is not the be-all and
> end-all of database development.  (Have you read C. J. Date's commentary
> on it, for example?)  We have a proven useful concept of object ownership
> in existing Postgres, and I see no need to remove that facility in
> pursuit of slavish adherence to a specification.  If it were a project
> goal to rip out everything in Postgres that is not mentioned in the
> SQL spec, we could have a much smaller distribution ... with lots fewer
> users.

I haven't read the comentary, do you have a URL?

I agree that we should not limit ourselves to SQL'99. But doing more than
SQL'99 is different from wanting to support SQL schemas while using a
different ownership model, when one of the main things of SQL schemas as I
understand it is the ownership model.

Take care,

Bill


---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org

From pgsql-hackers-owner+M18075=candle.pha.pa.us=pgman@postgresql.org Wed Jan 23 18:33:16 2002
Return-path: <pgsql-hackers-owner+M18075=candle.pha.pa.us=pgman@postgresql.org>
Received: from server1.pgsql.org (www.postgresql.org [64.49.215.9])
	by candle.pha.pa.us (8.11.6/8.10.1) with SMTP id g0NNXGU21830
	for <pgman@candle.pha.pa.us>; Wed, 23 Jan 2002 18:33:16 -0500 (EST)
Received: (qmail 68962 invoked by alias); 23 Jan 2002 23:33:14 -0000
Received: from unknown (HELO postgresql.org) (64.49.215.8)
  by www.postgresql.org with SMTP; 23 Jan 2002 23:33:14 -0000
Received: from megazone.bigpanda.com (megazone.bigpanda.com [63.150.15.178])
	by postgresql.org (8.11.3/8.11.4) with ESMTP id g0NNUFl68439
	for <pgsql-hackers@postgreSQL.org>; Wed, 23 Jan 2002 18:30:15 -0500 (EST)
	(envelope-from sszabo@megazone23.bigpanda.com)
Received: by megazone.bigpanda.com (Postfix, from userid 1001)
	id 4D769D5F7; Wed, 23 Jan 2002 15:30:07 -0800 (PST)
Received: from localhost (localhost [127.0.0.1])
	by megazone.bigpanda.com (Postfix) with ESMTP
	id 412425BF5; Wed, 23 Jan 2002 15:30:07 -0800 (PST)
Date: Wed, 23 Jan 2002 15:30:07 -0800 (PST)
From: Stephan Szabo <sszabo@megazone23.bigpanda.com>
To: Bill Studenmund <wrstuden@netbsd.org>
cc: Tom Lane <tgl@sss.pgh.pa.us>, Peter Eisentraut <peter_e@gmx.net>,
   <pgsql-hackers@postgresql.org>, Fernando Nasser <fnasser@redhat.com>
Subject: Re: [HACKERS] RFD: schemas and different kinds of Postgres objects
In-Reply-To: <Pine.NEB.4.33.0201231435300.7050-100000@vespasia.home-net.internetconnect.net>
Message-ID: <20020123152711.I22382-100000@megazone23.bigpanda.com>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR

On Wed, 23 Jan 2002, Bill Studenmund wrote:

> On Wed, 23 Jan 2002, Tom Lane wrote:
>
> There is a third behavior which is almost the first one. And it's the one
> I use for function matching in the package diffs I made oh so long ago.
> :-)
>
> You look in the first namespace for all candidates. If one matches, you
> use it. If two or more match, you throw the error we throw now. If none
> match, you move on to the next namespace and repeat the search there.

That's even more strongly towards earlier namespaces than my suggestion.
How do you define match?  If you allow coercions, then the
plus(int8, int8) in my schema would be prefered over better (possibly
exact) matches in the system schema which may not be what you want.




---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/users-lounge/docs/faq.html

From pgsql-hackers-owner+M18078=candle.pha.pa.us=pgman@postgresql.org Wed Jan 23 19:04:16 2002
Return-path: <pgsql-hackers-owner+M18078=candle.pha.pa.us=pgman@postgresql.org>
Received: from server1.pgsql.org (www.postgresql.org [64.49.215.9])
	by candle.pha.pa.us (8.11.6/8.10.1) with SMTP id g0O04GU23131
	for <pgman@candle.pha.pa.us>; Wed, 23 Jan 2002 19:04:16 -0500 (EST)
Received: (qmail 74730 invoked by alias); 24 Jan 2002 00:03:43 -0000
Received: from unknown (HELO postgresql.org) (64.49.215.8)
  by www.postgresql.org with SMTP; 24 Jan 2002 00:03:43 -0000
Received: from mail.netbsd.org (mail.netbsd.org [155.53.1.253])
	by postgresql.org (8.11.3/8.11.4) with SMTP id g0NNqbl73179
	for <pgsql-hackers@postgreSQL.org>; Wed, 23 Jan 2002 18:52:37 -0500 (EST)
	(envelope-from wrstuden@netbsd.org)
Received: (qmail 20343 invoked by uid 1130); 23 Jan 2002 23:52:39 -0000
Date: Wed, 23 Jan 2002 15:47:55 -0800 (PST)
From: Bill Studenmund <wrstuden@netbsd.org>
X-X-Sender: <wrstuden@vespasia.home-net.internetconnect.net>
To: Stephan Szabo <sszabo@megazone23.bigpanda.com>
cc: Tom Lane <tgl@sss.pgh.pa.us>, Peter Eisentraut <peter_e@gmx.net>,
   <pgsql-hackers@postgresql.org>, Fernando Nasser <fnasser@redhat.com>
Subject: Re: [HACKERS] RFD: schemas and different kinds of Postgres objects
In-Reply-To: <20020123152711.I22382-100000@megazone23.bigpanda.com>
Message-ID: <Pine.NEB.4.33.0201231535590.7050-100000@vespasia.home-net.internetconnect.net>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR

On Wed, 23 Jan 2002, Stephan Szabo wrote:

> On Wed, 23 Jan 2002, Bill Studenmund wrote:
>
> > On Wed, 23 Jan 2002, Tom Lane wrote:
> >
> > There is a third behavior which is almost the first one. And it's the one
> > I use for function matching in the package diffs I made oh so long ago.
> > :-)
> >
> > You look in the first namespace for all candidates. If one matches, you
> > use it. If two or more match, you throw the error we throw now. If none
> > match, you move on to the next namespace and repeat the search there.
>
> That's even more strongly towards earlier namespaces than my suggestion.
> How do you define match?  If you allow coercions, then the
> plus(int8, int8) in my schema would be prefered over better (possibly
> exact) matches in the system schema which may not be what you want.

True. But:

1) How often are you going to make routines with names that duplicate
those in the system schema, when you don't want them to be used?

2) you can always explicitly refer to the system schema, so you can get
the routine you want if it's not the one you'll get by coercion.

3) We tested other (commercial) databases, and they have this behavior, so
it seems a reasonable thing to do.

4) It's simple and easy to understand.

Take care,

Bill


---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

From pgsql-hackers-owner+M18079=candle.pha.pa.us=pgman@postgresql.org Wed Jan 23 19:13:55 2002
Return-path: <pgsql-hackers-owner+M18079=candle.pha.pa.us=pgman@postgresql.org>
Received: from server1.pgsql.org (www.postgresql.org [64.49.215.9])
	by candle.pha.pa.us (8.11.6/8.10.1) with SMTP id g0O0DsU23615
	for <pgman@candle.pha.pa.us>; Wed, 23 Jan 2002 19:13:55 -0500 (EST)
Received: (qmail 79143 invoked by alias); 24 Jan 2002 00:13:37 -0000
Received: from unknown (HELO postgresql.org) (64.49.215.8)
  by www.postgresql.org with SMTP; 24 Jan 2002 00:13:37 -0000
Received: from megazone.bigpanda.com (megazone.bigpanda.com [63.150.15.178])
	by postgresql.org (8.11.3/8.11.4) with ESMTP id g0O074l78013
	for <pgsql-hackers@postgreSQL.org>; Wed, 23 Jan 2002 19:07:04 -0500 (EST)
	(envelope-from sszabo@megazone23.bigpanda.com)
Received: by megazone.bigpanda.com (Postfix, from userid 1001)
	id 7D1CFD5F7; Wed, 23 Jan 2002 16:07:07 -0800 (PST)
Received: from localhost (localhost [127.0.0.1])
	by megazone.bigpanda.com (Postfix) with ESMTP
	id 6EC505BF5; Wed, 23 Jan 2002 16:07:07 -0800 (PST)
Date: Wed, 23 Jan 2002 16:07:07 -0800 (PST)
From: Stephan Szabo <sszabo@megazone23.bigpanda.com>
To: Bill Studenmund <wrstuden@netbsd.org>
cc: Tom Lane <tgl@sss.pgh.pa.us>, Peter Eisentraut <peter_e@gmx.net>,
   <pgsql-hackers@postgresql.org>, Fernando Nasser <fnasser@redhat.com>
Subject: Re: [HACKERS] RFD: schemas and different kinds of Postgres objects
In-Reply-To: <Pine.NEB.4.33.0201231535590.7050-100000@vespasia.home-net.internetconnect.net>
Message-ID: <20020123155603.Y22713-100000@megazone23.bigpanda.com>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR

On Wed, 23 Jan 2002, Bill Studenmund wrote:

> On Wed, 23 Jan 2002, Stephan Szabo wrote:
>
> > On Wed, 23 Jan 2002, Bill Studenmund wrote:
> >
> > > On Wed, 23 Jan 2002, Tom Lane wrote:
> > >
> > > There is a third behavior which is almost the first one. And it's the one
> > > I use for function matching in the package diffs I made oh so long ago.
> > > :-)
> > >
> > > You look in the first namespace for all candidates. If one matches, you
> > > use it. If two or more match, you throw the error we throw now. If none
> > > match, you move on to the next namespace and repeat the search there.
> >
> > That's even more strongly towards earlier namespaces than my suggestion.
> > How do you define match?  If you allow coercions, then the
> > plus(int8, int8) in my schema would be prefered over better (possibly
> > exact) matches in the system schema which may not be what you want.
>
> True. But:
>
> 1) How often are you going to make routines with names that duplicate
> those in the system schema, when you don't want them to be used?

Sure, you want them used when the arguments match, but what about when
they don't exactly?
If the system schema has foo(integer) and in my schema I make a new type
and then make a type(integer) and foo(type), when I call foo(1), do I
really mean do a coersion to my type and call foo(type)?



---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org

From pgsql-hackers-owner+M18082=candle.pha.pa.us=pgman@postgresql.org Wed Jan 23 19:33:21 2002
Return-path: <pgsql-hackers-owner+M18082=candle.pha.pa.us=pgman@postgresql.org>
Received: from server1.pgsql.org (www.postgresql.org [64.49.215.9])
	by candle.pha.pa.us (8.11.6/8.10.1) with SMTP id g0O0XKU24428
	for <pgman@candle.pha.pa.us>; Wed, 23 Jan 2002 19:33:21 -0500 (EST)
Received: (qmail 85643 invoked by alias); 24 Jan 2002 00:33:19 -0000
Received: from unknown (HELO postgresql.org) (64.49.215.8)
  by www.postgresql.org with SMTP; 24 Jan 2002 00:33:19 -0000
Received: from mail.netbsd.org (mail.netbsd.org [155.53.1.253])
	by postgresql.org (8.11.3/8.11.4) with SMTP id g0O0N0l83366
	for <pgsql-hackers@postgreSQL.org>; Wed, 23 Jan 2002 19:23:00 -0500 (EST)
	(envelope-from wrstuden@netbsd.org)
Received: (qmail 24329 invoked by uid 1130); 24 Jan 2002 00:23:02 -0000
Date: Wed, 23 Jan 2002 16:18:18 -0800 (PST)
From: Bill Studenmund <wrstuden@netbsd.org>
X-X-Sender: <wrstuden@vespasia.home-net.internetconnect.net>
To: Stephan Szabo <sszabo@megazone23.bigpanda.com>
cc: Tom Lane <tgl@sss.pgh.pa.us>, Peter Eisentraut <peter_e@gmx.net>,
   <pgsql-hackers@postgresql.org>, Fernando Nasser <fnasser@redhat.com>
Subject: Re: [HACKERS] RFD: schemas and different kinds of Postgres objects
In-Reply-To: <20020123155603.Y22713-100000@megazone23.bigpanda.com>
Message-ID: <Pine.NEB.4.33.0201231606090.7050-100000@vespasia.home-net.internetconnect.net>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR

On Wed, 23 Jan 2002, Stephan Szabo wrote:

> On Wed, 23 Jan 2002, Bill Studenmund wrote:
>
> > True. But:
> >
> > 1) How often are you going to make routines with names that duplicate
> > those in the system schema, when you don't want them to be used?
>
> Sure, you want them used when the arguments match, but what about when
> they don't exactly?
> If the system schema has foo(integer) and in my schema I make a new type
> and then make a type(integer) and foo(type), when I call foo(1), do I
> really mean do a coersion to my type and call foo(type)?

Yes, you did. The documentation said that that would happen, so since you
made the call ambiguous, you wanted the coercion to happen. Or at least
you weren't concerned that it might.

Take care,

Bill


---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/users-lounge/docs/faq.html

From pgsql-hackers-owner+M18083=candle.pha.pa.us=pgman@postgresql.org Wed Jan 23 19:43:17 2002
Return-path: <pgsql-hackers-owner+M18083=candle.pha.pa.us=pgman@postgresql.org>
Received: from server1.pgsql.org (www.postgresql.org [64.49.215.9])
	by candle.pha.pa.us (8.11.6/8.10.1) with SMTP id g0O0hGU24835
	for <pgman@candle.pha.pa.us>; Wed, 23 Jan 2002 19:43:16 -0500 (EST)
Received: (qmail 88309 invoked by alias); 24 Jan 2002 00:43:14 -0000
Received: from unknown (HELO postgresql.org) (64.49.215.8)
  by www.postgresql.org with SMTP; 24 Jan 2002 00:43:14 -0000
Received: from megazone.bigpanda.com (megazone.bigpanda.com [63.150.15.178])
	by postgresql.org (8.11.3/8.11.4) with ESMTP id g0O0YUl87134
	for <pgsql-hackers@postgreSQL.org>; Wed, 23 Jan 2002 19:34:30 -0500 (EST)
	(envelope-from sszabo@megazone23.bigpanda.com)
Received: by megazone.bigpanda.com (Postfix, from userid 1001)
	id 11552D5F8; Wed, 23 Jan 2002 16:34:33 -0800 (PST)
Received: from localhost (localhost [127.0.0.1])
	by megazone.bigpanda.com (Postfix) with ESMTP
	id 050095BF5; Wed, 23 Jan 2002 16:34:33 -0800 (PST)
Date: Wed, 23 Jan 2002 16:34:32 -0800 (PST)
From: Stephan Szabo <sszabo@megazone23.bigpanda.com>
To: Bill Studenmund <wrstuden@netbsd.org>
cc: Tom Lane <tgl@sss.pgh.pa.us>, Peter Eisentraut <peter_e@gmx.net>,
   <pgsql-hackers@postgresql.org>, Fernando Nasser <fnasser@redhat.com>
Subject: Re: [HACKERS] RFD: schemas and different kinds of Postgres objects
In-Reply-To: <Pine.NEB.4.33.0201231606090.7050-100000@vespasia.home-net.internetconnect.net>
Message-ID: <20020123162426.K22713-100000@megazone23.bigpanda.com>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR

On Wed, 23 Jan 2002, Bill Studenmund wrote:

> On Wed, 23 Jan 2002, Stephan Szabo wrote:
>
> > On Wed, 23 Jan 2002, Bill Studenmund wrote:
> >
> > > True. But:
> > >
> > > 1) How often are you going to make routines with names that duplicate
> > > those in the system schema, when you don't want them to be used?
> >
> > Sure, you want them used when the arguments match, but what about when
> > they don't exactly?
> > If the system schema has foo(integer) and in my schema I make a new type
> > and then make a type(integer) and foo(type), when I call foo(1), do I
> > really mean do a coersion to my type and call foo(type)?
>
> Yes, you did. The documentation said that that would happen, so since you

It doesn't currently say anything of the sort. If we made the above
behavior the standard, it would, but that's sort of circular. ;) Unless
I'm misreading the page Tom sent me to earlier, it seems to say it
prefers matches with exact types over coercions which would no longer be
true.

> made the call ambiguous, you wanted the coercion to happen. Or at least
> you weren't concerned that it might.

I still disagree.  If I make a complex number type in my schema,
I don't really intend integer+integer to convert to complex and give me a
complex answer even if I want to be able to cast integers into complex.
AFAIK there's no way to specify that I want to make the function
complex(integer) such that I can do CAST(1 as complex) but not as an
implicit cast.


---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly

From pgsql-hackers-owner+M18084=candle.pha.pa.us=pgman@postgresql.org Wed Jan 23 20:06:02 2002
Return-path: <pgsql-hackers-owner+M18084=candle.pha.pa.us=pgman@postgresql.org>
Received: from server1.pgsql.org (www.postgresql.org [64.49.215.9])
	by candle.pha.pa.us (8.11.6/8.10.1) with SMTP id g0O161U25898
	for <pgman@candle.pha.pa.us>; Wed, 23 Jan 2002 20:06:01 -0500 (EST)
Received: (qmail 91014 invoked by alias); 24 Jan 2002 01:05:59 -0000
Received: from unknown (HELO postgresql.org) (64.49.215.8)
  by www.postgresql.org with SMTP; 24 Jan 2002 01:05:59 -0000
Received: from mail.netbsd.org (mail.netbsd.org [155.53.1.253])
	by postgresql.org (8.11.3/8.11.4) with SMTP id g0O0qTl89749
	for <pgsql-hackers@postgreSQL.org>; Wed, 23 Jan 2002 19:52:29 -0500 (EST)
	(envelope-from wrstuden@netbsd.org)
Received: (qmail 1144 invoked by uid 1130); 24 Jan 2002 00:52:32 -0000
Date: Wed, 23 Jan 2002 16:47:48 -0800 (PST)
From: Bill Studenmund <wrstuden@netbsd.org>
X-X-Sender: <wrstuden@vespasia.home-net.internetconnect.net>
To: Stephan Szabo <sszabo@megazone23.bigpanda.com>
cc: Tom Lane <tgl@sss.pgh.pa.us>, Peter Eisentraut <peter_e@gmx.net>,
   <pgsql-hackers@postgresql.org>, Fernando Nasser <fnasser@redhat.com>
Subject: Re: [HACKERS] RFD: schemas and different kinds of Postgres objects
In-Reply-To: <20020123162426.K22713-100000@megazone23.bigpanda.com>
Message-ID: <Pine.NEB.4.33.0201231636150.7050-100000@vespasia.home-net.internetconnect.net>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR

On Wed, 23 Jan 2002, Stephan Szabo wrote:

> On Wed, 23 Jan 2002, Bill Studenmund wrote:
>
> > On Wed, 23 Jan 2002, Stephan Szabo wrote:
> >
> > Yes, you did. The documentation said that that would happen, so since you
>
> It doesn't currently say anything of the sort. If we made the above
> behavior the standard, it would, but that's sort of circular. ;) Unless
> I'm misreading the page Tom sent me to earlier, it seems to say it
> prefers matches with exact types over coercions which would no longer be
> true.

The documentation says nothing about schemas at all now, so obviously it
has to change. :-)

> > made the call ambiguous, you wanted the coercion to happen. Or at least
> > you weren't concerned that it might.
>
> I still disagree.  If I make a complex number type in my schema,
> I don't really intend integer+integer to convert to complex and give me a
> complex answer even if I want to be able to cast integers into complex.
> AFAIK there's no way to specify that I want to make the function
> complex(integer) such that I can do CAST(1 as complex) but not as an
> implicit cast.

Note: I've been talking about functions, and you're talking about
operators. While operators are syntactic sugar for functions, one big
difference is that you can't specify explicit schemas for operators (nor
do I think you should be able to). I think exact matches for operators
anywhere in the path would be better than local coercable ones.

Does SQL'99 say anything about this?

Take care,

Bill


---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

From pgsql-hackers-owner+M18086=candle.pha.pa.us=pgman@postgresql.org Wed Jan 23 20:25:47 2002
Return-path: <pgsql-hackers-owner+M18086=candle.pha.pa.us=pgman@postgresql.org>
Received: from server1.pgsql.org (www.postgresql.org [64.49.215.9])
	by candle.pha.pa.us (8.11.6/8.10.1) with SMTP id g0O1PkU26965
	for <pgman@candle.pha.pa.us>; Wed, 23 Jan 2002 20:25:47 -0500 (EST)
Received: (qmail 94892 invoked by alias); 24 Jan 2002 01:25:45 -0000
Received: from unknown (HELO postgresql.org) (64.49.215.8)
  by www.postgresql.org with SMTP; 24 Jan 2002 01:25:45 -0000
Received: from megazone.bigpanda.com (megazone.bigpanda.com [63.150.15.178])
	by postgresql.org (8.11.3/8.11.4) with ESMTP id g0O1MNl94162
	for <pgsql-hackers@postgreSQL.org>; Wed, 23 Jan 2002 20:22:24 -0500 (EST)
	(envelope-from sszabo@megazone23.bigpanda.com)
Received: by megazone.bigpanda.com (Postfix, from userid 1001)
	id 5B37BD5F7; Wed, 23 Jan 2002 17:22:26 -0800 (PST)
Received: from localhost (localhost [127.0.0.1])
	by megazone.bigpanda.com (Postfix) with ESMTP
	id 50EA45BF5; Wed, 23 Jan 2002 17:22:26 -0800 (PST)
Date: Wed, 23 Jan 2002 17:22:26 -0800 (PST)
From: Stephan Szabo <sszabo@megazone23.bigpanda.com>
To: Bill Studenmund <wrstuden@netbsd.org>
cc: Tom Lane <tgl@sss.pgh.pa.us>, Peter Eisentraut <peter_e@gmx.net>,
   <pgsql-hackers@postgresql.org>, Fernando Nasser <fnasser@redhat.com>
Subject: Re: [HACKERS] RFD: schemas and different kinds of Postgres objects
In-Reply-To: <Pine.NEB.4.33.0201231636150.7050-100000@vespasia.home-net.internetconnect.net>
Message-ID: <20020123165321.K23306-100000@megazone23.bigpanda.com>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR

On Wed, 23 Jan 2002, Bill Studenmund wrote:

What I was getting at was that Tom's behavior (or even mine) is more
similar to the currently described behavior than the suggested one.

> > > made the call ambiguous, you wanted the coercion to happen. Or at least
> > > you weren't concerned that it might.
> >
> > I still disagree.  If I make a complex number type in my schema,
> > I don't really intend integer+integer to convert to complex and give me a
> > complex answer even if I want to be able to cast integers into complex.
> > AFAIK there's no way to specify that I want to make the function
> > complex(integer) such that I can do CAST(1 as complex) but not as an
> > implicit cast.
>
> Note: I've been talking about functions, and you're talking about
> operators. While operators are syntactic sugar for functions, one big
> difference is that you can't specify explicit schemas for operators (nor
> do I think you should be able to). I think exact matches for operators
> anywhere in the path would be better than local coercable ones.

I'd say the same thing for a random math function as well.  For example
if there was a square(int) that returned $1*$1 and I made a square for my
complex type, I'd still expect that square(5) is an integer rather than a
complex using the square(complex).  For example, I'd expect square(5) to
be a valid length argument to substr.

> Does SQL'99 say anything about this?
That I don't know about (don't have a draft around to look at).  I'm not
sure that it'd have these problems though unless it's got the same sort of
coercion system.


---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

From pgsql-hackers-owner+M18095=candle.pha.pa.us=pgman@postgresql.org Thu Jan 24 00:43:04 2002
Return-path: <pgsql-hackers-owner+M18095=candle.pha.pa.us=pgman@postgresql.org>
Received: from server1.pgsql.org (www.postgresql.org [64.49.215.9])
	by candle.pha.pa.us (8.11.6/8.10.1) with SMTP id g0O5h4U15469
	for <pgman@candle.pha.pa.us>; Thu, 24 Jan 2002 00:43:04 -0500 (EST)
Received: (qmail 28221 invoked by alias); 24 Jan 2002 05:43:00 -0000
Received: from unknown (HELO postgresql.org) (64.49.215.8)
  by www.postgresql.org with SMTP; 24 Jan 2002 05:43:00 -0000
Received: from student.gvsu.edu ([148.61.7.124])
	by postgresql.org (8.11.3/8.11.4) with ESMTP id g0O5QCl26727
	for <pgsql-hackers@postgreSQL.org>; Thu, 24 Jan 2002 00:26:13 -0500 (EST)
	(envelope-from peter_e@gmx.net)
Received: from [148.61.250.90] [148.61.250.90] by student.gvsu.edu
	with Novonyx SMTP Server $Revision: 1.3 $; Thu, 24 Jan 2002 00:26:11 -0500 (EDT)
Date: Thu, 24 Jan 2002 00:28:16 -0500 (EST)
From: Peter Eisentraut <peter_e@gmx.net>
X-Sender: <peter@peter.localdomain>
To: Bill Studenmund <wrstuden@netbsd.org>
cc: Stephan Szabo <sszabo@megazone23.bigpanda.com>,
   Tom Lane <tgl@sss.pgh.pa.us>,
   PostgreSQL Development <pgsql-hackers@postgresql.org>,
   Fernando Nasser <fnasser@redhat.com>
Subject: Re: [HACKERS] RFD: schemas and different kinds of Postgres objects
In-Reply-To: <Pine.NEB.4.33.0201231636150.7050-100000@vespasia.home-net.internetconnect.net>
Message-ID: <Pine.LNX.4.30.0201240003120.686-100000@peter.localdomain>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR

Bill Studenmund writes:

> Does SQL'99 say anything about this?

Yes, though, as usual, you have to twist your brain a little to understand
it.  My understanding is that for a function call of the form "foo(a, b)"
it goes like this:

1. Find all functions named "foo" in the current database.  This is the
set of "possibly candidate routines".

2. Drop all routines that you do not have EXECUTE privilege for.  This is
the set of "executable routines".

3. Drop all routines that do not have compatible parameter lists.  This is
the set of "invocable routines".

4. Drop all routines whose schema is not in the path.  This is the set of
"candidate routines".

5. If you have more than one routine left, eliminate some routines
according to type precedence rules.  (We do some form of this, SQL99
specifies something different.)  This yields the set of "candidate subject
routines".

6. Choose the routine whose schema is earliest in the path as the "subject
routine".

Execute the subject routine.  Phew!


This doesn't look glaringly wrong to me, so maybe you want to consider it.
Please note step 2.

-- 
Peter Eisentraut   peter_e@gmx.net


---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

From pgsql-hackers-owner+M18127=candle.pha.pa.us=pgman@postgresql.org Thu Jan 24 14:53:53 2002
Return-path: <pgsql-hackers-owner+M18127=candle.pha.pa.us=pgman@postgresql.org>
Received: from server1.pgsql.org (www.postgresql.org [64.49.215.9])
	by candle.pha.pa.us (8.11.6/8.10.1) with SMTP id g0OJrqU16554
	for <pgman@candle.pha.pa.us>; Thu, 24 Jan 2002 14:53:52 -0500 (EST)
Received: (qmail 59340 invoked by alias); 24 Jan 2002 19:53:33 -0000
Received: from unknown (HELO postgresql.org) (64.49.215.8)
  by www.postgresql.org with SMTP; 24 Jan 2002 19:53:33 -0000
Received: from mail.netbsd.org (mail.netbsd.org [155.53.1.253])
	by postgresql.org (8.11.3/8.11.4) with SMTP id g0OJprl58616
	for <pgsql-hackers@postgreSQL.org>; Thu, 24 Jan 2002 14:51:53 -0500 (EST)
	(envelope-from wrstuden@netbsd.org)
Received: (qmail 22083 invoked by uid 1130); 24 Jan 2002 19:51:54 -0000
Date: Thu, 24 Jan 2002 11:47:07 -0800 (PST)
From: Bill Studenmund <wrstuden@netbsd.org>
X-X-Sender: <wrstuden@vespasia.home-net.internetconnect.net>
To: Stephan Szabo <sszabo@megazone23.bigpanda.com>
cc: Tom Lane <tgl@sss.pgh.pa.us>, Peter Eisentraut <peter_e@gmx.net>,
   <pgsql-hackers@postgresql.org>, Fernando Nasser <fnasser@redhat.com>
Subject: Re: [HACKERS] RFD: schemas and different kinds of Postgres objects
In-Reply-To: <20020123165321.K23306-100000@megazone23.bigpanda.com>
Message-ID: <Pine.NEB.4.33.0201241138130.9384-100000@vespasia.home-net.internetconnect.net>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR

On Wed, 23 Jan 2002, Stephan Szabo wrote:

> On Wed, 23 Jan 2002, Bill Studenmund wrote:
>
> What I was getting at was that Tom's behavior (or even mine) is more
> similar to the currently described behavior than the suggested one.

I understand. As part of developing the package changes, though, I found
that Oracle used the method I described for finding routines in packages.

>From Peter's description, it sounds like Oracle's not following the spec.

> I'd say the same thing for a random math function as well.  For example
> if there was a square(int) that returned $1*$1 and I made a square for my
> complex type, I'd still expect that square(5) is an integer rather than a
> complex using the square(complex).  For example, I'd expect square(5) to
> be a valid length argument to substr.

Yeah, that makes sense.

> > Does SQL'99 say anything about this?
> That I don't know about (don't have a draft around to look at).  I'm not

Do you want pdfs?

> sure that it'd have these problems though unless it's got the same sort of
> coercion system.

I don't think it has the same sort of coercion, but it has some, I'd
expect (as all of the DBs I know of have some sort of coercion :-)

Take care,

Bill


---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org

From pgsql-hackers-owner+M18128=candle.pha.pa.us=pgman@postgresql.org Thu Jan 24 15:04:41 2002
Return-path: <pgsql-hackers-owner+M18128=candle.pha.pa.us=pgman@postgresql.org>
Received: from server1.pgsql.org (www.postgresql.org [64.49.215.9])
	by candle.pha.pa.us (8.11.6/8.10.1) with SMTP id g0OK4eU18207
	for <pgman@candle.pha.pa.us>; Thu, 24 Jan 2002 15:04:40 -0500 (EST)
Received: (qmail 65543 invoked by alias); 24 Jan 2002 20:03:53 -0000
Received: from unknown (HELO postgresql.org) (64.49.215.8)
  by www.postgresql.org with SMTP; 24 Jan 2002 20:03:53 -0000
Received: from mail.netbsd.org (mail.netbsd.org [155.53.1.253])
	by postgresql.org (8.11.3/8.11.4) with SMTP id g0OJsul61073
	for <pgsql-hackers@postgreSQL.org>; Thu, 24 Jan 2002 14:54:57 -0500 (EST)
	(envelope-from wrstuden@netbsd.org)
Received: (qmail 23026 invoked by uid 1130); 24 Jan 2002 19:54:57 -0000
Date: Thu, 24 Jan 2002 11:50:12 -0800 (PST)
From: Bill Studenmund <wrstuden@netbsd.org>
X-X-Sender: <wrstuden@vespasia.home-net.internetconnect.net>
To: Peter Eisentraut <peter_e@gmx.net>
cc: Stephan Szabo <sszabo@megazone23.bigpanda.com>,
   Tom Lane <tgl@sss.pgh.pa.us>,
   PostgreSQL Development <pgsql-hackers@postgresql.org>,
   Fernando Nasser <fnasser@redhat.com>
Subject: Re: [HACKERS] RFD: schemas and different kinds of Postgres objects
In-Reply-To: <Pine.LNX.4.30.0201240003120.686-100000@peter.localdomain>
Message-ID: <Pine.NEB.4.33.0201241147131.9384-100000@vespasia.home-net.internetconnect.net>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR

On Thu, 24 Jan 2002, Peter Eisentraut wrote:

> Bill Studenmund writes:
>
> > Does SQL'99 say anything about this?
>
> Yes, though, as usual, you have to twist your brain a little to understand
> it.

Indeed. I find the spec makes the most sense after you understand it. ;-)

>      My understanding is that for a function call of the form "foo(a, b)"
> it goes like this:
>
> 1. Find all functions named "foo" in the current database.  This is the
> set of "possibly candidate routines".
>
> 2. Drop all routines that you do not have EXECUTE privilege for.  This is
> the set of "executable routines".
>
> 3. Drop all routines that do not have compatible parameter lists.  This is
> the set of "invocable routines".
>
> 4. Drop all routines whose schema is not in the path.  This is the set of
> "candidate routines".
>
> 5. If you have more than one routine left, eliminate some routines
> according to type precedence rules.  (We do some form of this, SQL99
> specifies something different.)  This yields the set of "candidate subject
> routines".
>
> 6. Choose the routine whose schema is earliest in the path as the "subject
> routine".
>
> Execute the subject routine.  Phew!

Wow. Thanks for diging this out.

> This doesn't look glaringly wrong to me, so maybe you want to consider it.
> Please note step 2.

It looks fine, and is probably what we should do. Well, I'd do things in a
different order (look only in in-path schemas first for instance), but
that's just trying to optimize the query. :-)

How different are the type coercion rules?

Take care,

Bill


---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

From pgsql-hackers-owner+M18156=candle.pha.pa.us=pgman@postgresql.org Thu Jan 24 22:45:56 2002
Return-path: <pgsql-hackers-owner+M18156=candle.pha.pa.us=pgman@postgresql.org>
Received: from server1.pgsql.org (www.postgresql.org [64.49.215.9])
	by candle.pha.pa.us (8.11.6/8.10.1) with SMTP id g0P3jte02265
	for <pgman@candle.pha.pa.us>; Thu, 24 Jan 2002 22:45:55 -0500 (EST)
Received: (qmail 95096 invoked by alias); 25 Jan 2002 03:45:50 -0000
Received: from unknown (HELO postgresql.org) (64.49.215.8)
  by www.postgresql.org with SMTP; 25 Jan 2002 03:45:50 -0000
Received: from candle.pha.pa.us (216-55-132-35.dsl.san-diego.abac.net [216.55.132.35])
	by postgresql.org (8.11.3/8.11.4) with ESMTP id g0P3NWl91448
	for <pgsql-hackers@postgresql.org>; Thu, 24 Jan 2002 22:23:33 -0500 (EST)
	(envelope-from pgman@candle.pha.pa.us)
Received: (from pgman@localhost)
	by candle.pha.pa.us (8.11.6/8.10.1) id g0P3NMY22893;
	Thu, 24 Jan 2002 22:23:22 -0500 (EST)
From: Bruce Momjian <pgman@candle.pha.pa.us>
Message-ID: <200201250323.g0P3NMY22893@candle.pha.pa.us>
Subject: Re: [HACKERS] RFD: schemas and different kinds of Postgres objects
In-Reply-To: <2677.1011800674@sss.pgh.pa.us>
To: Tom Lane <tgl@sss.pgh.pa.us>
Date: Thu, 24 Jan 2002 22:23:22 -0500 (EST)
cc: Zeugswetter Andreas SB SD <ZeugswetterA@spardat.at>,
   Fernando Nasser <fnasser@redhat.com>, Peter Eisentraut <peter_e@gmx.net>,
   pgsql-hackers@postgresql.org
X-Mailer: ELM [version 2.4ME+ PL96 (25)]
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset=US-ASCII
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR

Tom Lane wrote:
> "Zeugswetter Andreas SB SD" <ZeugswetterA@spardat.at> writes:
> > When configured for historical behavior would need to:
> > 1. have search path: temp, any, system
> > 2. guard against duplicate table names across all schemas (except temp schema)
> 
> This would be a *whole* lot simpler if we forgot the notion of "any"
> and made the search order look like
> 
> 	(temp, private, public, system)
> 
> where the public namespace is world-writable but the private per-user
> ones are (typically at least) not.

[ I am just reading this schema thread now.]

The above private/public idea seems like a much better than 'any'.  That
'any' thing had me quite confused and the idea thought you would have
duplicates that would only be found at runtime seems destined to random
falures.

I assume 'private' above means search in my personal schema/namespace.

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

From pgsql-hackers-owner+M18157=candle.pha.pa.us=pgman@postgresql.org Thu Jan 24 22:45:56 2002
Return-path: <pgsql-hackers-owner+M18157=candle.pha.pa.us=pgman@postgresql.org>
Received: from server1.pgsql.org (www.postgresql.org [64.49.215.9])
	by candle.pha.pa.us (8.11.6/8.10.1) with SMTP id g0P3jte02266
	for <pgman@candle.pha.pa.us>; Thu, 24 Jan 2002 22:45:55 -0500 (EST)
Received: (qmail 95098 invoked by alias); 25 Jan 2002 03:45:50 -0000
Received: from unknown (HELO postgresql.org) (64.49.215.8)
  by www.postgresql.org with SMTP; 25 Jan 2002 03:45:50 -0000
Received: from candle.pha.pa.us (216-55-132-35.dsl.san-diego.abac.net [216.55.132.35])
	by postgresql.org (8.11.3/8.11.4) with ESMTP id g0P3Qql91635
	for <pgsql-hackers@postgresql.org>; Thu, 24 Jan 2002 22:26:52 -0500 (EST)
	(envelope-from pgman@candle.pha.pa.us)
Received: (from pgman@localhost)
	by candle.pha.pa.us (8.11.6/8.10.1) id g0P3Qhw23061;
	Thu, 24 Jan 2002 22:26:43 -0500 (EST)
From: Bruce Momjian <pgman@candle.pha.pa.us>
Message-ID: <200201250326.g0P3Qhw23061@candle.pha.pa.us>
Subject: Re: [HACKERS] RFD: schemas and different kinds of Postgres objects
In-Reply-To: <2677.1011800674@sss.pgh.pa.us>
To: Tom Lane <tgl@sss.pgh.pa.us>
Date: Thu, 24 Jan 2002 22:26:43 -0500 (EST)
cc: Zeugswetter Andreas SB SD <ZeugswetterA@spardat.at>,
   Fernando Nasser <fnasser@redhat.com>, Peter Eisentraut <peter_e@gmx.net>,
   pgsql-hackers@postgresql.org
X-Mailer: ELM [version 2.4ME+ PL96 (25)]
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset=US-ASCII
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR

> > Or are you thinking about a per session behavior ?
> > I would rather envision a per database behavior.
> > Maybe the easy way out would be a "default creation schema" property for 
> > each user, that would default to the username. If you want everything in one 
> > schema simply alter the users.
> 
> I hadn't really gotten to the point of thinking about exactly what and
> where the control knobs should be.  I suspect you are right that we will
> want the default behavior to be selectable on a per-user or per-database
> basis, which seems to eliminate the option of using GUC (at least in its
> current form).  We could easily add a field to pg_shadow or pg_database
> respectively to determine the default behavior.  It'd be nice though if
> the behavior could be changed after connection by a SET statement, which
> would be lots easier if the setting were GUC-controlled.  Peter, you see
> any way to resolve that?

I think we could set the database default at db creation time, then
allow SET to modify that default per session;  seems flexible enough. 
It is basically a GUC value who's default is stored in pg_database
rather than postgresql.conf.   You could use postgresql.conf to set the
default schema type at db creation time.

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

From pgsql-hackers-owner+M18158=candle.pha.pa.us=pgman@postgresql.org Thu Jan 24 23:03:48 2002
Return-path: <pgsql-hackers-owner+M18158=candle.pha.pa.us=pgman@postgresql.org>
Received: from server1.pgsql.org (www.postgresql.org [64.49.215.9])
	by candle.pha.pa.us (8.11.6/8.10.1) with SMTP id g0P43le13410
	for <pgman@candle.pha.pa.us>; Thu, 24 Jan 2002 23:03:47 -0500 (EST)
Received: (qmail 97941 invoked by alias); 25 Jan 2002 04:03:42 -0000
Received: from unknown (HELO postgresql.org) (64.49.215.8)
  by www.postgresql.org with SMTP; 25 Jan 2002 04:03:42 -0000
Received: from student.gvsu.edu ([148.61.7.124])
	by postgresql.org (8.11.3/8.11.4) with ESMTP id g0P3wjl97273
	for <pgsql-hackers@postgresql.org>; Thu, 24 Jan 2002 22:58:46 -0500 (EST)
	(envelope-from peter_e@gmx.net)
Received: from [148.61.250.128] [148.61.250.128] by student.gvsu.edu
	with Novonyx SMTP Server $Revision: 1.3 $; Thu, 24 Jan 2002 22:58:51 -0500 (EDT)
Date: Thu, 24 Jan 2002 23:00:57 -0500 (EST)
From: Peter Eisentraut <peter_e@gmx.net>
X-Sender: <peter@peter.localdomain>
To: Tom Lane <tgl@sss.pgh.pa.us>
cc: Zeugswetter Andreas SB SD <ZeugswetterA@spardat.at>,
   Fernando Nasser <fnasser@redhat.com>, <pgsql-hackers@postgresql.org>
Subject: Re: [HACKERS] RFD: schemas and different kinds of Postgres objects
In-Reply-To: <2677.1011800674@sss.pgh.pa.us>
Message-ID: <Pine.LNX.4.30.0201242259280.686-100000@peter.localdomain>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: ORr

Tom Lane writes:

> It'd be nice though if
> the behavior could be changed after connection by a SET statement, which
> would be lots easier if the setting were GUC-controlled.  Peter, you see
> any way to resolve that?

We had a text[] field to pg_shadow and/or pg_database containing
name=value assignments which are executed just before the session starts.
Doesn't look terribly difficult, and it's something I've always wanted to
do anyway.

-- 
Peter Eisentraut   peter_e@gmx.net


---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

From pgsql-hackers-owner+M18160=candle.pha.pa.us=pgman@postgresql.org Thu Jan 24 23:45:22 2002
Return-path: <pgsql-hackers-owner+M18160=candle.pha.pa.us=pgman@postgresql.org>
Received: from server1.pgsql.org (www.postgresql.org [64.49.215.9])
	by candle.pha.pa.us (8.11.6/8.10.1) with SMTP id g0P4jLe11106
	for <pgman@candle.pha.pa.us>; Thu, 24 Jan 2002 23:45:21 -0500 (EST)
Received: (qmail 3520 invoked by alias); 25 Jan 2002 04:43:35 -0000
Received: from unknown (HELO postgresql.org) (64.49.215.8)
  by www.postgresql.org with SMTP; 25 Jan 2002 04:43:35 -0000
Received: from sss.pgh.pa.us ([192.204.191.242])
	by postgresql.org (8.11.3/8.11.4) with ESMTP id g0P4OAl00294
	for <pgsql-hackers@postgresql.org>; Thu, 24 Jan 2002 23:24:11 -0500 (EST)
	(envelope-from tgl@sss.pgh.pa.us)
Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1])
	by sss.pgh.pa.us (8.11.4/8.11.4) with ESMTP id g0P4Nef23267;
	Thu, 24 Jan 2002 23:23:40 -0500 (EST)
To: Peter Eisentraut <peter_e@gmx.net>
cc: Zeugswetter Andreas SB SD <ZeugswetterA@spardat.at>,
   Fernando Nasser <fnasser@redhat.com>, pgsql-hackers@postgresql.org
Subject: Re: [HACKERS] RFD: schemas and different kinds of Postgres objects 
In-Reply-To: <Pine.LNX.4.30.0201242259280.686-100000@peter.localdomain> 
References: <Pine.LNX.4.30.0201242259280.686-100000@peter.localdomain>
Comments: In-reply-to Peter Eisentraut <peter_e@gmx.net>
	message dated "Thu, 24 Jan 2002 23:00:57 -0500"
Date: Thu, 24 Jan 2002 23:23:39 -0500
Message-ID: <23264.1011932619@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR

Peter Eisentraut <peter_e@gmx.net> writes:
> We [add] a text[] field to pg_shadow and/or pg_database containing
> name=value assignments which are executed just before the session starts.
> Doesn't look terribly difficult, and it's something I've always wanted to
> do anyway.

Seems like a fine idea, with many uses besides this one.

			regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly

From pgsql-hackers-owner+M18159=candle.pha.pa.us=pgman@postgresql.org Thu Jan 24 23:33:32 2002
Return-path: <pgsql-hackers-owner+M18159=candle.pha.pa.us=pgman@postgresql.org>
Received: from server1.pgsql.org (www.postgresql.org [64.49.215.9])
	by candle.pha.pa.us (8.11.6/8.10.1) with SMTP id g0P4XVe10435
	for <pgman@candle.pha.pa.us>; Thu, 24 Jan 2002 23:33:31 -0500 (EST)
Received: (qmail 1069 invoked by alias); 25 Jan 2002 04:33:26 -0000
Received: from unknown (HELO postgresql.org) (64.49.215.8)
  by www.postgresql.org with SMTP; 25 Jan 2002 04:33:26 -0000
Received: from linuxworld.com.au (www.linuxworld.com.au [203.34.46.50])
	by postgresql.org (8.11.3/8.11.4) with ESMTP id g0P4Pal00372
	for <pgsql-hackers@postgresql.org>; Thu, 24 Jan 2002 23:25:36 -0500 (EST)
	(envelope-from swm@linuxworld.com.au)
Received: from localhost (swm@localhost)
	by linuxworld.com.au (8.11.4/8.11.4) with ESMTP id g0P4P5Z12976;
	Fri, 25 Jan 2002 15:25:05 +1100
Date: Fri, 25 Jan 2002 15:25:05 +1100 (EST)
From: Gavin Sherry <swm@linuxworld.com.au>
To: Tom Lane <tgl@sss.pgh.pa.us>
cc: Bill Studenmund <wrstuden@netbsd.org>, pgsql-hackers@postgresql.org
Subject: Re: [HACKERS] RFD: schemas and different kinds of Postgres objects
In-Reply-To: <8533.1011819436@sss.pgh.pa.us>
Message-ID: <Pine.LNX.4.21.0201251517350.12632-100000@linuxworld.com.au>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR

On Wed, 23 Jan 2002, Tom Lane wrote:

> If you use only the SQL-defined operations, after setting up any
> configuration variables we may invent in the way we will document as
> necessary for SQL-compatible behavior, then you will get SQL-compatible
> behavior.  I do not think that precludes having an underlying
> implementation that sees the world differently than SQL does and
> supports non-SQL behaviors too.  (For that matter, I'm sure there is
> text somewhere in the spec that points out that the spec intends to
> define user-visible behavior, not implementation.)

This makes a lot of sense and suggests the possibility of 'schema enabled'
databases. That is, a switch 'bool withschemas' (which defaults to
false) could be added to pg_database. If true, the parser and ownership
model reflects that of SQL'99 and/or the Postgres schema model. If false,
the existing 'schema' model is assumed.

This should allow existing users to migrate their data and applications to
7.3 without having to modify either.

Its not an ideal solution but backward compatibility is generally results
in compromise ;).

Gavin


---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

From pgsql-hackers-owner+M18164=candle.pha.pa.us=pgman@postgresql.org Thu Jan 24 23:45:36 2002
Return-path: <pgsql-hackers-owner+M18164=candle.pha.pa.us=pgman@postgresql.org>
Received: from server1.pgsql.org (www.postgresql.org [64.49.215.9])
	by candle.pha.pa.us (8.11.6/8.10.1) with SMTP id g0P4jae11220
	for <pgman@candle.pha.pa.us>; Thu, 24 Jan 2002 23:45:36 -0500 (EST)
Received: (qmail 4119 invoked by alias); 25 Jan 2002 04:43:57 -0000
Received: from unknown (HELO postgresql.org) (64.49.215.8)
  by www.postgresql.org with SMTP; 25 Jan 2002 04:43:57 -0000
Received: from candle.pha.pa.us (216-55-132-35.dsl.san-diego.abac.net [216.55.132.35])
	by postgresql.org (8.11.3/8.11.4) with ESMTP id g0P4Y0l01902
	for <pgsql-hackers@postgresql.org>; Thu, 24 Jan 2002 23:34:00 -0500 (EST)
	(envelope-from pgman@candle.pha.pa.us)
Received: (from pgman@localhost)
	by candle.pha.pa.us (8.11.6/8.10.1) id g0P4XqD10470;
	Thu, 24 Jan 2002 23:33:52 -0500 (EST)
From: Bruce Momjian <pgman@candle.pha.pa.us>
Message-ID: <200201250433.g0P4XqD10470@candle.pha.pa.us>
Subject: Re: [HACKERS] RFD: schemas and different kinds of Postgres objects
In-Reply-To: <Pine.LNX.4.30.0201242259280.686-100000@peter.localdomain>
To: Peter Eisentraut <peter_e@gmx.net>
Date: Thu, 24 Jan 2002 23:33:52 -0500 (EST)
cc: Tom Lane <tgl@sss.pgh.pa.us>,
   Zeugswetter Andreas SB SD <ZeugswetterA@spardat.at>,
   Fernando Nasser <fnasser@redhat.com>, pgsql-hackers@postgresql.org
X-Mailer: ELM [version 2.4ME+ PL96 (25)]
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset=US-ASCII
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR

Peter Eisentraut wrote:
> Tom Lane writes:
> 
> > It'd be nice though if
> > the behavior could be changed after connection by a SET statement, which
> > would be lots easier if the setting were GUC-controlled.  Peter, you see
> > any way to resolve that?
> 
> We had a text[] field to pg_shadow and/or pg_database containing
> name=value assignments which are executed just before the session starts.
> Doesn't look terribly difficult, and it's something I've always wanted to
> do anyway.

So are thinking of "dbname=schema_type"?  Seems this is really something
that should be in pg_database.  If you create a database, who wants to
edit postgresql.conf to set its default schema type?  Why not set the
GUC value from pg_database?

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/users-lounge/docs/faq.html

From pgsql-hackers-owner+M18165=candle.pha.pa.us=pgman@postgresql.org Fri Jan 25 00:33:36 2002
Return-path: <pgsql-hackers-owner+M18165=candle.pha.pa.us=pgman@postgresql.org>
Received: from server1.pgsql.org (www.postgresql.org [64.49.215.9])
	by candle.pha.pa.us (8.11.6/8.10.1) with SMTP id g0P5XZe14335
	for <pgman@candle.pha.pa.us>; Fri, 25 Jan 2002 00:33:36 -0500 (EST)
Received: (qmail 15579 invoked by alias); 25 Jan 2002 05:33:30 -0000
Received: from unknown (HELO postgresql.org) (64.49.215.8)
  by www.postgresql.org with SMTP; 25 Jan 2002 05:33:30 -0000
Received: from student.gvsu.edu ([148.61.7.124])
	by postgresql.org (8.11.3/8.11.4) with ESMTP id g0P5Oul14811
	for <pgsql-hackers@postgreSQL.org>; Fri, 25 Jan 2002 00:24:56 -0500 (EST)
	(envelope-from peter_e@gmx.net)
Received: from [148.61.250.128] [148.61.250.128] by student.gvsu.edu
	with Novonyx SMTP Server $Revision: 1.3 $; Fri, 25 Jan 2002 00:25:01 -0500 (EDT)
Date: Fri, 25 Jan 2002 00:27:07 -0500 (EST)
From: Peter Eisentraut <peter_e@gmx.net>
X-Sender: <peter@peter.localdomain>
To: Tom Lane <tgl@sss.pgh.pa.us>
cc: Bill Studenmund <wrstuden@netbsd.org>, <pgsql-hackers@postgresql.org>
Subject: Re: [HACKERS] RFD: schemas and different kinds of Postgres objects
In-Reply-To: <8842.1011822361@sss.pgh.pa.us>
Message-ID: <Pine.LNX.4.30.0201250013040.686-100000@peter.localdomain>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR

Tom Lane writes:

> There could be multiple valid interpretations.  When you can't even
> figure out where to start, it's too squishy for me.  Code complexity
> isn't really the issue here, it's whether a user can understand what's
> going on.

Here's a tricky question:  In what situations is a.b valid to mean b(a)?
Because in a general object-like system you could write a.b.c.d to mean
d(c(b(a))).  There you've got a system where it's really impossible to
tell anything.  Maybe b() returns a table, so a.b.c.d could mean
subattribute d in column c in the table returned by b(a).

Somehow we need to do at least one of three things:
1. Require parentheses after function calls.
2. Use a different operator to invoke function calls (SQL uses ->).
3. Require users to register functions as "methods" with the data type
before being able to say a.b for b(a).  This also takes care of having to
specify the schema of b because that's declared when you define the
method.

SQL99 does 2 and 3 (but not 1).

I say, forget Oracle.  Oracle doesn't have all the extensibility
functionality that PostgreSQL has.  Let's build a system that is
consistent, orthogonal, and easy to use for *our* users, and those that
want to convert will quickly see the value.

-- 
Peter Eisentraut   peter_e@gmx.net


---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

From pgsql-hackers-owner+M18166=candle.pha.pa.us=pgman@postgresql.org Fri Jan 25 00:43:38 2002
Return-path: <pgsql-hackers-owner+M18166=candle.pha.pa.us=pgman@postgresql.org>
Received: from server1.pgsql.org (www.postgresql.org [64.49.215.9])
	by candle.pha.pa.us (8.11.6/8.10.1) with SMTP id g0P5hce15000
	for <pgman@candle.pha.pa.us>; Fri, 25 Jan 2002 00:43:38 -0500 (EST)
Received: (qmail 18028 invoked by alias); 25 Jan 2002 05:43:28 -0000
Received: from unknown (HELO postgresql.org) (64.49.215.8)
  by www.postgresql.org with SMTP; 25 Jan 2002 05:43:28 -0000
Received: from sss.pgh.pa.us ([192.204.191.242])
	by postgresql.org (8.11.3/8.11.4) with ESMTP id g0P5eol16732
	for <pgsql-hackers@postgreSQL.org>; Fri, 25 Jan 2002 00:40:50 -0500 (EST)
	(envelope-from tgl@sss.pgh.pa.us)
Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1])
	by sss.pgh.pa.us (8.11.4/8.11.4) with ESMTP id g0P5eIf23724;
	Fri, 25 Jan 2002 00:40:18 -0500 (EST)
To: Peter Eisentraut <peter_e@gmx.net>
cc: Bill Studenmund <wrstuden@netbsd.org>, pgsql-hackers@postgresql.org
Subject: Re: [HACKERS] RFD: schemas and different kinds of Postgres objects 
In-Reply-To: <Pine.LNX.4.30.0201250013040.686-100000@peter.localdomain> 
References: <Pine.LNX.4.30.0201250013040.686-100000@peter.localdomain>
Comments: In-reply-to Peter Eisentraut <peter_e@gmx.net>
	message dated "Fri, 25 Jan 2002 00:27:07 -0500"
Date: Fri, 25 Jan 2002 00:40:18 -0500
Message-ID: <23721.1011937218@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR

Peter Eisentraut <peter_e@gmx.net> writes:
> Here's a tricky question:  In what situations is a.b valid to mean b(a)?

I defined that in my first message on these issues: the last element
of a dotted-name string can be either a field name or a function
(which is applied to a table that's the next-to-last item).  The
next-to-last element is always a table name.

> Because in a general object-like system you could write a.b.c.d to mean
> d(c(b(a))).

Indeed, that can happen now in Postgres, and as I pointed out we have
to get rid of it.  That doesn't mean we need to eliminate the base case,
however.

> Somehow we need to do at least one of three things:
> 1. Require parentheses after function calls.

Breaks existing code unnecessarily.

> 2. Use a different operator to invoke function calls (SQL uses ->).

Breaks existing code unnecessarily.

> 3. Require users to register functions as "methods" with the data type
> before being able to say a.b for b(a).  This also takes care of having to
> specify the schema of b because that's declared when you define the
> method.

Doesn't buy you anything unless you intend to reject function
overloading too.  With overloading you may have multiple functions
b(something), so you still have to be able to determine what a is
without any context.

			regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly

From pgsql-hackers-owner+M18168=candle.pha.pa.us=pgman@postgresql.org Fri Jan 25 01:13:24 2002
Return-path: <pgsql-hackers-owner+M18168=candle.pha.pa.us=pgman@postgresql.org>
Received: from server1.pgsql.org (www.postgresql.org [64.49.215.9])
	by candle.pha.pa.us (8.11.6/8.10.1) with SMTP id g0P6DNe17080
	for <pgman@candle.pha.pa.us>; Fri, 25 Jan 2002 01:13:23 -0500 (EST)
Received: (qmail 22750 invoked by alias); 25 Jan 2002 06:13:23 -0000
Received: from unknown (HELO postgresql.org) (64.49.215.8)
  by www.postgresql.org with SMTP; 25 Jan 2002 06:13:23 -0000
Received: from candle.pha.pa.us (216-55-132-35.dsl.san-diego.abac.net [216.55.132.35])
	by postgresql.org (8.11.3/8.11.4) with ESMTP id g0P5tdl21299
	for <pgsql-hackers@postgresql.org>; Fri, 25 Jan 2002 00:55:39 -0500 (EST)
	(envelope-from pgman@candle.pha.pa.us)
Received: (from pgman@localhost)
	by candle.pha.pa.us (8.11.6/8.10.1) id g0P5tWY15824;
	Fri, 25 Jan 2002 00:55:32 -0500 (EST)
From: Bruce Momjian <pgman@candle.pha.pa.us>
Message-ID: <200201250555.g0P5tWY15824@candle.pha.pa.us>
Subject: Re: [HACKERS] RFD: schemas and different kinds of Postgres objects
In-Reply-To: <Pine.LNX.4.30.0201242259280.686-100000@peter.localdomain>
To: Peter Eisentraut <peter_e@gmx.net>
Date: Fri, 25 Jan 2002 00:55:32 -0500 (EST)
cc: Tom Lane <tgl@sss.pgh.pa.us>,
   Zeugswetter Andreas SB SD <ZeugswetterA@spardat.at>,
   Fernando Nasser <fnasser@redhat.com>, pgsql-hackers@postgresql.org
X-Mailer: ELM [version 2.4ME+ PL96 (25)]
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset=US-ASCII
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR

Peter Eisentraut wrote:
> Tom Lane writes:
> 
> > It'd be nice though if
> > the behavior could be changed after connection by a SET statement, which
> > would be lots easier if the setting were GUC-controlled.  Peter, you see
> > any way to resolve that?
> 
> We had a text[] field to pg_shadow and/or pg_database containing
> name=value assignments which are executed just before the session starts.
> Doesn't look terribly difficult, and it's something I've always wanted to
> do anyway.

Sorry, I see what you are saying now, that the name=value pairs would
set in pg_database and pg_shadow and get executed on session startup. 
Very good.

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

From pgsql-hackers-owner+M18174=candle.pha.pa.us=pgman@postgresql.org Fri Jan 25 06:44:17 2002
Return-path: <pgsql-hackers-owner+M18174=candle.pha.pa.us=pgman@postgresql.org>
Received: from server1.pgsql.org (www.postgresql.org [64.49.215.9])
	by candle.pha.pa.us (8.11.6/8.10.1) with SMTP id g0PBiGe20620
	for <pgman@candle.pha.pa.us>; Fri, 25 Jan 2002 06:44:16 -0500 (EST)
Received: (qmail 92210 invoked by alias); 25 Jan 2002 11:43:41 -0000
Received: from unknown (HELO postgresql.org) (64.49.215.8)
  by www.postgresql.org with SMTP; 25 Jan 2002 11:43:41 -0000
Received: from smxsat1.smxs.net (smxsat1.smxs.net [213.150.10.1])
	by postgresql.org (8.11.3/8.11.4) with ESMTP id g0PBYsl90858
	for <pgsql-hackers@postgresql.org>; Fri, 25 Jan 2002 06:34:54 -0500 (EST)
	(envelope-from ZeugswetterA@spardat.at)
Received: from m01x1.s-mxs.net [10.3.55.201]
	by smxsat1.smxs.net
	with XWall v3.18f ;
	Fri, 25 Jan 2002 12:36:18 +0100
Received: from m0102.s-mxs.net [10.3.55.2]
	by m01x1.s-mxs.net
	with XWall v3.18a ;
	Fri, 25 Jan 2002 12:34:49 +0100
Received: from m0114.s-mxs.net ([10.3.55.14]) by m0102.s-mxs.net with Microsoft SMTPSVC(5.0.2195.2966);
  Fri, 25 Jan 2002 12:34:49 +0100
X-MimeOLE: Produced By Microsoft Exchange V6.0.5762.3
content-class: urn:content-classes:message
MIME-Version: 1.0
Content-Type: text/plain;
	charset="iso-8859-1"
Subject: Re: [HACKERS] RFD: schemas and different kinds of Postgres objects
Date: Fri, 25 Jan 2002 12:34:48 +0100
Message-ID: <46C15C39FEB2C44BA555E356FBCD6FA42128DD@m0114.s-mxs.net>
Thread-Topic: [HACKERS] RFD: schemas and different kinds of Postgres objects
Thread-Index: AcGkLuTMcnCfXPmkTji5zHYd6Vhu3QBZTo9w
From: "Zeugswetter Andreas SB SD" <ZeugswetterA@spardat.at>
To: "Joe Conway (wwc)" <jconway@cox.net>, "Tom Lane" <tgl@sss.pgh.pa.us>
cc: "Fernando Nasser" <fnasser@redhat.com>,
   "Peter Eisentraut" <peter_e@gmx.net>, <pgsql-hackers@postgresql.org>
X-OriginalArrivalTime: 25 Jan 2002 11:34:49.0376 (UTC) FILETIME=[4C1C7200:01C1A594]
Content-Transfer-Encoding: 8bit
X-MIME-Autoconverted: from quoted-printable to 8bit by postgresql.org id g0PBh2m91415
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: ORr


> Tom Lane wrote:
> 
> > 
> > This would be a *whole* lot simpler if we forgot the notion of "any"
> > and made the search order look like
> > 
> > 	(temp, private, public, system)

I am starting to see the advantages and like it. I also like the exact 
name "public" for the public schema.

Andreas

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/users-lounge/docs/faq.html

From pgsql-hackers-owner+M18195=candle.pha.pa.us=pgman@postgresql.org Fri Jan 25 12:18:20 2002
Return-path: <pgsql-hackers-owner+M18195=candle.pha.pa.us=pgman@postgresql.org>
Received: from server1.pgsql.org (www.postgresql.org [64.49.215.9])
	by candle.pha.pa.us (8.11.6/8.10.1) with SMTP id g0PHIJe26232
	for <pgman@candle.pha.pa.us>; Fri, 25 Jan 2002 12:18:19 -0500 (EST)
Received: (qmail 96791 invoked by alias); 25 Jan 2002 17:14:40 -0000
Received: from unknown (HELO postgresql.org) (64.49.215.8)
  by www.postgresql.org with SMTP; 25 Jan 2002 17:14:40 -0000
Received: from candle.pha.pa.us (216-55-132-35.dsl.san-diego.abac.net [216.55.132.35])
	by postgresql.org (8.11.3/8.11.4) with ESMTP id g0PGrXl88459
	for <pgsql-hackers@postgresql.org>; Fri, 25 Jan 2002 11:53:34 -0500 (EST)
	(envelope-from pgman@candle.pha.pa.us)
Received: (from pgman@localhost)
	by candle.pha.pa.us (8.11.6/8.10.1) id g0PGq4L23522;
	Fri, 25 Jan 2002 11:52:04 -0500 (EST)
From: Bruce Momjian <pgman@candle.pha.pa.us>
Message-ID: <200201251652.g0PGq4L23522@candle.pha.pa.us>
Subject: Re: [HACKERS] RFD: schemas and different kinds of Postgres objects
In-Reply-To: <46C15C39FEB2C44BA555E356FBCD6FA42128DD@m0114.s-mxs.net>
To: Zeugswetter Andreas SB SD <ZeugswetterA@spardat.at>
Date: Fri, 25 Jan 2002 11:52:04 -0500 (EST)
cc: "Joe Conway (wwc)" <jconway@cox.net>, Tom Lane <tgl@sss.pgh.pa.us>,
   Fernando Nasser <fnasser@redhat.com>, Peter Eisentraut <peter_e@gmx.net>,
   pgsql-hackers@postgresql.org
X-Mailer: ELM [version 2.4ME+ PL96 (25)]
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset=US-ASCII
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR

Zeugswetter Andreas SB SD wrote:
> 
> > Tom Lane wrote:
> > 
> > > 
> > > This would be a *whole* lot simpler if we forgot the notion of "any"
> > > and made the search order look like
> > > 
> > > 	(temp, private, public, system)
> 
> I am starting to see the advantages and like it. I also like the exact 
> name "public" for the public schema.

I wonder if we should think about a 'group' area so people in a group
can create things that others in the group can see, but not people
outside the group.

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly

From tgl@sss.pgh.pa.us Fri Jan 25 12:04:14 2002
Return-path: <tgl@sss.pgh.pa.us>
Received: from sss.pgh.pa.us (root@[192.204.191.242])
	by candle.pha.pa.us (8.11.6/8.10.1) with ESMTP id g0PH4De25154
	for <pgman@candle.pha.pa.us>; Fri, 25 Jan 2002 12:04:13 -0500 (EST)
Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1])
	by sss.pgh.pa.us (8.11.4/8.11.4) with ESMTP id g0PH4Cf26410;
	Fri, 25 Jan 2002 12:04:12 -0500 (EST)
To: Bruce Momjian <pgman@candle.pha.pa.us>
cc: Zeugswetter Andreas SB SD <ZeugswetterA@spardat.at>,
   "Joe Conway (wwc)" <jconway@cox.net>, Fernando Nasser <fnasser@redhat.com>,
   Peter Eisentraut <peter_e@gmx.net>, pgsql-hackers@postgresql.org
Subject: Re: [HACKERS] RFD: schemas and different kinds of Postgres objects 
In-Reply-To: <200201251652.g0PGq4L23522@candle.pha.pa.us> 
References: <200201251652.g0PGq4L23522@candle.pha.pa.us>
Comments: In-reply-to Bruce Momjian <pgman@candle.pha.pa.us>
	message dated "Fri, 25 Jan 2002 11:52:04 -0500"
Date: Fri, 25 Jan 2002 12:04:12 -0500
Message-ID: <26407.1011978252@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
Status: OR

Bruce Momjian <pgman@candle.pha.pa.us> writes:
>> I am starting to see the advantages and like it. I also like the exact 
>> name "public" for the public schema.

> I wonder if we should think about a 'group' area so people in a group
> can create things that others in the group can see, but not people
> outside the group.

I see no reason to hard-wire such a concept.  Given createable
namespaces, ACLs for namespaces, and a settable namespace search path,
people can set up group namespaces or anything else they want.

The (temp, private, public, system) path is suggested as default because
it's the minimum we need to support both SQL92 and backwards-compatible
behaviors.  I don't think we should put in special-purpose features
beyond that, when we can instead offer a general mechanism with which
people can build the special-purpose features they want.

			regards, tom lane

From pgsql-hackers-owner+M18209=candle.pha.pa.us=pgman@postgresql.org Fri Jan 25 16:14:02 2002
Return-path: <pgsql-hackers-owner+M18209=candle.pha.pa.us=pgman@postgresql.org>
Received: from server1.pgsql.org (www.postgresql.org [64.49.215.9])
	by candle.pha.pa.us (8.11.6/8.10.1) with SMTP id g0PLE1e19183
	for <pgman@candle.pha.pa.us>; Fri, 25 Jan 2002 16:14:01 -0500 (EST)
Received: (qmail 85059 invoked by alias); 25 Jan 2002 21:13:58 -0000
Received: from unknown (HELO postgresql.org) (64.49.215.8)
  by www.postgresql.org with SMTP; 25 Jan 2002 21:13:58 -0000
Received: from mail.netbsd.org (mail.netbsd.org [155.53.1.253])
	by postgresql.org (8.11.3/8.11.4) with SMTP id g0PKtNl77878
	for <pgsql-hackers@postgresql.org>; Fri, 25 Jan 2002 15:55:23 -0500 (EST)
	(envelope-from wrstuden@netbsd.org)
Received: (qmail 10628 invoked by uid 1130); 25 Jan 2002 20:55:14 -0000
Date: Fri, 25 Jan 2002 12:50:26 -0800 (PST)
From: Bill Studenmund <wrstuden@netbsd.org>
X-X-Sender: <wrstuden@vespasia.home-net.internetconnect.net>
To: Gavin Sherry <swm@linuxworld.com.au>
cc: Tom Lane <tgl@sss.pgh.pa.us>, <pgsql-hackers@postgresql.org>
Subject: Re: [HACKERS] RFD: schemas and different kinds of Postgres objects
In-Reply-To: <Pine.LNX.4.21.0201251517350.12632-100000@linuxworld.com.au>
Message-ID: <Pine.NEB.4.33.0201251241140.12100-100000@vespasia.home-net.internetconnect.net>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR

On Fri, 25 Jan 2002, Gavin Sherry wrote:

> This makes a lot of sense and suggests the possibility of 'schema enabled'
> databases. That is, a switch 'bool withschemas' (which defaults to
> false) could be added to pg_database. If true, the parser and ownership
> model reflects that of SQL'99 and/or the Postgres schema model. If false,
> the existing 'schema' model is assumed.
>
> This should allow existing users to migrate their data and applications to
> 7.3 without having to modify either.
>
> Its not an ideal solution but backward compatibility is generally results
> in compromise ;).

I guess my frustration with this idea is that we don't really need it. We
can achieve the same global namespace for an old app without it. All we
need is a tool which turns old dumps into new ones (which we probably need
anyway) that merges all of the schemas together w/ PATH statements. Or
maybe (new idea) a tool which looks at the schemas in a DB and updates
their PATHs so they act unified.

We can achieve the old behavior w/o having to build it into the backend.
So why add code to the backend when we don't have to? Among other things,
it would complicate the system schema as we'd have to keep track of
ownership values we wouldn't otherwise need to.

Take care,

Bill


---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

From ZeugswetterA@spardat.at Fri Jan 25 16:36:49 2002
Return-path: <ZeugswetterA@spardat.at>
Received: from smxsat1.smxs.net (smxsat1.smxs.net [213.150.10.1])
	by candle.pha.pa.us (8.11.6/8.10.1) with ESMTP id g0PLame20819
	for <pgman@candle.pha.pa.us>; Fri, 25 Jan 2002 16:36:48 -0500 (EST)
Received: from m01x1.s-mxs.net [10.3.55.201]
	by smxsat1.smxs.net
	with XWall v3.18f ;
	Fri, 25 Jan 2002 22:38:07 +0100
Received: from m0102.s-mxs.net [10.3.55.2]
	by m01x1.s-mxs.net
	with XWall v3.18a ;
	Fri, 25 Jan 2002 22:36:38 +0100
Received: from m0114.s-mxs.net ([10.3.55.14]) by m0102.s-mxs.net with Microsoft SMTPSVC(5.0.2195.2966);
  Fri, 25 Jan 2002 22:36:38 +0100
X-MimeOLE: Produced By Microsoft Exchange V6.0.5762.3
content-class: urn:content-classes:message
MIME-Version: 1.0
Content-Type: text/plain;
	charset="iso-8859-1"
Subject: RE: [HACKERS] RFD: schemas and different kinds of Postgres objects
Date: Fri, 25 Jan 2002 22:36:37 +0100
Message-ID: <46C15C39FEB2C44BA555E356FBCD6FA42128E0@m0114.s-mxs.net>
Thread-Topic: [HACKERS] RFD: schemas and different kinds of Postgres objects
Thread-Index: AcGlwKXMNIw3BiZ7R4G6MaOhn/ahAgAJ0maA
From: "Zeugswetter Andreas SB SD" <ZeugswetterA@spardat.at>
To: "Bruce Momjian" <pgman@candle.pha.pa.us>
cc: "Joe Conway (wwc)" <jconway@cox.net>, "Tom Lane" <tgl@sss.pgh.pa.us>,
   "Fernando Nasser" <fnasser@redhat.com>,
   "Peter Eisentraut" <peter_e@gmx.net>, <pgsql-hackers@postgresql.org>
X-OriginalArrivalTime: 25 Jan 2002 21:36:38.0285 (UTC) FILETIME=[5EB2B3D0:01C1A5E8]
Content-Transfer-Encoding: 8bit
X-MIME-Autoconverted: from quoted-printable to 8bit by candle.pha.pa.us id g0PLame20819
Status: OR


> > I am starting to see the advantages and like it. I also like the exact 
> > name "public" for the public schema.
> 
> I wonder if we should think about a 'group' area so people in a group
> can create things that others in the group can see, but not people
> outside the group.

A group simply chooses a special schema name for their group.

Maybe an extra in the ACL area so you can grant privs for a whole 
schema.

grant select on schema blabla to "JoeLuser"

Andreas

From wrstuden@netbsd.org Fri Jan 25 17:12:51 2002
Return-path: <wrstuden@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [155.53.1.253])
	by candle.pha.pa.us (8.11.6/8.10.1) with SMTP id g0PMCoe23588
	for <pgman@candle.pha.pa.us>; Fri, 25 Jan 2002 17:12:51 -0500 (EST)
Received: (qmail 20909 invoked by uid 1130); 25 Jan 2002 22:12:46 -0000
Date: Fri, 25 Jan 2002 14:07:58 -0800 (PST)
From: Bill Studenmund <wrstuden@netbsd.org>
X-X-Sender: <wrstuden@vespasia.home-net.internetconnect.net>
To: Bruce Momjian <pgman@candle.pha.pa.us>
cc: Tom Lane <tgl@sss.pgh.pa.us>,
   Zeugswetter Andreas SB SD <ZeugswetterA@spardat.at>,
   Fernando Nasser <fnasser@redhat.com>, Peter Eisentraut <peter_e@gmx.net>,
   <pgsql-hackers@postgresql.org>
Subject: Re: [HACKERS] RFD: schemas and different kinds of Postgres objects
In-Reply-To: <200201250326.g0P3Qhw23061@candle.pha.pa.us>
Message-ID: <Pine.NEB.4.33.0201251358390.12100-100000@vespasia.home-net.internetconnect.net>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
Status: OR

On Thu, 24 Jan 2002, Bruce Momjian wrote:

> I think we could set the database default at db creation time, then
> allow SET to modify that default per session;  seems flexible enough.
> It is basically a GUC value who's default is stored in pg_database
> rather than postgresql.conf.   You could use postgresql.conf to set the
> default schema type at db creation time.

Specifically to the question of schema pathing, why would you want it to
be session-settable? Either your DB app is designed to work w/ schemas, or
it isn't. That's a pretty fundamental design concept. Given that, I don't
see how it can make sense to try to operate in the opposite mode as the
app was designed for - that'll only lead to chaos.

Take care,

Bill


From tgl@sss.pgh.pa.us Fri Jan 25 17:26:17 2002
Return-path: <tgl@sss.pgh.pa.us>
Received: from sss.pgh.pa.us (root@[192.204.191.242])
	by candle.pha.pa.us (8.11.6/8.10.1) with ESMTP id g0PMQGe24836
	for <pgman@candle.pha.pa.us>; Fri, 25 Jan 2002 17:26:16 -0500 (EST)
Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1])
	by sss.pgh.pa.us (8.11.4/8.11.4) with ESMTP id g0PMQEf07711;
	Fri, 25 Jan 2002 17:26:14 -0500 (EST)
To: Bill Studenmund <wrstuden@netbsd.org>
cc: Bruce Momjian <pgman@candle.pha.pa.us>,
   Zeugswetter Andreas SB SD <ZeugswetterA@spardat.at>,
   Fernando Nasser <fnasser@redhat.com>, Peter Eisentraut <peter_e@gmx.net>,
   pgsql-hackers@postgresql.org
Subject: Re: [HACKERS] RFD: schemas and different kinds of Postgres objects 
In-Reply-To: <Pine.NEB.4.33.0201251358390.12100-100000@vespasia.home-net.internetconnect.net> 
References: <Pine.NEB.4.33.0201251358390.12100-100000@vespasia.home-net.internetconnect.net>
Comments: In-reply-to Bill Studenmund <wrstuden@netbsd.org>
	message dated "Fri, 25 Jan 2002 14:07:58 -0800"
Date: Fri, 25 Jan 2002 17:26:14 -0500
Message-ID: <7708.1011997574@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
Status: OR

Bill Studenmund <wrstuden@netbsd.org> writes:
> Specifically to the question of schema pathing, why would you want it to
> be session-settable? Either your DB app is designed to work w/ schemas, or
> it isn't.

So that you can set the correct mode for your client application.  It is
silly to suppose that an installation-wide or even database-wide setting
is sufficient.  Consider for example a database shared by multiple
pieces of client software; wouldn't you like to be able to upgrade them
to schema-awareness one at a time?

You could possibly make a case for a single setting per user, but even
that makes an assumption (user == client software) that I think is not
reasonable for us to force on all Postgres installations.

Basically I haven't got a lot of patience for arguments that say we do
not need flexibility.  There are more people out there, using Postgres
in more different ways, than either you or I know about.

			regards, tom lane

From pgsql-hackers-owner+M18216=candle.pha.pa.us=pgman@postgresql.org Fri Jan 25 18:54:34 2002
Return-path: <pgsql-hackers-owner+M18216=candle.pha.pa.us=pgman@postgresql.org>
Received: from server1.pgsql.org (www.postgresql.org [64.49.215.9])
	by candle.pha.pa.us (8.11.6/8.10.1) with SMTP id g0PNsXe02286
	for <pgman@candle.pha.pa.us>; Fri, 25 Jan 2002 18:54:34 -0500 (EST)
Received: (qmail 18323 invoked by alias); 25 Jan 2002 23:53:56 -0000
Received: from unknown (HELO postgresql.org) (64.49.215.8)
  by www.postgresql.org with SMTP; 25 Jan 2002 23:53:56 -0000
Received: from mail.netbsd.org (mail.netbsd.org [155.53.1.253])
	by postgresql.org (8.11.3/8.11.4) with SMTP id g0PNk1l17143
	for <pgsql-hackers@postgresql.org>; Fri, 25 Jan 2002 18:46:02 -0500 (EST)
	(envelope-from wrstuden@netbsd.org)
Received: (qmail 23281 invoked by uid 1130); 25 Jan 2002 23:46:04 -0000
Date: Fri, 25 Jan 2002 15:41:16 -0800 (PST)
From: Bill Studenmund <wrstuden@netbsd.org>
X-X-Sender: <wrstuden@vespasia.home-net.internetconnect.net>
To: Tom Lane <tgl@sss.pgh.pa.us>
cc: Bruce Momjian <pgman@candle.pha.pa.us>,
   Zeugswetter Andreas SB SD <ZeugswetterA@spardat.at>,
   Fernando Nasser <fnasser@redhat.com>, Peter Eisentraut <peter_e@gmx.net>,
   <pgsql-hackers@postgresql.org>
Subject: Re: [HACKERS] RFD: schemas and different kinds of Postgres objects
In-Reply-To: <7708.1011997574@sss.pgh.pa.us>
Message-ID: <Pine.NEB.4.33.0201251425391.12100-100000@vespasia.home-net.internetconnect.net>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR

On Fri, 25 Jan 2002, Tom Lane wrote:

> Bill Studenmund <wrstuden@netbsd.org> writes:
> > Specifically to the question of schema pathing, why would you want it to
> > be session-settable? Either your DB app is designed to work w/ schemas, or
> > it isn't.
>
> So that you can set the correct mode for your client application.  It is
> silly to suppose that an installation-wide or even database-wide setting
> is sufficient.  Consider for example a database shared by multiple
> pieces of client software; wouldn't you like to be able to upgrade them
> to schema-awareness one at a time?

What exactly does it mean to upgrade to schema-awareness? I know the jist
of what you mean, but what does it entail? What steps? I ask as, when I
think of what it means in practical steps, an upgraded app won't have
problems with extra stuff pathed in. So the upgraded app will be fine with
the pathing set up to include all (not-upgraded) schemas. Also, if it does
have a problem with stuff pathed in, since you can easily set the new apps
up to live in different schemas than the old ones, you can have upgraded &
from-before schemas.

> You could possibly make a case for a single setting per user, but even
> that makes an assumption (user == client software) that I think is not
> reasonable for us to force on all Postgres installations.

But we will have the ability to set the path per schema. Since
schema-aware apps should be able to choose which schema they connect to (I
envision it being a connect parameter), the different apps can implicitly
get different behaviors by connecting to schemas that are designed to be
schema-savy, or connecting to ones which aren't (i.e. have all of the
schema-unaware stuff pathed in).

> Basically I haven't got a lot of patience for arguments that say we do
> not need flexibility.  There are more people out there, using Postgres
> in more different ways, than either you or I know about.

Tom, please listen to what I'm saying. I'm trying to be as clear as I can
& making sure I'm not working from details in my head and not my posts.
I'm sorry if it isn't clear but I'm _not_ saying that we don't need the
flexability you describe. We do.

I'm saying that IT IS ALREADY THERE! The pathing built into schemas can be
very powerful. Powerful enough that I haven't heard of an example yet that
can't be taken care of with judicious use of pathing. And I don't think
the pathing needed is beyond mid-level admins (I don't see it as something
which only say 5 people on the lists can get right). Yes, people will have
to learn it, but it doesn't strike me as that hard a thing.

What I am saying is that we don't need the solution you & Bruce mentioned
to get the flexability you mentioned as the reason for adding it. So why
add the feature which isn't needed?

One of my objections to a "mode" supporting the old behavior is that, as I
understand it, there would be a schema ("public") where different users
could own objects in the same schema. That goes against one of the
advantages I see for schemas: we can consolidate ownership info in the
system tables. If you know what schema something is in, you know its
owner. That means that adding schema support doesn't mean growing system
tables, just renaming a column (the user id gets turned into the schema
id).

Maybe that's not such a big deal. But it seems when we're doing things
right, things should get cleaner. Having to keep ownership info at both
the schema level and at the object level strikes me as not making things
cleaner. That just seems to be going in the wrong direction.

Especially as, AFAICT, it wouldn't be hard to let the sysadmins have all
the flexability you want them to have (and also that I agree they should
have) in a system which is, at its core, very schema-savy (everything in
one schema is owned by the same user or group).

I also agree that migration is important. Apps from 7.2 (and 7.1 and
earlier as possible) should run on the schema-savy backend I describe. A
migration tool to take the dump from before and add update schema commands
to path everything in (so it looks like one namespace) should make the old
apps keep working.

The one thing I'll concede could be useful would be for createuser to be
told to automatically set the new user's schema to include all the other
schemas, and to update all the other user schemas to add this user. That
way you can add new users to your DB when you're acting as if it didn't
have schemas.

Hmmm. If we made the above behavior a per-db-configurable default, the
pg_dump file wouldn't need to be changed. That would be good. It would
make the path updates O(nusers^2) rather than O(nusers), but that probably
won't be bad. And offering both options would probably be good.

Take care,

Bill


---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
    (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)

From tgl@sss.pgh.pa.us Fri Jan 25 19:04:17 2002
Return-path: <tgl@sss.pgh.pa.us>
Received: from sss.pgh.pa.us (root@[192.204.191.242])
	by candle.pha.pa.us (8.11.6/8.10.1) with ESMTP id g0Q04Ge02926
	for <pgman@candle.pha.pa.us>; Fri, 25 Jan 2002 19:04:17 -0500 (EST)
Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1])
	by sss.pgh.pa.us (8.11.4/8.11.4) with ESMTP id g0Q04Ff08236;
	Fri, 25 Jan 2002 19:04:16 -0500 (EST)
To: Bill Studenmund <wrstuden@netbsd.org>
cc: Bruce Momjian <pgman@candle.pha.pa.us>,
   Zeugswetter Andreas SB SD <ZeugswetterA@spardat.at>,
   Fernando Nasser <fnasser@redhat.com>, Peter Eisentraut <peter_e@gmx.net>,
   pgsql-hackers@postgresql.org
Subject: Re: [HACKERS] RFD: schemas and different kinds of Postgres objects 
In-Reply-To: <Pine.NEB.4.33.0201251425391.12100-100000@vespasia.home-net.internetconnect.net> 
References: <Pine.NEB.4.33.0201251425391.12100-100000@vespasia.home-net.internetconnect.net>
Comments: In-reply-to Bill Studenmund <wrstuden@netbsd.org>
	message dated "Fri, 25 Jan 2002 15:41:16 -0800"
Date: Fri, 25 Jan 2002 19:04:15 -0500
Message-ID: <8233.1012003455@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
Status: OR

Bill Studenmund <wrstuden@netbsd.org> writes:
> But we will have the ability to set the path per schema.

?? I don't follow that at all. A namespace is something that's referred
to by a search path, not vice versa.  Or are you defining "schema" to
mean some higher-level concept that incorporates a search path of
multiple primitive namespaces?  Maybe that could work, but I'm not sure
I see the point yet.

			regards, tom lane

From wrstuden@netbsd.org Fri Jan 25 20:39:59 2002
Return-path: <wrstuden@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [155.53.1.253])
	by candle.pha.pa.us (8.11.6/8.10.1) with SMTP id g0Q1dve10731
	for <pgman@candle.pha.pa.us>; Fri, 25 Jan 2002 20:39:58 -0500 (EST)
Received: (qmail 27927 invoked by uid 1130); 26 Jan 2002 01:39:59 -0000
Date: Fri, 25 Jan 2002 17:35:11 -0800 (PST)
From: Bill Studenmund <wrstuden@netbsd.org>
X-X-Sender: <wrstuden@vespasia.home-net.internetconnect.net>
To: Tom Lane <tgl@sss.pgh.pa.us>
cc: Bruce Momjian <pgman@candle.pha.pa.us>,
   Zeugswetter Andreas SB SD <ZeugswetterA@spardat.at>,
   Fernando Nasser <fnasser@redhat.com>, Peter Eisentraut <peter_e@gmx.net>,
   <pgsql-hackers@postgresql.org>
Subject: Re: [HACKERS] RFD: schemas and different kinds of Postgres objects
In-Reply-To: <8233.1012003455@sss.pgh.pa.us>
Message-ID: <Pine.NEB.4.33.0201251631050.12100-100000@vespasia.home-net.internetconnect.net>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
Status: OR

On Fri, 25 Jan 2002, Tom Lane wrote:

> Bill Studenmund <wrstuden@netbsd.org> writes:
> > But we will have the ability to set the path per schema.
>
> ?? I don't follow that at all. A namespace is something that's referred
> to by a search path, not vice versa.  Or are you defining "schema" to
> mean some higher-level concept that incorporates a search path of
> multiple primitive namespaces?  Maybe that could work, but I'm not sure
> I see the point yet.

Oh. That would make a difference. We've been talking past each other.

SQL schemas, as I understand the spec, are both. A shema is a container
that holds things like tables and views and functions (and for PostgreSQL
operators and aggregates and I'd suggest index operators, etc.). It also
can include a schema path specification, which defines the search path
used by routines (stored procedures & functions) contained in that schema.

So say I have schemas foo, bar, and baz. I can set the schema path for
schema bar to be foo:bar:baz:IMPLIMENTATION_SCHEMA, and all routines in
bar will look in those four schemas for types, functions and tables (and
everything else we use the search path for).

(*) IMPLIMENTATION_SCHEMA is required by the spec, and contains all the
built-ins. It's be implimentation_schema for pg. Also, if you have a path
that doesn't list it, the db is supposed to prepend it to the list.

So when migrating an app from a schema-unaware PostgreSQL to a
schema-aware one, if we create a schema for each user, and make each
such schema path in all the other such schemas, we make it such that all
of the procedures in those schemas act like they have a unified namespace.

There also is also the concept of the CURRENT_PATH which is the schema
path used for parsed queries (like ones typed into psql). I got lost in
the spec trying to find what this is supposed to default to, but what I
understand other DBs to do is your CURRENT_PATH is set to the path of the
schema you log into.

Add to this mix the default schema for user X is schema X (which I thought
was in the spec but I can't find now), and let's look at that example
again.

Say we had users foo, bar and baz before. We made schemas foo, bar, and
baz. We set the default paths for each of these schemas to
foo:bar:baz:IMPLIMENTATION_SCHEMA. Now the routines in each of these
schemas will see a unified namespace. Next, when we log in as users foo,
bar, or baz, and our CURRENT_PATH ends up including the namespaces of the
three original users. So now all of our submitted queries also see a
unified namespace.

So with a schema-savy backend, by adding PATH statements to the schemas
that pull in all of the previous schemas, we can make the old app behave
as if it had a unified namespace.

Does that make sense?

Take care,

Bill

P.S. does anyone need copies of the spec? I found pdf's on the web a while
back..


From pgsql-hackers-owner+M18221=candle.pha.pa.us=pgman@postgresql.org Fri Jan 25 22:13:58 2002
Return-path: <pgsql-hackers-owner+M18221=candle.pha.pa.us=pgman@postgresql.org>
Received: from server1.pgsql.org (www.postgresql.org [64.49.215.9])
	by candle.pha.pa.us (8.11.6/8.10.1) with SMTP id g0Q3Dwe17302
	for <pgman@candle.pha.pa.us>; Fri, 25 Jan 2002 22:13:58 -0500 (EST)
Received: (qmail 42344 invoked by alias); 26 Jan 2002 03:13:55 -0000
Received: from unknown (HELO postgresql.org) (64.49.215.8)
  by www.postgresql.org with SMTP; 26 Jan 2002 03:13:55 -0000
Received: from golem.fourpalms.org (golem.fourpalms.org [64.3.68.148])
	by postgresql.org (8.11.3/8.11.4) with ESMTP id g0Q35hl41629
	for <pgsql-hackers@postgresql.org>; Fri, 25 Jan 2002 22:05:43 -0500 (EST)
	(envelope-from lockhart@fourpalms.org)
Received: from fourpalms.org (localhost.localdomain [127.0.0.1])
	by golem.fourpalms.org (Postfix) with ESMTP
	id 0336CFEC5; Sat, 26 Jan 2002 03:05:45 +0000 (UTC)
Message-ID: <3C521D08.9138E2EA@fourpalms.org>
Date: Sat, 26 Jan 2002 03:05:44 +0000
From: Thomas Lockhart <lockhart@fourpalms.org>
Reply-To: lockhart@fourpalms.org
Organization: Yes
X-Mailer: Mozilla 4.75 [en] (X11; U; Linux 2.2.17-21mdksmp i686)
X-Accept-Language: en
MIME-Version: 1.0
To: Tom Lane <tgl@sss.pgh.pa.us>
cc: Stephan Szabo <sszabo@megazone23.bigpanda.com>,
   Peter Eisentraut <peter_e@gmx.net>, pgsql-hackers@postgresql.org,
   Fernando Nasser <fnasser@redhat.com>
Subject: Re: [HACKERS] RFD: schemas and different kinds of Postgres objects
References: <20020123083152.W18169-100000@megazone23.bigpanda.com> <3159.1011804418@sss.pgh.pa.us>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR

...
> > Wouldn't it make sense to prefer operators/functions earlier in the search
> > path for resolving ambiguity.  So if you had plus(int4, int4) in my
> > schema and plus(int8, int8) in system, and they'd otherwise cause an
> > ambiguity failure for the query, use the plus(int4, int4) on mine. It
> > seems not too far from having the search path shadow later exact matches.
> Given the complexity of the resolution rules (cf.
> http://developer.postgresql.org/docs/postgres/typeconv.html),
> it's not clear that we can determine exactly which "later" entry ought
> to be blamed for causing a resolution failure.  I'd be interested to
> hear Lockhart's opinion on this --- but my gut feeling is we don't
> want to go there.  The resolution rules are already complicated enough,
> and I think layering an additional mechanism like that onto them might
> make the behavior totally unpredictable.

(I've been following the discussion; I suspect that this part may
already have an obvious answer since "any" scoping -- equivalent to
flattening the namespace? -- may now be out of favor; I'm assuming that
we have a clearly scoped lookup scheme available).

imho there is nothing fundamentally difficult or "unpredictable" about
layering schema lookup on to the existing function resolution rules. One
might want a bit better diagnostics about *which* function was actually
chosen, but reasonable scoping and lookup rules could be constructed
which give reasonable behavior with the addition of schemas.

For example, the current function resolution rules prefer an exact
match, then start looking for approximate matches, and narrow that down
to preferring the one with the best explicit match on data types. If
more than one matches, then it rejects the query. (I've left out one or
two steps, but on the whole this is the behavior that matters.)

With schemas, one could choose to use "closest schema" as the tiebreaker
for multiple matches, but istm that an exact match should always win.

We might want to include a mechanism that *blocks* schema lookups deeper
into the search path, to allow reliable *complete replacement* of a
function. This would be a property of the function, to be set when it is
defined in the schema. So an implementer could choose to restrict
lookups explicitly if that is deemed necessary. Again, this is not a
huge complication.

It is an interesting discussion, and the fine points will not be brought
out without having lots of back-and-forth, which seems to be happening
already ;)

                  - Thomas

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

From pgsql-hackers-owner+M18236=candle.pha.pa.us=pgman@postgresql.org Sun Jan 27 20:44:07 2002
Return-path: <pgsql-hackers-owner+M18236=candle.pha.pa.us=pgman@postgresql.org>
Received: from server1.pgsql.org (www.postgresql.org [64.49.215.9])
	by candle.pha.pa.us (8.11.6/8.10.1) with SMTP id g0S1i6e21103
	for <pgman@candle.pha.pa.us>; Sun, 27 Jan 2002 20:44:06 -0500 (EST)
Received: (qmail 86523 invoked by alias); 28 Jan 2002 01:44:01 -0000
Received: from unknown (HELO postgresql.org) (64.49.215.8)
  by www.postgresql.org with SMTP; 28 Jan 2002 01:44:01 -0000
Received: from sd.tpf.co.jp (sd.tpf.co.jp [210.161.239.34])
	by postgresql.org (8.11.3/8.11.4) with SMTP id g0S1X4l84668
	for <pgsql-hackers@postgreSQL.org>; Sun, 27 Jan 2002 20:33:04 -0500 (EST)
	(envelope-from Inoue@tpf.co.jp)
Received: (qmail 4010 invoked from network); 28 Jan 2002 01:33:07 -0000
Received: from unknown (HELO viscomail.tpf.co.jp) (100.0.0.108)
  by sd2.tpf-fw-c.co.jp with SMTP; 28 Jan 2002 01:33:07 -0000
Received: from tpf.co.jp (3dgateway1 [126.0.1.60])
	by viscomail.tpf.co.jp (8.8.8+Sun/8.8.8) with ESMTP id KAA05318;
	Mon, 28 Jan 2002 10:33:04 +0900 (JST)
Message-ID: <3C54AA51.64CE68AD@tpf.co.jp>
Date: Mon, 28 Jan 2002 10:33:05 +0900
From: Hiroshi Inoue <Inoue@tpf.co.jp>
X-Mailer: Mozilla 4.73 [ja] (Windows NT 5.0; U)
X-Accept-Language: ja
MIME-Version: 1.0
To: Peter Eisentraut <peter_e@gmx.net>, Tom Lane <tgl@sss.pgh.pa.us>
cc: Bill Studenmund <wrstuden@netbsd.org>,
   Stephan Szabo <sszabo@megazone23.bigpanda.com>,
   PostgreSQL Development <pgsql-hackers@postgresql.org>,
   Fernando Nasser <fnasser@redhat.com>
Subject: Re: [HACKERS] RFD: schemas and different kinds of Postgres objects
References: <Pine.LNX.4.30.0201240003120.686-100000@peter.localdomain>
Content-Type: text/plain; charset=iso-2022-jp
Content-Transfer-Encoding: 7bit
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR

Is *the path* below the same as "search path* in other
postings about this thread ?

Maybe Peter's posting isn't the one exactly what I have to
ask but there are too many postings for me to follow.

regards,
Hiroshi Inoue

Peter Eisentraut wrote:
> 
> Bill Studenmund writes:
> 
> > Does SQL'99 say anything about this?
> 
> Yes, though, as usual, you have to twist your brain a little to understand
> it.  My understanding is that for a function call of the form "foo(a, b)"
> it goes like this:
> 
> 1. Find all functions named "foo" in the current database.  This is the
> set of "possibly candidate routines".
> 
> 2. Drop all routines that you do not have EXECUTE privilege for.  This is
> the set of "executable routines".
> 
> 3. Drop all routines that do not have compatible parameter lists.  This is
> the set of "invocable routines".
> 
> 4. Drop all routines whose schema is not in the path.  This is the set of
> "candidate routines".
> 
> 5. If you have more than one routine left, eliminate some routines
> according to type precedence rules.  (We do some form of this, SQL99
> specifies something different.)  This yields the set of "candidate subject
> routines".
> 
> 6. Choose the routine whose schema is earliest in the path as the "subject
> routine".
> 
> Execute the subject routine.  Phew!
> 
> This doesn't look glaringly wrong to me, so maybe you want to consider it.
> Please note step 2.
> 
> --
> Peter Eisentraut   peter_e@gmx.net

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
    (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)

From pgsql-hackers-owner+M18249=candle.pha.pa.us=pgman@postgresql.org Mon Jan 28 19:34:59 2002
Return-path: <pgsql-hackers-owner+M18249=candle.pha.pa.us=pgman@postgresql.org>
Received: from server1.pgsql.org (www.postgresql.org [64.49.215.9])
	by candle.pha.pa.us (8.11.6/8.10.1) with SMTP id g0T0Ywe04781
	for <pgman@candle.pha.pa.us>; Mon, 28 Jan 2002 19:34:58 -0500 (EST)
Received: (qmail 99270 invoked by alias); 29 Jan 2002 00:34:49 -0000
Received: from unknown (HELO postgresql.org) (64.49.215.8)
  by www.postgresql.org with SMTP; 29 Jan 2002 00:34:49 -0000
Received: from mail.netbsd.org (mail.netbsd.org [155.53.1.253])
	by postgresql.org (8.11.3/8.11.4) with SMTP id g0T0WDl98697
	for <pgsql-hackers@postgreSQL.org>; Mon, 28 Jan 2002 19:32:13 -0500 (EST)
	(envelope-from wrstuden@netbsd.org)
Received: (qmail 26513 invoked by uid 1130); 29 Jan 2002 00:31:57 -0000
Date: Mon, 28 Jan 2002 16:27:04 -0800 (PST)
From: Bill Studenmund <wrstuden@netbsd.org>
X-X-Sender: <wrstuden@vespasia.home-net.internetconnect.net>
To: Hiroshi Inoue <Inoue@tpf.co.jp>
cc: Peter Eisentraut <peter_e@gmx.net>, Tom Lane <tgl@sss.pgh.pa.us>,
   Stephan Szabo <sszabo@megazone23.bigpanda.com>,
   PostgreSQL Development <pgsql-hackers@postgresql.org>,
   Fernando Nasser <fnasser@redhat.com>
Subject: Re: [HACKERS] RFD: schemas and different kinds of Postgres objects
In-Reply-To: <3C54AA51.64CE68AD@tpf.co.jp>
Message-ID: <Pine.NEB.4.33.0201281624010.18868-100000@vespasia.home-net.internetconnect.net>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR

On Mon, 28 Jan 2002, Hiroshi Inoue wrote:

> Is *the path* below the same as "search path* in other
> postings about this thread ?

I think so. I believe the path I've been talking about is the one in step
6 below.

Take care,

Bill

> Maybe Peter's posting isn't the one exactly what I have to
> ask but there are too many postings for me to follow.
>
> regards,
> Hiroshi Inoue
>
> Peter Eisentraut wrote:
> >
> > Bill Studenmund writes:
> >
> > > Does SQL'99 say anything about this?
> >
> > Yes, though, as usual, you have to twist your brain a little to understand
> > it.  My understanding is that for a function call of the form "foo(a, b)"
> > it goes like this:
> >
> > 1. Find all functions named "foo" in the current database.  This is the
> > set of "possibly candidate routines".
> >
> > 2. Drop all routines that you do not have EXECUTE privilege for.  This is
> > the set of "executable routines".
> >
> > 3. Drop all routines that do not have compatible parameter lists.  This is
> > the set of "invocable routines".
> >
> > 4. Drop all routines whose schema is not in the path.  This is the set of
> > "candidate routines".
> >
> > 5. If you have more than one routine left, eliminate some routines
> > according to type precedence rules.  (We do some form of this, SQL99
> > specifies something different.)  This yields the set of "candidate subject
> > routines".
> >
> > 6. Choose the routine whose schema is earliest in the path as the "subject
> > routine".
> >
> > Execute the subject routine.  Phew!
> >
> > This doesn't look glaringly wrong to me, so maybe you want to consider it.
> > Please note step 2.
> >
> > --
> > Peter Eisentraut   peter_e@gmx.net
>


---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

From pgsql-hackers-owner+M18257=candle.pha.pa.us=pgman@postgresql.org Tue Jan 29 01:14:41 2002
Return-path: <pgsql-hackers-owner+M18257=candle.pha.pa.us=pgman@postgresql.org>
Received: from server1.pgsql.org (www.postgresql.org [64.49.215.9])
	by candle.pha.pa.us (8.11.6/8.10.1) with SMTP id g0T6Eee16404
	for <pgman@candle.pha.pa.us>; Tue, 29 Jan 2002 01:14:40 -0500 (EST)
Received: (qmail 64203 invoked by alias); 29 Jan 2002 06:14:43 -0000
Received: from unknown (HELO postgresql.org) (64.49.215.8)
  by www.postgresql.org with SMTP; 29 Jan 2002 06:14:43 -0000
Received: from sd.tpf.co.jp (sd.tpf.co.jp [210.161.239.34])
	by postgresql.org (8.11.3/8.11.4) with SMTP id g0T5lJl60013
	for <pgsql-hackers@postgreSQL.org>; Tue, 29 Jan 2002 00:47:20 -0500 (EST)
	(envelope-from Inoue@tpf.co.jp)
Received: (qmail 19665 invoked from network); 29 Jan 2002 05:47:24 -0000
Received: from unknown (HELO viscomail.tpf.co.jp) (100.0.0.108)
  by sd2.tpf-fw-c.co.jp with SMTP; 29 Jan 2002 05:47:24 -0000
Received: from tpf.co.jp (3dgateway1 [126.0.1.60])
	by viscomail.tpf.co.jp (8.8.8+Sun/8.8.8) with ESMTP id OAA07250;
	Tue, 29 Jan 2002 14:47:22 +0900 (JST)
Message-ID: <3C56376C.BCA5B3A5@tpf.co.jp>
Date: Tue, 29 Jan 2002 14:47:24 +0900
From: Hiroshi Inoue <Inoue@tpf.co.jp>
X-Mailer: Mozilla 4.73 [ja] (Windows NT 5.0; U)
X-Accept-Language: ja
MIME-Version: 1.0
To: Bill Studenmund <wrstuden@netbsd.org>
cc: Peter Eisentraut <peter_e@gmx.net>, Tom Lane <tgl@sss.pgh.pa.us>,
   Stephan Szabo <sszabo@megazone23.bigpanda.com>,
   PostgreSQL Development <pgsql-hackers@postgresql.org>,
   Fernando Nasser <fnasser@redhat.com>
Subject: Re: [HACKERS] RFD: schemas and different kinds of Postgres objects
References: <Pine.NEB.4.33.0201281624010.18868-100000@vespasia.home-net.internetconnect.net>
Content-Type: text/plain; charset=iso-2022-jp
Content-Transfer-Encoding: 7bit
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR

Bill Studenmund wrote:
> 
> On Mon, 28 Jan 2002, Hiroshi Inoue wrote:
> 
> > Is *the path* below the same as "search path* in other
> > postings about this thread ?
> 
> I think so. I believe the path I've been talking about is the one in step
> 6 below.

What I can find in SQL99 is SQL-path.
Does *the path*(i.e search path) mean SQL-path ?
They don't seem the same to me.

regards,
Hiroshi Inoue

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
    (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)

From pgsql-hackers-owner+M18271=candle.pha.pa.us=pgman@postgresql.org Tue Jan 29 12:55:04 2002
Return-path: <pgsql-hackers-owner+M18271=candle.pha.pa.us=pgman@postgresql.org>
Received: from server1.pgsql.org (www.postgresql.org [64.49.215.9])
	by candle.pha.pa.us (8.11.6/8.10.1) with SMTP id g0THt2P00626
	for <pgman@candle.pha.pa.us>; Tue, 29 Jan 2002 12:55:02 -0500 (EST)
Received: (qmail 77793 invoked by alias); 29 Jan 2002 17:54:57 -0000
Received: from unknown (HELO postgresql.org) (64.49.215.8)
  by www.postgresql.org with SMTP; 29 Jan 2002 17:54:57 -0000
Received: from mail.netbsd.org (mail.netbsd.org [155.53.1.253])
	by postgresql.org (8.11.3/8.11.4) with SMTP id g0THmBl76965
	for <pgsql-hackers@postgreSQL.org>; Tue, 29 Jan 2002 12:48:11 -0500 (EST)
	(envelope-from wrstuden@netbsd.org)
Received: (qmail 23554 invoked by uid 1130); 29 Jan 2002 17:48:16 -0000
Date: Tue, 29 Jan 2002 09:43:22 -0800 (PST)
From: Bill Studenmund <wrstuden@netbsd.org>
X-X-Sender: <wrstuden@vespasia.home-net.internetconnect.net>
To: Hiroshi Inoue <Inoue@tpf.co.jp>
cc: Peter Eisentraut <peter_e@gmx.net>, Tom Lane <tgl@sss.pgh.pa.us>,
   Stephan Szabo <sszabo@megazone23.bigpanda.com>,
   PostgreSQL Development <pgsql-hackers@postgresql.org>,
   Fernando Nasser <fnasser@redhat.com>
Subject: Re: [HACKERS] RFD: schemas and different kinds of Postgres objects
In-Reply-To: <3C56376C.BCA5B3A5@tpf.co.jp>
Message-ID: <Pine.NEB.4.33.0201290939350.24201-100000@vespasia.home-net.internetconnect.net>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR

On Tue, 29 Jan 2002, Hiroshi Inoue wrote:

> Bill Studenmund wrote:
> >
> > On Mon, 28 Jan 2002, Hiroshi Inoue wrote:
> >
> > > Is *the path* below the same as "search path* in other
> > > postings about this thread ?
> >
> > I think so. I believe the path I've been talking about is the one in step
> > 6 below.
>
> What I can find in SQL99 is SQL-path.
> Does *the path*(i.e search path) mean SQL-path ?
> They don't seem the same to me.

While we may have not been using the terminology of the spec, I think we
have been talking about schema paths from SQL99.

One difference between our discussions and SQL99 I've noticed is that
we've spoken of having the path find functions (and operators and
aggregates), types, _and_tables_. SQL99 doesn't have tables in there
AFAICT, but I think it makes sense.

Take care,

Bill


---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org

From pgsql-hackers-owner+M18273=candle.pha.pa.us=pgman@postgresql.org Tue Jan 29 19:25:30 2002
Return-path: <pgsql-hackers-owner+M18273=candle.pha.pa.us=pgman@postgresql.org>
Received: from server1.pgsql.org (www.postgresql.org [64.49.215.9])
	by candle.pha.pa.us (8.11.6/8.10.1) with SMTP id g0U0PUP06467
	for <pgman@candle.pha.pa.us>; Tue, 29 Jan 2002 19:25:30 -0500 (EST)
Received: (qmail 92158 invoked by alias); 30 Jan 2002 00:25:29 -0000
Received: from unknown (HELO postgresql.org) (64.49.215.8)
  by www.postgresql.org with SMTP; 30 Jan 2002 00:25:29 -0000
Received: from sd.tpf.co.jp (sd.tpf.co.jp [210.161.239.34])
	by postgresql.org (8.11.3/8.11.4) with SMTP id g0U0Kil91336
	for <pgsql-hackers@postgreSQL.org>; Tue, 29 Jan 2002 19:20:45 -0500 (EST)
	(envelope-from Inoue@tpf.co.jp)
Received: (qmail 18978 invoked from network); 30 Jan 2002 00:20:46 -0000
Received: from unknown (HELO viscomail.tpf.co.jp) (100.0.0.108)
  by sd2.tpf-fw-c.co.jp with SMTP; 30 Jan 2002 00:20:46 -0000
Received: from tpf.co.jp (3dgateway1 [126.0.1.60])
	by viscomail.tpf.co.jp (8.8.8+Sun/8.8.8) with ESMTP id JAA08622;
	Wed, 30 Jan 2002 09:20:44 +0900 (JST)
Message-ID: <3C573C5E.F01B48C2@tpf.co.jp>
Date: Wed, 30 Jan 2002 09:20:46 +0900
From: Hiroshi Inoue <Inoue@tpf.co.jp>
X-Mailer: Mozilla 4.73 [ja] (Windows NT 5.0; U)
X-Accept-Language: ja
MIME-Version: 1.0
To: Bill Studenmund <wrstuden@netbsd.org>, Peter Eisentraut <peter_e@gmx.net>,
   Tom Lane <tgl@sss.pgh.pa.us>
cc: PostgreSQL Development <pgsql-hackers@postgresql.org>
Subject: Re: [HACKERS] RFD: schemas and different kinds of Postgres objects
References: <Pine.NEB.4.33.0201290939350.24201-100000@vespasia.home-net.internetconnect.net>
Content-Type: text/plain; charset=iso-2022-jp
Content-Transfer-Encoding: 7bit
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR

Bill Studenmund wrote:
> 
> On Tue, 29 Jan 2002, Hiroshi Inoue wrote:
> 
> > What I can find in SQL99 is SQL-path.
> > Does *the path*(i.e search path) mean SQL-path ?
> > They don't seem the same to me.
> 
> While we may have not been using the terminology of the spec, I think we
> have been talking about schema paths from SQL99.
> 
> One difference between our discussions and SQL99 I've noticed is that
> we've spoken of having the path find functions (and operators and
> aggregates), types, _and_tables_.

My understanding is the same.
Tom, Peter is it right ?

> SQL99 doesn't have tables in there
> AFAICT, but I think it makes sense.

It seems to make sense but they are different and
our *path* is never an extension of SQL-path.
Where are the difference or the relevance referred
to in this thread ?

regards,
Hiroshi Inoue

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

From pgsql-hackers-owner+M18305=candle.pha.pa.us=pgman@postgresql.org Wed Jan 30 15:15:26 2002
Return-path: <pgsql-hackers-owner+M18305=candle.pha.pa.us=pgman@postgresql.org>
Received: from server1.pgsql.org (www.postgresql.org [64.49.215.9])
	by candle.pha.pa.us (8.11.6/8.10.1) with SMTP id g0UKFOP11825
	for <pgman@candle.pha.pa.us>; Wed, 30 Jan 2002 15:15:25 -0500 (EST)
Received: (qmail 72977 invoked by alias); 30 Jan 2002 20:15:22 -0000
Received: from unknown (HELO postgresql.org) (64.49.215.8)
  by www.postgresql.org with SMTP; 30 Jan 2002 20:15:22 -0000
Received: from mail.netbsd.org (mail.netbsd.org [155.53.1.253])
	by postgresql.org (8.11.3/8.11.4) with SMTP id g0UKEKl72120
	for <pgsql-hackers@postgreSQL.org>; Wed, 30 Jan 2002 15:14:20 -0500 (EST)
	(envelope-from wrstuden@netbsd.org)
Received: (qmail 23890 invoked by uid 1130); 30 Jan 2002 20:13:52 -0000
Date: Wed, 30 Jan 2002 12:08:54 -0800 (PST)
From: Bill Studenmund <wrstuden@netbsd.org>
X-X-Sender: <wrstuden@vespasia.home-net.internetconnect.net>
To: Hiroshi Inoue <Inoue@tpf.co.jp>
cc: Peter Eisentraut <peter_e@gmx.net>, Tom Lane <tgl@sss.pgh.pa.us>,
   PostgreSQL Development <pgsql-hackers@postgresql.org>
Subject: Re: [HACKERS] RFD: schemas and different kinds of Postgres objects
In-Reply-To: <3C573C5E.F01B48C2@tpf.co.jp>
Message-ID: <Pine.NEB.4.33.0201301207540.26920-100000@vespasia.home-net.internetconnect.net>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR

On Wed, 30 Jan 2002, Hiroshi Inoue wrote:

> Bill Studenmund wrote:
> >
> > On Tue, 29 Jan 2002, Hiroshi Inoue wrote:
> > SQL99 doesn't have tables in there
> > AFAICT, but I think it makes sense.
>
> It seems to make sense but they are different and
> our *path* is never an extension of SQL-path.
> Where are the difference or the relevance referred
> to in this thread ?

How is our path not an extention of SQL-path? Or at least how is the path
I've been pushing not an SQL-path?

Take care,

Bill


---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
    (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)

From pgsql-hackers-owner+M18307=candle.pha.pa.us=pgman@postgresql.org Wed Jan 30 16:15:23 2002
Return-path: <pgsql-hackers-owner+M18307=candle.pha.pa.us=pgman@postgresql.org>
Received: from server1.pgsql.org (www.postgresql.org [64.49.215.9])
	by candle.pha.pa.us (8.11.6/8.10.1) with SMTP id g0ULFMP19850
	for <pgman@candle.pha.pa.us>; Wed, 30 Jan 2002 16:15:22 -0500 (EST)
Received: (qmail 96622 invoked by alias); 30 Jan 2002 21:15:08 -0000
Received: from unknown (HELO postgresql.org) (64.49.215.8)
  by www.postgresql.org with SMTP; 30 Jan 2002 21:15:08 -0000
Received: from sss.pgh.pa.us ([192.204.191.242])
	by postgresql.org (8.11.3/8.11.4) with ESMTP id g0ULD4l95438
	for <pgsql-hackers@postgresql.org>; Wed, 30 Jan 2002 16:13:04 -0500 (EST)
	(envelope-from tgl@sss.pgh.pa.us)
Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1])
	by sss.pgh.pa.us (8.11.4/8.11.4) with ESMTP id g0ULCPf26128;
	Wed, 30 Jan 2002 16:12:25 -0500 (EST)
To: Stephan Szabo <sszabo@megazone23.bigpanda.com>
cc: Bill Studenmund <wrstuden@netbsd.org>, Peter Eisentraut <peter_e@gmx.net>,
   pgsql-hackers@postgresql.org, Fernando Nasser <fnasser@redhat.com>
Subject: Re: [HACKERS] RFD: schemas and different kinds of Postgres objects 
In-Reply-To: <20020123162426.K22713-100000@megazone23.bigpanda.com> 
References: <20020123162426.K22713-100000@megazone23.bigpanda.com>
Comments: In-reply-to Stephan Szabo <sszabo@megazone23.bigpanda.com>
	message dated "Wed, 23 Jan 2002 16:34:32 -0800"
Date: Wed, 30 Jan 2002 16:12:24 -0500
Message-ID: <26125.1012425144@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR

[ just catching up on this thread after a couple days thinking about
other things ]

Stephan Szabo <sszabo@megazone23.bigpanda.com> writes:
> AFAIK there's no way to specify that I want to make the function
> complex(integer) such that I can do CAST(1 as complex) but not as an
> implicit cast.

You may have forgotten that I recently suggested adding just such a
feature, ie a boolean flag on pg_proc rows to indicate whether they can
be considered for implicit casts.  I think we'd agreed that it would be
a good thing to do in 7.3.

However, that doesn't bear very much on the general argument of the
thread.  The bottom line is that we've put a whole lot of sweat into
developing rules for resolving ambiguous operator and function calls,
and I don't think we're going to be willing to toss all that effort into
the scrap heap.  But making namespace search order the dominant factor
in choosing a function/operator (as Bill seems to want) would certainly
break all that carefully-crafted effort.  If we put the system namespace
at the front of the search list then users would be unable to override
standard operators with schema-local substitutes; clearly that's no
good.  But if we put it at the back, then a schema-local user operator
would dominate all system entries of the same operator name, even for
quite different types, and thereby it would break the resolution
behavior.

So I'm still of the opinion that my original suggestion is the only
workable one: collect candidates across all available namespaces,
discarding only those that are exact matches to candidates in earlier
namespaces, and then apply the existing resolution rules to the
collection.  AFAICS this need not be any slower than what we do now,
if the catalog is set up so that we can collect candidates in one
indexscan without regard to namespace.  The case where there actually
are any exact matches to discard should be uncommon, so we can deal with
it later on in the resolution process.

			regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly

From pgsql-hackers-owner+M18308=candle.pha.pa.us=pgman@postgresql.org Wed Jan 30 16:25:39 2002
Return-path: <pgsql-hackers-owner+M18308=candle.pha.pa.us=pgman@postgresql.org>
Received: from server1.pgsql.org (www.postgresql.org [64.49.215.9])
	by candle.pha.pa.us (8.11.6/8.10.1) with SMTP id g0ULPcP20879
	for <pgman@candle.pha.pa.us>; Wed, 30 Jan 2002 16:25:38 -0500 (EST)
Received: (qmail 3172 invoked by alias); 30 Jan 2002 21:25:37 -0000
Received: from unknown (HELO postgresql.org) (64.49.215.8)
  by www.postgresql.org with SMTP; 30 Jan 2002 21:25:37 -0000
Received: from mail.netbsd.org (mail.netbsd.org [155.53.1.253])
	by postgresql.org (8.11.3/8.11.4) with SMTP id g0ULM4l01963
	for <pgsql-hackers@postgresql.org>; Wed, 30 Jan 2002 16:22:04 -0500 (EST)
	(envelope-from wrstuden@netbsd.org)
Received: (qmail 21064 invoked by uid 1130); 30 Jan 2002 21:22:04 -0000
Date: Wed, 30 Jan 2002 13:17:07 -0800 (PST)
From: Bill Studenmund <wrstuden@netbsd.org>
X-X-Sender: <wrstuden@vespasia.home-net.internetconnect.net>
To: Tom Lane <tgl@sss.pgh.pa.us>
cc: Stephan Szabo <sszabo@megazone23.bigpanda.com>,
   Peter Eisentraut <peter_e@gmx.net>, <pgsql-hackers@postgresql.org>,
   Fernando Nasser <fnasser@redhat.com>
Subject: Re: [HACKERS] RFD: schemas and different kinds of Postgres objects
In-Reply-To: <26125.1012425144@sss.pgh.pa.us>
Message-ID: <Pine.NEB.4.33.0201301311020.26920-100000@vespasia.home-net.internetconnect.net>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR

On Wed, 30 Jan 2002, Tom Lane wrote:

> [ just catching up on this thread after a couple days thinking about
> other things ]
>
> However, that doesn't bear very much on the general argument of the
> thread.  The bottom line is that we've put a whole lot of sweat into
> developing rules for resolving ambiguous operator and function calls,
> and I don't think we're going to be willing to toss all that effort into
> the scrap heap.  But making namespace search order the dominant factor
> in choosing a function/operator (as Bill seems to want) would certainly
> break all that carefully-crafted effort.  If we put the system namespace
> at the front of the search list then users would be unable to override
> standard operators with schema-local substitutes; clearly that's no
> good.  But if we put it at the back, then a schema-local user operator
> would dominate all system entries of the same operator name, even for
> quite different types, and thereby it would break the resolution
> behavior.

I've changed my mind. :-)

> So I'm still of the opinion that my original suggestion is the only
> workable one: collect candidates across all available namespaces,
> discarding only those that are exact matches to candidates in earlier
> namespaces, and then apply the existing resolution rules to the
> collection.  AFAICS this need not be any slower than what we do now,
> if the catalog is set up so that we can collect candidates in one
> indexscan without regard to namespace.  The case where there actually
> are any exact matches to discard should be uncommon, so we can deal with
> it later on in the resolution process.

Sounds like the thing to do, and it matches the spec. :-)

Oh, you can make a path with your namespace before the built-in one. It's
just that if you don't include the built-in one (IMPLIMENTATION_SCHEMA) in
a path, you're supposed to prepend it to the specified list.

Take care,

Bill



---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

From pgsql-hackers-owner+M18311=candle.pha.pa.us=pgman@postgresql.org Wed Jan 30 18:15:49 2002
Return-path: <pgsql-hackers-owner+M18311=candle.pha.pa.us=pgman@postgresql.org>
Received: from server1.pgsql.org (www.postgresql.org [64.49.215.9])
	by candle.pha.pa.us (8.11.6/8.10.1) with SMTP id g0UNFmP04299
	for <pgman@candle.pha.pa.us>; Wed, 30 Jan 2002 18:15:48 -0500 (EST)
Received: (qmail 40895 invoked by alias); 30 Jan 2002 23:15:47 -0000
Received: from unknown (HELO postgresql.org) (64.49.215.8)
  by www.postgresql.org with SMTP; 30 Jan 2002 23:15:47 -0000
Received: from sss.pgh.pa.us ([192.204.191.242])
	by postgresql.org (8.11.3/8.11.4) with ESMTP id g0UNDrl39795
	for <pgsql-hackers@postgresql.org>; Wed, 30 Jan 2002 18:13:53 -0500 (EST)
	(envelope-from tgl@sss.pgh.pa.us)
Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1])
	by sss.pgh.pa.us (8.11.4/8.11.4) with ESMTP id g0UND7f27530;
	Wed, 30 Jan 2002 18:13:07 -0500 (EST)
To: Hiroshi Inoue <Inoue@tpf.co.jp>
cc: Bill Studenmund <wrstuden@netbsd.org>, Peter Eisentraut <peter_e@gmx.net>,
   PostgreSQL Development <pgsql-hackers@postgresql.org>
Subject: Re: [HACKERS] RFD: schemas and different kinds of Postgres objects 
In-Reply-To: <3C573C5E.F01B48C2@tpf.co.jp> 
References: <Pine.NEB.4.33.0201290939350.24201-100000@vespasia.home-net.internetconnect.net> <3C573C5E.F01B48C2@tpf.co.jp>
Comments: In-reply-to Hiroshi Inoue <Inoue@tpf.co.jp>
	message dated "Wed, 30 Jan 2002 09:20:46 +0900"
Date: Wed, 30 Jan 2002 18:13:06 -0500
Message-ID: <27527.1012432386@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR

Hiroshi Inoue <Inoue@tpf.co.jp> writes:
> Bill Studenmund wrote:
>> While we may have not been using the terminology of the spec, I think we
>> have been talking about schema paths from SQL99.
>> 
>> One difference between our discussions and SQL99 I've noticed is that
>> we've spoken of having the path find functions (and operators and
>> aggregates), types, _and_tables_.

> My understanding is the same.
> Tom, Peter is it right ?

SQL99's SQL-path is very clearly stated to be used only for looking up
routines and user-defined type names.  Extending it to cover tables,
operators, and so forth makes sense to me, but we have to recognize
that it is a spec extension and therefore not all the answers we need
can be found in the spec.

I also find it curious that they exclude standard type names from the
search path.  It would seem obvious to treat the standard type names
as included in a schema that is part of the search path, but AFAICT
this is not done in the spec.  Postgres *has to* do it that way,
however, or give up our whole approach to datatypes; surely we don't
want to hardwire the SQL-standard datatypes into the parser to the
exclusion of the not-so-standard ones.

IMHO, the spec's artificial distinction between system and user types
limits its usefulness as a guide to the questions we're debating here.

			regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/users-lounge/docs/faq.html

From pgsql-hackers-owner+M18312=candle.pha.pa.us=pgman@postgresql.org Wed Jan 30 18:55:30 2002
Return-path: <pgsql-hackers-owner+M18312=candle.pha.pa.us=pgman@postgresql.org>
Received: from server1.pgsql.org (www.postgresql.org [64.49.215.9])
	by candle.pha.pa.us (8.11.6/8.10.1) with SMTP id g0UNtSP08482
	for <pgman@candle.pha.pa.us>; Wed, 30 Jan 2002 18:55:29 -0500 (EST)
Received: (qmail 58399 invoked by alias); 30 Jan 2002 23:55:26 -0000
Received: from unknown (HELO postgresql.org) (64.49.215.8)
  by www.postgresql.org with SMTP; 30 Jan 2002 23:55:26 -0000
Received: from mail.netbsd.org (mail.netbsd.org [155.53.1.253])
	by postgresql.org (8.11.3/8.11.4) with SMTP id g0UNqhl56957
	for <pgsql-hackers@postgresql.org>; Wed, 30 Jan 2002 18:52:43 -0500 (EST)
	(envelope-from wrstuden@netbsd.org)
Received: (qmail 17164 invoked by uid 1130); 30 Jan 2002 23:46:06 -0000
Date: Wed, 30 Jan 2002 15:41:09 -0800 (PST)
From: Bill Studenmund <wrstuden@netbsd.org>
X-X-Sender: <wrstuden@vespasia.home-net.internetconnect.net>
To: Tom Lane <tgl@sss.pgh.pa.us>
cc: Hiroshi Inoue <Inoue@tpf.co.jp>, Peter Eisentraut <peter_e@gmx.net>,
   PostgreSQL Development <pgsql-hackers@postgresql.org>
Subject: Re: [HACKERS] RFD: schemas and different kinds of Postgres objects
In-Reply-To: <27527.1012432386@sss.pgh.pa.us>
Message-ID: <Pine.NEB.4.33.0201301529010.26920-100000@vespasia.home-net.internetconnect.net>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR

On Wed, 30 Jan 2002, Tom Lane wrote:

> Hiroshi Inoue <Inoue@tpf.co.jp> writes:
> > Bill Studenmund wrote:
> >> While we may have not been using the terminology of the spec, I think we
> >> have been talking about schema paths from SQL99.
> >>
> >> One difference between our discussions and SQL99 I've noticed is that
> >> we've spoken of having the path find functions (and operators and
> >> aggregates), types, _and_tables_.
>
> > My understanding is the same.
> > Tom, Peter is it right ?
>
> SQL99's SQL-path is very clearly stated to be used only for looking up
> routines and user-defined type names.  Extending it to cover tables,
> operators, and so forth makes sense to me, but we have to recognize
> that it is a spec extension and therefore not all the answers we need
> can be found in the spec.

True. I think that extending the path to be used for operators and
aggregates makes sense as they are special types of function calls. The
searching for tables might need to be a configurable parameter (defaulting
to yes), though. I think it makes sense to do, but I can imagine cases
where apps need to not.

> I also find it curious that they exclude standard type names from the
> search path.  It would seem obvious to treat the standard type names
> as included in a schema that is part of the search path, but AFAICT
> this is not done in the spec.  Postgres *has to* do it that way,
> however, or give up our whole approach to datatypes; surely we don't
> want to hardwire the SQL-standard datatypes into the parser to the
> exclusion of the not-so-standard ones.
>
> IMHO, the spec's artificial distinction between system and user types
> limits its usefulness as a guide to the questions we're debating here.

True.

Does SQL99 support types as flexable as the ones we do? I know types in
Oracle are basically special cases of already built-in ones...

Take care,

Bill


---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
    (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)

From pgsql-hackers-owner+M18314=candle.pha.pa.us=pgman@postgresql.org Wed Jan 30 19:15:14 2002
Return-path: <pgsql-hackers-owner+M18314=candle.pha.pa.us=pgman@postgresql.org>
Received: from server1.pgsql.org (www.postgresql.org [64.49.215.9])
	by candle.pha.pa.us (8.11.6/8.10.1) with SMTP id g0V0FDP11130
	for <pgman@candle.pha.pa.us>; Wed, 30 Jan 2002 19:15:14 -0500 (EST)
Received: (qmail 70218 invoked by alias); 31 Jan 2002 00:15:12 -0000
Received: from unknown (HELO postgresql.org) (64.49.215.8)
  by www.postgresql.org with SMTP; 31 Jan 2002 00:15:12 -0000
Received: from sd.tpf.co.jp (sd.tpf.co.jp [210.161.239.34])
	by postgresql.org (8.11.3/8.11.4) with SMTP id g0UNtQl58401
	for <pgsql-hackers@postgreSQL.org>; Wed, 30 Jan 2002 18:55:28 -0500 (EST)
	(envelope-from Inoue@tpf.co.jp)
Received: (qmail 11171 invoked from network); 30 Jan 2002 23:55:24 -0000
Received: from unknown (HELO viscomail.tpf.co.jp) (100.0.0.108)
  by sd2.tpf-fw-c.co.jp with SMTP; 30 Jan 2002 23:55:24 -0000
Received: from tpf.co.jp (3dgateway1 [126.0.1.60])
	by viscomail.tpf.co.jp (8.8.8+Sun/8.8.8) with ESMTP id IAA10232;
	Thu, 31 Jan 2002 08:55:17 +0900 (JST)
Message-ID: <3C5887E8.CE7E569F@tpf.co.jp>
Date: Thu, 31 Jan 2002 08:55:20 +0900
From: Hiroshi Inoue <Inoue@tpf.co.jp>
X-Mailer: Mozilla 4.73 [ja] (Windows NT 5.0; U)
X-Accept-Language: ja
MIME-Version: 1.0
To: Bill Studenmund <wrstuden@netbsd.org>
cc: Peter Eisentraut <peter_e@gmx.net>, Tom Lane <tgl@sss.pgh.pa.us>,
   PostgreSQL Development <pgsql-hackers@postgresql.org>
Subject: Re: [HACKERS] RFD: schemas and different kinds of Postgres objects
References: <Pine.NEB.4.33.0201301207540.26920-100000@vespasia.home-net.internetconnect.net>
Content-Type: text/plain; charset=iso-2022-jp
Content-Transfer-Encoding: 7bit
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR

Bill Studenmund wrote:
> 
> On Wed, 30 Jan 2002, Hiroshi Inoue wrote:
> 
> > Bill Studenmund wrote:
> > >
> > > On Tue, 29 Jan 2002, Hiroshi Inoue wrote:
> > > SQL99 doesn't have tables in there
> > > AFAICT, but I think it makes sense.
> >
> > It seems to make sense but they are different and
> > our *path* is never an extension of SQL-path.
> > Where are the difference or the relevance referred
> > to in this thread ?
> 
> How is our path not an extention of SQL-path? Or at least how is the path
> I've been pushing not an SQL-path?

IMHO _tables_like objects must be guarded from such
a search mechanism fundamentally. I don't object to
the use of our *path* but it should be distinguished
from SQL-path.

For example the PATH environment variable is used
only to search executables not files. Is it
preferable for *rm a_file* to search all the directory
in the PATH ? If the purpose is different the different
*path* is needed of cource. 

regards,
Hiroshi Inoue

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
    (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)

From pgsql-hackers-owner+M18317=candle.pha.pa.us=pgman@postgresql.org Wed Jan 30 21:15:26 2002
Return-path: <pgsql-hackers-owner+M18317=candle.pha.pa.us=pgman@postgresql.org>
Received: from server1.pgsql.org (www.postgresql.org [64.49.215.9])
	by candle.pha.pa.us (8.11.6/8.10.1) with SMTP id g0V2FPP23342
	for <pgman@candle.pha.pa.us>; Wed, 30 Jan 2002 21:15:25 -0500 (EST)
Received: (qmail 15445 invoked by alias); 31 Jan 2002 02:15:12 -0000
Received: from unknown (HELO postgresql.org) (64.49.215.8)
  by www.postgresql.org with SMTP; 31 Jan 2002 02:15:12 -0000
Received: from sd.tpf.co.jp (sd.tpf.co.jp [210.161.239.34])
	by postgresql.org (8.11.3/8.11.4) with SMTP id g0V1v1l07129
	for <pgsql-hackers@postgresql.org>; Wed, 30 Jan 2002 20:57:01 -0500 (EST)
	(envelope-from Inoue@tpf.co.jp)
Received: (qmail 21526 invoked from network); 31 Jan 2002 01:57:03 -0000
Received: from unknown (HELO viscomail.tpf.co.jp) (100.0.0.108)
  by sd2.tpf-fw-c.co.jp with SMTP; 31 Jan 2002 01:57:03 -0000
Received: from tpf.co.jp (3dgateway1 [126.0.1.60])
	by viscomail.tpf.co.jp (8.8.8+Sun/8.8.8) with ESMTP id KAA10366;
	Thu, 31 Jan 2002 10:57:02 +0900 (JST)
Message-ID: <3C58A472.2E90C21C@tpf.co.jp>
Date: Thu, 31 Jan 2002 10:57:06 +0900
From: Hiroshi Inoue <Inoue@tpf.co.jp>
X-Mailer: Mozilla 4.73 [ja] (Windows NT 5.0; U)
X-Accept-Language: ja
MIME-Version: 1.0
To: Tom Lane <tgl@sss.pgh.pa.us>
cc: Bill Studenmund <wrstuden@netbsd.org>, Peter Eisentraut <peter_e@gmx.net>,
   PostgreSQL Development <pgsql-hackers@postgresql.org>
Subject: Re: [HACKERS] RFD: schemas and different kinds of Postgres objects
References: <Pine.NEB.4.33.0201290939350.24201-100000@vespasia.home-net.internetconnect.net> <3C573C5E.F01B48C2@tpf.co.jp> <27527.1012432386@sss.pgh.pa.us>
Content-Type: text/plain; charset=iso-2022-jp
Content-Transfer-Encoding: 7bit
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR

Tom Lane wrote:
> 
> Hiroshi Inoue <Inoue@tpf.co.jp> writes:
> > Bill Studenmund wrote:
> >> While we may have not been using the terminology of the spec, I think we
> >> have been talking about schema paths from SQL99.
> >>
> >> One difference between our discussions and SQL99 I've noticed is that
> >> we've spoken of having the path find functions (and operators and
> >> aggregates), types, _and_tables_.
> 
> > My understanding is the same.
> > Tom, Peter is it right ?
> 
> SQL99's SQL-path is very clearly stated to be used only for looking up
> routines and user-defined type names.  Extending it to cover tables,
> operators, and so forth makes sense to me,

I have no objection to the point it makes sense to use
such *path*s internally but I think it also has a siginificance
for SQL-path to not look up _tables_like objects. 
I think they are different from the first and we should(need)
not manage the system with one *path*.

BTW I see few references to *catalog*. Would the concept
of catalog be introduced together. If so what would be
contained in the current database.

regards,
Hiroshi Inoue

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
    (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)

From pgsql-hackers-owner+M18319=candle.pha.pa.us=pgman@postgresql.org Wed Jan 30 21:45:37 2002
Return-path: <pgsql-hackers-owner+M18319=candle.pha.pa.us=pgman@postgresql.org>
Received: from server1.pgsql.org (www.postgresql.org [64.49.215.9])
	by candle.pha.pa.us (8.11.6/8.10.1) with SMTP id g0V2jZP27049
	for <pgman@candle.pha.pa.us>; Wed, 30 Jan 2002 21:45:36 -0500 (EST)
Received: (qmail 27626 invoked by alias); 31 Jan 2002 02:45:32 -0000
Received: from unknown (HELO postgresql.org) (64.49.215.8)
  by www.postgresql.org with SMTP; 31 Jan 2002 02:45:32 -0000
Received: from sss.pgh.pa.us ([192.204.191.242])
	by postgresql.org (8.11.3/8.11.4) with ESMTP id g0V2Wfl22316
	for <pgsql-hackers@postgresql.org>; Wed, 30 Jan 2002 21:32:41 -0500 (EST)
	(envelope-from tgl@sss.pgh.pa.us)
Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1])
	by sss.pgh.pa.us (8.11.4/8.11.4) with ESMTP id g0V2WAf29271;
	Wed, 30 Jan 2002 21:32:10 -0500 (EST)
To: Hiroshi Inoue <Inoue@tpf.co.jp>
cc: Bill Studenmund <wrstuden@netbsd.org>, Peter Eisentraut <peter_e@gmx.net>,
   PostgreSQL Development <pgsql-hackers@postgresql.org>
Subject: Re: [HACKERS] RFD: schemas and different kinds of Postgres objects 
In-Reply-To: <3C58A472.2E90C21C@tpf.co.jp> 
References: <Pine.NEB.4.33.0201290939350.24201-100000@vespasia.home-net.internetconnect.net> <3C573C5E.F01B48C2@tpf.co.jp> <27527.1012432386@sss.pgh.pa.us> <3C58A472.2E90C21C@tpf.co.jp>
Comments: In-reply-to Hiroshi Inoue <Inoue@tpf.co.jp>
	message dated "Thu, 31 Jan 2002 10:57:06 +0900"
Date: Wed, 30 Jan 2002 21:32:10 -0500
Message-ID: <29268.1012444330@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR

Hiroshi Inoue <Inoue@tpf.co.jp> writes:
> I have no objection to the point it makes sense to use
> such *path*s internally but I think it also has a siginificance
> for SQL-path to not look up _tables_like objects. 
> I think they are different from the first and we should(need)
> not manage the system with one *path*.

I'm unconvinced.  We must search for datatypes and tables on the same
path because tables have associated datatypes; it will definitely not
do to look for a table's datatype and get the wrong type.  And I think
that functions and operators should be looked for on the same path
as datatypes, because a type should be pretty closely associated with
the functions/operators for it.  So it seems to me that the apparent
flexibility of having more than one path is just a way to shoot yourself
in the foot.  Why are you concerned that we keep them separate?

> BTW I see few references to *catalog*. Would the concept
> of catalog be introduced together. If so what would be
> contained in the current database.

My thought is that we will consider catalog == database.  As far as
I can tell, that is a legitimate implementation-defined way of
interpreting the spec.  (It's not clear to me what the value is of
having more than one level of schema hierarchy; or at least, if you want
hierarchical namespaces, there's no argument for stopping at depth two.
But I digress.)  To satisfy the spec we must allow a (purely decorative)
specification of the current database name as the catalog level of a
qualified name, but that's as far as I want to go.  In this round,
anyway.  Cross-database access is not something to tackle for 7.3.

			regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
    (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)

From pgsql-hackers-owner+M18323=candle.pha.pa.us=pgman@postgresql.org Wed Jan 30 22:45:10 2002
Return-path: <pgsql-hackers-owner+M18323=candle.pha.pa.us=pgman@postgresql.org>
Received: from server1.pgsql.org (www.postgresql.org [64.49.215.9])
	by candle.pha.pa.us (8.11.6/8.10.1) with SMTP id g0V3j9P04896
	for <pgman@candle.pha.pa.us>; Wed, 30 Jan 2002 22:45:09 -0500 (EST)
Received: (qmail 48073 invoked by alias); 31 Jan 2002 03:45:06 -0000
Received: from unknown (HELO postgresql.org) (64.49.215.8)
  by www.postgresql.org with SMTP; 31 Jan 2002 03:45:06 -0000
Received: from sd.tpf.co.jp (sd.tpf.co.jp [210.161.239.34])
	by postgresql.org (8.11.3/8.11.4) with SMTP id g0V3aPl45009
	for <pgsql-hackers@postgresql.org>; Wed, 30 Jan 2002 22:36:27 -0500 (EST)
	(envelope-from Inoue@tpf.co.jp)
Received: (qmail 31045 invoked from network); 31 Jan 2002 03:36:21 -0000
Received: from unknown (HELO viscomail.tpf.co.jp) (100.0.0.108)
  by sd2.tpf-fw-c.co.jp with SMTP; 31 Jan 2002 03:36:21 -0000
Received: from tpf.co.jp (3dgateway1 [126.0.1.60])
	by viscomail.tpf.co.jp (8.8.8+Sun/8.8.8) with ESMTP id MAA10485;
	Thu, 31 Jan 2002 12:36:15 +0900 (JST)
Message-ID: <3C58BBB3.58D5F964@tpf.co.jp>
Date: Thu, 31 Jan 2002 12:36:19 +0900
From: Hiroshi Inoue <Inoue@tpf.co.jp>
X-Mailer: Mozilla 4.73 [ja] (Windows NT 5.0; U)
X-Accept-Language: ja
MIME-Version: 1.0
To: Tom Lane <tgl@sss.pgh.pa.us>
cc: Bill Studenmund <wrstuden@netbsd.org>, Peter Eisentraut <peter_e@gmx.net>,
   PostgreSQL Development <pgsql-hackers@postgresql.org>
Subject: Re: [HACKERS] RFD: schemas and different kinds of Postgres objects
References: <Pine.NEB.4.33.0201290939350.24201-100000@vespasia.home-net.internetconnect.net> <3C573C5E.F01B48C2@tpf.co.jp> <27527.1012432386@sss.pgh.pa.us> <3C58A472.2E90C21C@tpf.co.jp> <29268.1012444330@sss.pgh.pa.us>
Content-Type: text/plain; charset=iso-2022-jp
Content-Transfer-Encoding: 7bit
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR

Tom Lane wrote:
> 
> Hiroshi Inoue <Inoue@tpf.co.jp> writes:
> > I have no objection to the point it makes sense to use
> > such *path*s internally but I think it also has a siginificance
> > for SQL-path to not look up _tables_like objects.
> > I think they are different from the first and we should(need)
> > not manage the system with one *path*.
> 
> I'm unconvinced.  We must search for datatypes and tables on the same
> path because tables have associated datatypes;

Isn't the table definition a part of the datatype in
such a case ?

> it will definitely not
> do to look for a table's datatype and get the wrong type.  And I think
> that functions and operators should be looked for on the same path
> as datatypes, because a type should be pretty closely associated with
> the functions/operators for it.  So it seems to me that the apparent
> flexibility of having more than one path is just a way to shoot yourself
> in the foot.  Why are you concerned that we keep them separate?

For example, doesn't 'DROP table a_table' drop the 
a_table table in a schema in the *path* if there's
no a_table table in the current schema ?

If we would never introduce SQL-paths (in the future)
there would be problem.

regards,
Hiroshi Inoue

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
    (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)

From pgsql-hackers-owner+M18325=candle.pha.pa.us=pgman@postgresql.org Wed Jan 30 22:55:24 2002
Return-path: <pgsql-hackers-owner+M18325=candle.pha.pa.us=pgman@postgresql.org>
Received: from server1.pgsql.org (www.postgresql.org [64.49.215.9])
	by candle.pha.pa.us (8.11.6/8.10.1) with SMTP id g0V3tOP06352
	for <pgman@candle.pha.pa.us>; Wed, 30 Jan 2002 22:55:24 -0500 (EST)
Received: (qmail 52777 invoked by alias); 31 Jan 2002 03:55:21 -0000
Received: from unknown (HELO postgresql.org) (64.49.215.8)
  by www.postgresql.org with SMTP; 31 Jan 2002 03:55:21 -0000
Received: from sss.pgh.pa.us ([192.204.191.242])
	by postgresql.org (8.11.3/8.11.4) with ESMTP id g0V3iml47386
	for <pgsql-hackers@postgresql.org>; Wed, 30 Jan 2002 22:44:48 -0500 (EST)
	(envelope-from tgl@sss.pgh.pa.us)
Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1])
	by sss.pgh.pa.us (8.11.4/8.11.4) with ESMTP id g0V3hff29736;
	Wed, 30 Jan 2002 22:43:42 -0500 (EST)
To: Hiroshi Inoue <Inoue@tpf.co.jp>
cc: Bill Studenmund <wrstuden@netbsd.org>, Peter Eisentraut <peter_e@gmx.net>,
   PostgreSQL Development <pgsql-hackers@postgresql.org>
Subject: Re: [HACKERS] RFD: schemas and different kinds of Postgres objects 
In-Reply-To: <3C58BBB3.58D5F964@tpf.co.jp> 
References: <Pine.NEB.4.33.0201290939350.24201-100000@vespasia.home-net.internetconnect.net> <3C573C5E.F01B48C2@tpf.co.jp> <27527.1012432386@sss.pgh.pa.us> <3C58A472.2E90C21C@tpf.co.jp> <29268.1012444330@sss.pgh.pa.us> <3C58BBB3.58D5F964@tpf.co.jp>
Comments: In-reply-to Hiroshi Inoue <Inoue@tpf.co.jp>
	message dated "Thu, 31 Jan 2002 12:36:19 +0900"
Date: Wed, 30 Jan 2002 22:43:41 -0500
Message-ID: <29733.1012448621@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR

Hiroshi Inoue <Inoue@tpf.co.jp> writes:
> For example, doesn't 'DROP table a_table' drop the 
> a_table table in a schema in the *path* if there's
> no a_table table in the current schema ?

Sure.  And that's exactly what it should do, IMHO.
Otherwise the notion that you can ignore your private
schema (at the front of the path) if you're not using
it falls down.  Also, we wouldn't be able to implement
temp tables via a backend-local schema at the front of
the path.

Any security concerns here should be addressed by putting
ACLs on the schemas you don't want altered; not by contorting
the notion of a search path to work for some operations and
not others.

			regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

From pgsql-hackers-owner+M18326=candle.pha.pa.us=pgman@postgresql.org Wed Jan 30 23:15:07 2002
Return-path: <pgsql-hackers-owner+M18326=candle.pha.pa.us=pgman@postgresql.org>
Received: from server1.pgsql.org (www.postgresql.org [64.49.215.9])
	by candle.pha.pa.us (8.11.6/8.10.1) with SMTP id g0V4F6P09920
	for <pgman@candle.pha.pa.us>; Wed, 30 Jan 2002 23:15:06 -0500 (EST)
Received: (qmail 57935 invoked by alias); 31 Jan 2002 04:15:03 -0000
Received: from unknown (HELO postgresql.org) (64.49.215.8)
  by www.postgresql.org with SMTP; 31 Jan 2002 04:15:03 -0000
Received: from sd.tpf.co.jp (sd.tpf.co.jp [210.161.239.34])
	by postgresql.org (8.11.3/8.11.4) with SMTP id g0V3lIl50338
	for <pgsql-hackers@postgresql.org>; Wed, 30 Jan 2002 22:47:20 -0500 (EST)
	(envelope-from Inoue@tpf.co.jp)
Received: (qmail 31967 invoked from network); 31 Jan 2002 03:47:17 -0000
Received: from unknown (HELO viscomail.tpf.co.jp) (100.0.0.108)
  by sd2.tpf-fw-c.co.jp with SMTP; 31 Jan 2002 03:47:17 -0000
Received: from tpf.co.jp (3dgateway1 [126.0.1.60])
	by viscomail.tpf.co.jp (8.8.8+Sun/8.8.8) with ESMTP id MAA10500;
	Thu, 31 Jan 2002 12:47:17 +0900 (JST)
Message-ID: <3C58BE48.AD4EE527@tpf.co.jp>
Date: Thu, 31 Jan 2002 12:47:20 +0900
From: Hiroshi Inoue <Inoue@tpf.co.jp>
X-Mailer: Mozilla 4.73 [ja] (Windows NT 5.0; U)
X-Accept-Language: ja
MIME-Version: 1.0
To: Tom Lane <tgl@sss.pgh.pa.us>
cc: Bill Studenmund <wrstuden@netbsd.org>, Peter Eisentraut <peter_e@gmx.net>,
   PostgreSQL Development <pgsql-hackers@postgresql.org>
Subject: Re: [HACKERS] RFD: schemas and different kinds of Postgres objects
References: <Pine.NEB.4.33.0201290939350.24201-100000@vespasia.home-net.internetconnect.net> <3C573C5E.F01B48C2@tpf.co.jp> <27527.1012432386@sss.pgh.pa.us> <3C58A472.2E90C21C@tpf.co.jp> <29268.1012444330@sss.pgh.pa.us>
Content-Type: text/plain; charset=iso-2022-jp
Content-Transfer-Encoding: 7bit
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR

Tom Lane wrote:
> 
> Hiroshi Inoue <Inoue@tpf.co.jp> writes:
> 
> > BTW I see few references to *catalog*. Would the concept
> > of catalog be introduced together. If so what would be
> > contained in the current database.
> 
> My thought is that we will consider catalog == database.  As far as
> I can tell, that is a legitimate implementation-defined way of
> interpreting the spec.  (It's not clear to me what the value is of
> having more than one level of schema hierarchy; or at least, if you want
> hierarchical namespaces, there's no argument for stopping at depth two.
> But I digress.)  To satisfy the spec we must allow a (purely decorative)
> specification of the current database name as the catalog level of a
> qualified name, but that's as far as I want to go.  In this round,
> anyway.  Cross-database access is not something to tackle for 7.3.

Just a confirmation.
We can't see any catalog.schema.object notation in 7.3,
can we ?

regards,
Hiroshi Inoue

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

From pgsql-hackers-owner+M18324=candle.pha.pa.us=pgman@postgresql.org Wed Jan 30 22:55:24 2002
Return-path: <pgsql-hackers-owner+M18324=candle.pha.pa.us=pgman@postgresql.org>
Received: from server1.pgsql.org (www.postgresql.org [64.49.215.9])
	by candle.pha.pa.us (8.11.6/8.10.1) with SMTP id g0V3tOP06351
	for <pgman@candle.pha.pa.us>; Wed, 30 Jan 2002 22:55:24 -0500 (EST)
Received: (qmail 52747 invoked by alias); 31 Jan 2002 03:55:20 -0000
Received: from unknown (HELO postgresql.org) (64.49.215.8)
  by www.postgresql.org with SMTP; 31 Jan 2002 03:55:20 -0000
Received: from sss.pgh.pa.us ([192.204.191.242])
	by postgresql.org (8.11.3/8.11.4) with ESMTP id g0V3pTl51655
	for <pgsql-hackers@postgresql.org>; Wed, 30 Jan 2002 22:51:29 -0500 (EST)
	(envelope-from tgl@sss.pgh.pa.us)
Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1])
	by sss.pgh.pa.us (8.11.4/8.11.4) with ESMTP id g0V3p0f29810;
	Wed, 30 Jan 2002 22:51:00 -0500 (EST)
To: Hiroshi Inoue <Inoue@tpf.co.jp>
cc: Bill Studenmund <wrstuden@netbsd.org>, Peter Eisentraut <peter_e@gmx.net>,
   PostgreSQL Development <pgsql-hackers@postgresql.org>
Subject: Re: [HACKERS] RFD: schemas and different kinds of Postgres objects 
In-Reply-To: <3C58BE48.AD4EE527@tpf.co.jp> 
References: <Pine.NEB.4.33.0201290939350.24201-100000@vespasia.home-net.internetconnect.net> <3C573C5E.F01B48C2@tpf.co.jp> <27527.1012432386@sss.pgh.pa.us> <3C58A472.2E90C21C@tpf.co.jp> <29268.1012444330@sss.pgh.pa.us> <3C58BE48.AD4EE527@tpf.co.jp>
Comments: In-reply-to Hiroshi Inoue <Inoue@tpf.co.jp>
	message dated "Thu, 31 Jan 2002 12:47:20 +0900"
Date: Wed, 30 Jan 2002 22:51:00 -0500
Message-ID: <29807.1012449060@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR

Hiroshi Inoue <Inoue@tpf.co.jp> writes:
> Just a confirmation.
> We can't see any catalog.schema.object notation in 7.3,
> can we ?

No, what I meant was you could write catalog.schema.object --- but for
7.3, the system will only accept it if the catalog name is the same as
the current database.  This satisfies the minimum requirements of the
spec, and it leaves notational room to use the catalog name as the cue
for cross-database access, if we ever decide we want to try to do that.

			regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

From pgsql-hackers-owner+M18334=candle.pha.pa.us=pgman@postgresql.org Thu Jan 31 05:45:28 2002
Return-path: <pgsql-hackers-owner+M18334=candle.pha.pa.us=pgman@postgresql.org>
Received: from server1.pgsql.org (www.postgresql.org [64.49.215.9])
	by candle.pha.pa.us (8.11.6/8.10.1) with SMTP id g0VAjRP11000
	for <pgman@candle.pha.pa.us>; Thu, 31 Jan 2002 05:45:27 -0500 (EST)
Received: (qmail 4065 invoked by alias); 31 Jan 2002 10:45:25 -0000
Received: from unknown (HELO postgresql.org) (64.49.215.8)
  by www.postgresql.org with SMTP; 31 Jan 2002 10:45:25 -0000
Received: from sd.tpf.co.jp (sd.tpf.co.jp [210.161.239.34])
	by postgresql.org (8.11.3/8.11.4) with SMTP id g0VAbGl02141
	for <pgsql-hackers@postgresql.org>; Thu, 31 Jan 2002 05:37:17 -0500 (EST)
	(envelope-from Inoue@tpf.co.jp)
Received: (qmail 30401 invoked from network); 31 Jan 2002 10:37:17 -0000
Received: from unknown (HELO viscomail.tpf.co.jp) (100.0.0.108)
  by sd2.tpf-fw-c.co.jp with SMTP; 31 Jan 2002 10:37:17 -0000
Received: from tpf.co.jp (3dgateway1 [126.0.1.60])
	by viscomail.tpf.co.jp (8.8.8+Sun/8.8.8) with ESMTP id TAA10891;
	Thu, 31 Jan 2002 19:37:15 +0900 (JST)
Message-ID: <3C591E5E.14549DF@tpf.co.jp>
Date: Thu, 31 Jan 2002 19:37:18 +0900
From: Hiroshi Inoue <Inoue@tpf.co.jp>
X-Mailer: Mozilla 4.73 [ja] (Windows NT 5.0; U)
X-Accept-Language: ja
MIME-Version: 1.0
To: Tom Lane <tgl@sss.pgh.pa.us>
cc: Bill Studenmund <wrstuden@netbsd.org>, Peter Eisentraut <peter_e@gmx.net>,
   PostgreSQL Development <pgsql-hackers@postgresql.org>
Subject: Re: [HACKERS] RFD: schemas and different kinds of Postgres objects
References: <Pine.NEB.4.33.0201290939350.24201-100000@vespasia.home-net.internetconnect.net> <3C573C5E.F01B48C2@tpf.co.jp> <27527.1012432386@sss.pgh.pa.us> <3C58A472.2E90C21C@tpf.co.jp> <29268.1012444330@sss.pgh.pa.us> <3C58BBB3.58D5F964@tpf.co.jp> <29733.1012448621@sss.pgh.pa.us>
Content-Type: text/plain; charset=iso-2022-jp
Content-Transfer-Encoding: 7bit
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR

Tom Lane wrote:
> 
> Hiroshi Inoue <Inoue@tpf.co.jp> writes:
> > For example, doesn't 'DROP table a_table' drop the
> > a_table table in a schema in the *path* if there's
> > no a_table table in the current schema ?
> 
> Sure.  And that's exactly what it should do, IMHO.
> Otherwise the notion that you can ignore your private
> schema (at the front of the path) if you're not using
> it falls down.  Also, we wouldn't be able to implement
> temp tables via a backend-local schema at the front of
> the path.

I don't think it's useful for tables other than temp
ones and I wouldn't use it other than for temp ones.

When we type 'rm a_file' in a shell environment
does the *rm* command search the PATH in finding
the a_file file ? Even though we need to implement
such a search mechanism we would use another path
different from the executable search PATH. I don't
think our *path* is an extension of SQL-path.

I wouldn't complain unless we call the *path*
as SQL-path or an extension of SQL-path.

regards,
Hiroshi Inoue

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

From pgsql-hackers-owner+M18340=candle.pha.pa.us=pgman@postgresql.org Thu Jan 31 11:55:49 2002
Return-path: <pgsql-hackers-owner+M18340=candle.pha.pa.us=pgman@postgresql.org>
Received: from server1.pgsql.org (www.postgresql.org [64.49.215.9])
	by candle.pha.pa.us (8.11.6/8.10.1) with SMTP id g0VGtmP13664
	for <pgman@candle.pha.pa.us>; Thu, 31 Jan 2002 11:55:48 -0500 (EST)
Received: (qmail 32205 invoked by alias); 31 Jan 2002 16:53:46 -0000
Received: from unknown (HELO postgresql.org) (64.49.215.8)
  by www.postgresql.org with SMTP; 31 Jan 2002 16:53:46 -0000
Received: from mail.netbsd.org (mail.netbsd.org [155.53.1.253])
	by postgresql.org (8.11.3/8.11.4) with SMTP id g0VGVXl24649
	for <pgsql-hackers@postgresql.org>; Thu, 31 Jan 2002 11:31:37 -0500 (EST)
	(envelope-from wrstuden@netbsd.org)
Received: (qmail 29829 invoked by uid 1130); 31 Jan 2002 16:31:38 -0000
Date: Thu, 31 Jan 2002 08:26:40 -0800 (PST)
From: Bill Studenmund <wrstuden@netbsd.org>
X-X-Sender: <wrstuden@vespasia.home-net.internetconnect.net>
To: Hiroshi Inoue <Inoue@tpf.co.jp>
cc: Tom Lane <tgl@sss.pgh.pa.us>, Peter Eisentraut <peter_e@gmx.net>,
   PostgreSQL Development <pgsql-hackers@postgresql.org>
Subject: Re: [HACKERS] RFD: schemas and different kinds of Postgres objects
In-Reply-To: <3C58A472.2E90C21C@tpf.co.jp>
Message-ID: <Pine.NEB.4.33.0201310823050.29090-100000@vespasia.home-net.internetconnect.net>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR

On Thu, 31 Jan 2002, Hiroshi Inoue wrote:

> Tom Lane wrote:
> >
> > Hiroshi Inoue <Inoue@tpf.co.jp> writes:
> > SQL99's SQL-path is very clearly stated to be used only for looking up
> > routines and user-defined type names.  Extending it to cover tables,
> > operators, and so forth makes sense to me,
>
> I have no objection to the point it makes sense to use
> such *path*s internally but I think it also has a siginificance
> for SQL-path to not look up _tables_like objects.
> I think they are different from the first and we should(need)
> not manage the system with one *path*.

I'm confused. Are you suggesting multiple paths? i.e. a function/type path
and a table one?

I think calling our path an SQL path is fine. Yes, we extend it by using
it for tables too, but it strikes me as still fundamentally an SQL path.
So I don't see why we should not call it that.

Take care,

Bill


---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

From pgsql-hackers-owner+M18342=candle.pha.pa.us=pgman@postgresql.org Thu Jan 31 11:56:06 2002
Return-path: <pgsql-hackers-owner+M18342=candle.pha.pa.us=pgman@postgresql.org>
Received: from server1.pgsql.org (www.postgresql.org [64.49.215.9])
	by candle.pha.pa.us (8.11.6/8.10.1) with SMTP id g0VGu5P13918
	for <pgman@candle.pha.pa.us>; Thu, 31 Jan 2002 11:56:05 -0500 (EST)
Received: (qmail 32437 invoked by alias); 31 Jan 2002 16:53:56 -0000
Received: from unknown (HELO postgresql.org) (64.49.215.8)
  by www.postgresql.org with SMTP; 31 Jan 2002 16:53:56 -0000
Received: from mail.netbsd.org (mail.netbsd.org [155.53.1.253])
	by postgresql.org (8.11.3/8.11.4) with SMTP id g0VGdAl25623
	for <pgsql-hackers@postgresql.org>; Thu, 31 Jan 2002 11:39:11 -0500 (EST)
	(envelope-from wrstuden@netbsd.org)
Received: (qmail 29902 invoked by uid 1130); 31 Jan 2002 16:33:09 -0000
Date: Thu, 31 Jan 2002 08:28:10 -0800 (PST)
From: Bill Studenmund <wrstuden@netbsd.org>
X-X-Sender: <wrstuden@vespasia.home-net.internetconnect.net>
To: Hiroshi Inoue <Inoue@tpf.co.jp>
cc: Tom Lane <tgl@sss.pgh.pa.us>, Peter Eisentraut <peter_e@gmx.net>,
   PostgreSQL Development <pgsql-hackers@postgresql.org>
Subject: Re: [HACKERS] RFD: schemas and different kinds of Postgres objects
In-Reply-To: <3C58BBB3.58D5F964@tpf.co.jp>
Message-ID: <Pine.NEB.4.33.0201310827380.29090-100000@vespasia.home-net.internetconnect.net>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR

On Thu, 31 Jan 2002, Hiroshi Inoue wrote:

> > it will definitely not
> > do to look for a table's datatype and get the wrong type.  And I think
> > that functions and operators should be looked for on the same path
> > as datatypes, because a type should be pretty closely associated with
> > the functions/operators for it.  So it seems to me that the apparent
> > flexibility of having more than one path is just a way to shoot yourself
> > in the foot.  Why are you concerned that we keep them separate?
>
> For example, doesn't 'DROP table a_table' drop the
> a_table table in a schema in the *path* if there's
> no a_table table in the current schema ?
>
> If we would never introduce SQL-paths (in the future)
> there would be problem.

??

We're talking about adding them now. Why would we add them twice?

Take care,

Bill


---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

From pgsql-hackers-owner+M18341=candle.pha.pa.us=pgman@postgresql.org Thu Jan 31 11:59:16 2002
Return-path: <pgsql-hackers-owner+M18341=candle.pha.pa.us=pgman@postgresql.org>
Received: from server1.pgsql.org (www.postgresql.org [64.49.215.9])
	by candle.pha.pa.us (8.11.6/8.10.1) with SMTP id g0VGxFP14456
	for <pgman@candle.pha.pa.us>; Thu, 31 Jan 2002 11:59:15 -0500 (EST)
Received: (qmail 32440 invoked by alias); 31 Jan 2002 16:53:56 -0000
Received: from unknown (HELO postgresql.org) (64.49.215.8)
  by www.postgresql.org with SMTP; 31 Jan 2002 16:53:56 -0000
Received: from mail.netbsd.org (mail.netbsd.org [155.53.1.253])
	by postgresql.org (8.11.3/8.11.4) with SMTP id g0VGdAl25618
	for <pgsql-hackers@postgresql.org>; Thu, 31 Jan 2002 11:39:11 -0500 (EST)
	(envelope-from wrstuden@netbsd.org)
Received: (qmail 223 invoked by uid 1130); 31 Jan 2002 16:36:01 -0000
Date: Thu, 31 Jan 2002 08:31:03 -0800 (PST)
From: Bill Studenmund <wrstuden@netbsd.org>
X-X-Sender: <wrstuden@vespasia.home-net.internetconnect.net>
To: Tom Lane <tgl@sss.pgh.pa.us>
cc: Hiroshi Inoue <Inoue@tpf.co.jp>, Peter Eisentraut <peter_e@gmx.net>,
   PostgreSQL Development <pgsql-hackers@postgresql.org>
Subject: Re: [HACKERS] RFD: schemas and different kinds of Postgres objects
In-Reply-To: <29733.1012448621@sss.pgh.pa.us>
Message-ID: <Pine.NEB.4.33.0201310828190.29090-100000@vespasia.home-net.internetconnect.net>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR

On Wed, 30 Jan 2002, Tom Lane wrote:

> Hiroshi Inoue <Inoue@tpf.co.jp> writes:
> > For example, doesn't 'DROP table a_table' drop the
> > a_table table in a schema in the *path* if there's
> > no a_table table in the current schema ?
>
> Sure.  And that's exactly what it should do, IMHO.
> Otherwise the notion that you can ignore your private
> schema (at the front of the path) if you're not using
> it falls down.  Also, we wouldn't be able to implement
> temp tables via a backend-local schema at the front of
> the path.

Well, I disagree on this one. :-) I'd vote drop should need a specific
schema if it's not the current one. But I won't push the point. :-)

> Any security concerns here should be addressed by putting
> ACLs on the schemas you don't want altered; not by contorting
> the notion of a search path to work for some operations and
> not others.

I'm not so concerned about security as being sure of operator intent. ACLs
address security (and should be used), but they don't address making sure
you delete exactly what you wanted.

Take care,

Bill


---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org

From pgsql-hackers-owner+M18341=candle.pha.pa.us=pgman@postgresql.org Thu Jan 31 12:00:40 2002
Return-path: <pgsql-hackers-owner+M18341=candle.pha.pa.us=pgman@postgresql.org>
Received: from server1.pgsql.org (www.postgresql.org [64.49.215.9])
	by candle.pha.pa.us (8.11.6/8.10.1) with SMTP id g0VH0dP14749
	for <pgman@candle.pha.pa.us>; Thu, 31 Jan 2002 12:00:39 -0500 (EST)
Received: (qmail 32325 invoked by alias); 31 Jan 2002 16:53:51 -0000
Received: from unknown (HELO postgresql.org) (64.49.215.8)
  by www.postgresql.org with SMTP; 31 Jan 2002 16:53:51 -0000
Received: from mail.netbsd.org (mail.netbsd.org [155.53.1.253])
	by postgresql.org (8.11.3/8.11.4) with SMTP id g0VGdAl25625
	for <pgsql-hackers@postgresql.org>; Thu, 31 Jan 2002 11:39:12 -0500 (EST)
	(envelope-from wrstuden@netbsd.org)
Received: (qmail 284 invoked by uid 1130); 31 Jan 2002 16:38:48 -0000
Date: Thu, 31 Jan 2002 08:33:50 -0800 (PST)
From: Bill Studenmund <wrstuden@netbsd.org>
X-X-Sender: <wrstuden@vespasia.home-net.internetconnect.net>
To: Hiroshi Inoue <Inoue@tpf.co.jp>
cc: Tom Lane <tgl@sss.pgh.pa.us>, Peter Eisentraut <peter_e@gmx.net>,
   PostgreSQL Development <pgsql-hackers@postgresql.org>
Subject: Re: [HACKERS] RFD: schemas and different kinds of Postgres objects
In-Reply-To: <3C591E5E.14549DF@tpf.co.jp>
Message-ID: <Pine.NEB.4.33.0201310831290.29090-100000@vespasia.home-net.internetconnect.net>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR

On Thu, 31 Jan 2002, Hiroshi Inoue wrote:

> Tom Lane wrote:
> >
> > Hiroshi Inoue <Inoue@tpf.co.jp> writes:
> > > For example, doesn't 'DROP table a_table' drop the
> > > a_table table in a schema in the *path* if there's
> > > no a_table table in the current schema ?
> >
> > Sure.  And that's exactly what it should do, IMHO.
> > Otherwise the notion that you can ignore your private
> > schema (at the front of the path) if you're not using
> > it falls down.  Also, we wouldn't be able to implement
> > temp tables via a backend-local schema at the front of
> > the path.
>
> I don't think it's useful for tables other than temp
> ones and I wouldn't use it other than for temp ones.

I agree.

> When we type 'rm a_file' in a shell environment
> does the *rm* command search the PATH in finding
> the a_file file ? Even though we need to implement
> such a search mechanism we would use another path
> different from the executable search PATH. I don't
> think our *path* is an extension of SQL-path.
>
> I wouldn't complain unless we call the *path*
> as SQL-path or an extension of SQL-path.

I still don't get this. The path we're talking about is the same thing
(with the same envirnment name and operational syntax) as SQL-paths,
except that we use it to find tables too. Why does that make it not an SQL
path?

Take care,

Bill


---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

From pgsql-hackers-owner+M18346=candle.pha.pa.us=pgman@postgresql.org Thu Jan 31 20:15:10 2002
Return-path: <pgsql-hackers-owner+M18346=candle.pha.pa.us=pgman@postgresql.org>
Received: from server1.pgsql.org (www.postgresql.org [64.49.215.9])
	by candle.pha.pa.us (8.11.6/8.10.1) with SMTP id g111FAP04980
	for <pgman@candle.pha.pa.us>; Thu, 31 Jan 2002 20:15:10 -0500 (EST)
Received: (qmail 48143 invoked by alias); 1 Feb 2002 01:15:08 -0000
Received: from unknown (HELO postgresql.org) (64.49.215.8)
  by www.postgresql.org with SMTP; 1 Feb 2002 01:15:08 -0000
Received: from sd.tpf.co.jp (sd.tpf.co.jp [210.161.239.34])
	by postgresql.org (8.11.3/8.11.4) with SMTP id g11181l47339
	for <pgsql-hackers@postgresql.org>; Thu, 31 Jan 2002 20:08:01 -0500 (EST)
	(envelope-from Inoue@tpf.co.jp)
Received: (qmail 14937 invoked from network); 1 Feb 2002 01:08:03 -0000
Received: from unknown (HELO viscomail.tpf.co.jp) (100.0.0.108)
  by sd2.tpf-fw-c.co.jp with SMTP; 1 Feb 2002 01:08:03 -0000
Received: from tpf.co.jp (3dgateway1 [126.0.1.60])
	by viscomail.tpf.co.jp (8.8.8+Sun/8.8.8) with ESMTP id KAA11846;
	Fri, 1 Feb 2002 10:08:01 +0900 (JST)
Message-ID: <3C59EA75.E117B2FA@tpf.co.jp>
Date: Fri, 01 Feb 2002 10:08:05 +0900
From: Hiroshi Inoue <Inoue@tpf.co.jp>
X-Mailer: Mozilla 4.73 [ja] (Windows NT 5.0; U)
X-Accept-Language: ja
MIME-Version: 1.0
To: Bill Studenmund <wrstuden@netbsd.org>
cc: Tom Lane <tgl@sss.pgh.pa.us>, Peter Eisentraut <peter_e@gmx.net>,
   PostgreSQL Development <pgsql-hackers@postgresql.org>
Subject: Re: [HACKERS] RFD: schemas and different kinds of Postgres objects
References: <Pine.NEB.4.33.0201310831290.29090-100000@vespasia.home-net.internetconnect.net>
Content-Type: text/plain; charset=iso-2022-jp
Content-Transfer-Encoding: 7bit
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR

Bill Studenmund wrote:
> 
> On Thu, 31 Jan 2002, Hiroshi Inoue wrote:
> >
> > I wouldn't complain unless we call the *path*
> > as SQL-path or an extension of SQL-path.
> 
> I still don't get this. The path we're talking about is the same thing
> (with the same envirnment name and operational syntax) as SQL-paths,
> except that we use it to find tables too. Why does that make it not an SQL
> path?

I don't think It's always good to follow the standard.
However it's very wrong to change the meaning of words
in the standard. It seems impossible to introduce SQL-path
using our *path*. The *path* is PostgreSQL specific and
it would be configurable for us to be SQL99-compatible
(without SQL-path) or SQL99-imcompatible using the *path*.

regards,
Hiroshi Inoue

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly