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
|
From pgsql-hackers-owner+M5631@postgresql.org Thu Mar 8 21:04:12 2001
Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28])
by candle.pha.pa.us (8.9.0/8.9.0) with ESMTP id VAA09681
for <pgman@candle.pha.pa.us>; Thu, 8 Mar 2001 21:04:12 -0500 (EST)
Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28])
by mail.postgresql.org (8.11.1/8.11.1) with SMTP id f2924Hx38075;
Thu, 8 Mar 2001 21:04:17 -0500 (EST)
(envelope-from pgsql-hackers-owner+M5631@postgresql.org)
Received: from sss.pgh.pa.us (sss.pgh.pa.us [209.114.132.154])
by mail.postgresql.org (8.11.1/8.11.1) with ESMTP id f2920Ex24188
for <pgsql-hackers@postgresql.org>; Thu, 8 Mar 2001 21:00:14 -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.1/8.11.1) with ESMTP id f29209904744
for <pgsql-hackers@postgresql.org>; Thu, 8 Mar 2001 21:00:09 -0500 (EST)
To: pgsql-hackers@postgresql.org
Subject: Re: [HACKERS] Internationalized error messages
In-reply-to: <20010308164222.Y624@store.zembu.com>
References: <Pine.LNX.4.30.0103082319150.1061-100000@peter.localdomain> <20010308164222.Y624@store.zembu.com>
Comments: In-reply-to ncm@zembu.com (Nathan Myers)
message dated "Thu, 08 Mar 2001 16:42:22 -0800"
Date: Thu, 08 Mar 2001 21:00:09 -0500
Message-ID: <4741.984103209@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR
> On Thu, Mar 08, 2001 at 11:49:50PM +0100, Peter Eisentraut wrote:
>> I really feel that translated error messages need to happen soon.
Agreed.
ncm@zembu.com (Nathan Myers) writes:
> Similar approaches have been tried frequently, and even enshrined
> in standards (e.g. POSIX catgets), but have almost always proven too
> cumbersome. The problem is that keeping programs that interpret the
> numeric code in sync with the program they monitor is hard, and trying
> to avoid breaking all those secondary programs hinders development on
> the primary program. Furthermore, assigning code numbers is a nuisance,
> and they add uninformative clutter.
There's a difficult tradeoff to make here, but I think we do want to
distinguish between the "official error code" --- the thing that has
translations into various languages --- and what the backend is actually
allowed to print out. It seems to me that a fairly large fraction of
the unique messages found in the backend can all be lumped under the
category of "internal error", and that we need to have only one official
error code and one user-level translated message for the lot of them.
But we do want to be able to print out different detail messages for
each of those internal errors. There are other categories that might be
lumped together, but that one alone is sufficiently large to force us
to recognize it. This suggests a distinction between a "primary" or
"user-level" error message, which we catalog and provide translations
for, and a "secondary", "detail", or "wizard-level" error message that
exists only in the backend source code, and only in English, and so
can be made up on the spur of the moment.
Another thing that's bothered me for a long time is our inconsistent
approach to determining where in the code a message comes from. A lot
of the messages currently embed the name of the generating routine right
into the error text. Again, we ought to separate the functionality:
the source-code location is valuable but ought not form part of the
primary error message. I would like to see elog() become a macro that
invokes __FILE__ and __LINE__ to automatically make the *exact* source
code location become part of the secondary error information, and then
drop the convention of using the routine name in the message text.
Something else we have talked about off-and-on is providing locator
information for errors that can be associated with a particular point in
the query string (lexical and syntactic errors). This would probably be
best returned as a character index.
Another thing that I missed in Peter's proposal is how we are going to
cope with messages that include parameters. Surely we do not expect
gettext to start with 'Attribute "foo" not found' and distinguish fixed
from variable parts of that string?
So it's clear that we need to devise a way of breaking an "error
message" into multiple portions, including:
Primary error message (localizable)
Parameters to insert into error message (user identifiers, etc)
Secondary (wizard) error message (optional)
Source code location
Query text location (optional)
and perhaps others that I have forgotten about. One of the key things
to think about is whether we can, or should try to, transmit all this
stuff in a backwards-compatible protocol. That would mean we'd have
to dump all the info into a single string, which is doable but would
perhaps look pretty ugly:
ERROR: Attribute "foo" not found -- basic message for dumb frontends
ERRORCODE: UNREC_IDENT -- key for finding localized message
PARAM1: foo -- something to embed in the localized message
MESSAGE: Attribute or table name not known within context of query
CODELOC: src/backend/parser/parse_clause.c line 345
QUERYLOC: 22
Alternatively we could suppress most of this stuff unless the frontend
specifically asks for it (and presumably is willing to digest it for
the user).
Bottom line for me is that if we are going to go to the trouble of
examining and changing every single elog() in the system, we should
try to get all of these issues cleaned up at once. Let's not have to
go back and do it again later.
regards, tom lane
---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
From pgsql-hackers-owner+M5633@postgresql.org Thu Mar 8 22:35:37 2001
Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28])
by candle.pha.pa.us (8.9.0/8.9.0) with ESMTP id WAA14437
for <pgman@candle.pha.pa.us>; Thu, 8 Mar 2001 22:35:36 -0500 (EST)
Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28])
by mail.postgresql.org (8.11.1/8.11.1) with SMTP id f293Zhx83174;
Thu, 8 Mar 2001 22:35:43 -0500 (EST)
(envelope-from pgsql-hackers-owner+M5633@postgresql.org)
Received: from store.d.zembu.com (nat.zembu.com [209.128.96.253])
by mail.postgresql.org (8.11.1/8.11.1) with ESMTP id f293Ulx76439
for <pgsql-hackers@postgresql.org>; Thu, 8 Mar 2001 22:30:47 -0500 (EST)
(envelope-from ncm@zembu.com)
Received: by store.d.zembu.com (Postfix, from userid 509)
id C6F2BA75B; Thu, 8 Mar 2001 19:30:41 -0800 (PST)
Date: Thu, 8 Mar 2001 19:30:41 -0800
To: pgsql-hackers@postgresql.org
Subject: Re: [HACKERS] Internationalized error messages
Message-ID: <20010308193041.Z624@store.zembu.com>
Reply-To: pgsql-hackers@postgresql.org
References: <Pine.LNX.4.30.0103082319150.1061-100000@peter.localdomain> <20010308164222.Y624@store.zembu.com> <4741.984103209@sss.pgh.pa.us>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
User-Agent: Mutt/1.2.5i
In-Reply-To: <4741.984103209@sss.pgh.pa.us>; from tgl@sss.pgh.pa.us on Thu, Mar 08, 2001 at 09:00:09PM -0500
From: ncm@zembu.com (Nathan Myers)
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR
On Thu, Mar 08, 2001 at 09:00:09PM -0500, Tom Lane wrote:
> ncm@zembu.com (Nathan Myers) writes:
> > Similar approaches have been tried frequently, and even enshrined
> > in standards (e.g. POSIX catgets), but have almost always proven too
> > cumbersome. The problem is that keeping programs that interpret the
> > numeric code in sync with the program they monitor is hard, and trying
> > to avoid breaking all those secondary programs hinders development on
> > the primary program. Furthermore, assigning code numbers is a nuisance,
> > and they add uninformative clutter.
>
> There's a difficult tradeoff to make here, but I think we do want to
> distinguish between the "official error code" --- the thing that has
> translations into various languages --- and what the backend is actually
> allowed to print out. It seems to me that a fairly large fraction of
> the unique messages found in the backend can all be lumped under the
> category of "internal error", and that we need to have only one official
> error code and one user-level translated message for the lot of them.
> But we do want to be able to print out different detail messages for
> each of those internal errors. There are other categories that might be
> lumped together, but that one alone is sufficiently large to force us
> to recognize it. This suggests a distinction between a "primary" or
> "user-level" error message, which we catalog and provide translations
> for, and a "secondary", "detail", or "wizard-level" error message that
> exists only in the backend source code, and only in English, and so
> can be made up on the spur of the moment.
I suggest using different named functions/macros for different
categories of message, rather than arguments to a common function.
(I.e. "elog(ERROR, ...)" Considered Harmful.)
You might even have more than one call at a site, one for the official
message and another for unofficial or unstable informative details.
> Another thing that I missed in Peter's proposal is how we are going to
> cope with messages that include parameters. Surely we do not expect
> gettext to start with 'Attribute "foo" not found' and distinguish fixed
> from variable parts of that string?
The common way to deal with this is to catalog the format string itself,
with its embedded % directives. The tricky bit, and what the printf
family has had to be extended to handle, is that the order of the formal
arguments varies with the target language. The original string is an
ordinary printf string, but the translations may have to refer to the
substitution arguments by numeric position (as well as type).
There is probably Free code to implement that.
As much as possible, any compile-time annotations should be extracted
into the catalog and filtered out of the source, to be reunited only
when you retrieve the catalog entry.
> So it's clear that we need to devise a way of breaking an "error
> message" into multiple portions, including:
>
> Primary error message (localizable)
> Parameters to insert into error message (user identifiers, etc)
> Secondary (wizard) error message (optional)
> Source code location
> Query text location (optional)
>
> and perhaps others that I have forgotten about. One of the key things
> to think about is whether we can, or should try to, transmit all this
> stuff in a backwards-compatible protocol. That would mean we'd have
> to dump all the info into a single string, which is doable but would
> perhaps look pretty ugly:
>
> ERROR: Attribute "foo" not found -- basic message for dumb frontends
> ERRORCODE: UNREC_IDENT -- key for finding localized message
> PARAM1: foo -- something to embed in the localized message
> MESSAGE: Attribute or table name not known within context of query
> CODELOC: src/backend/parser/parse_clause.c line 345
> QUERYLOC: 22
Whitespace can be used effectively. E.g. only primary messages appear
in column 0. PG might emit this, which is easily filtered:
Attribute "foo" not found
severity: cannot proceed
explain: An attribute or table was name not known within
explain: the context of the query.
index: 237 Attribute \"%s\" not found
location: src/backend/parser/parse_clause.c line 345
query_position: 22
Here the first line is the localized replacement of what appears in the
code, with arguments substituted in. The other stuff comes from the
catalog
The call looks like
elog_query("Attribute \"%s\" not found", foo);
elog_explain("An attribute or table was name not known within"
"the context of the query.");
elog_severity(ERROR);
which might gets expanded (squeezed) by the preprocessor to
_elog(current_query_position, "Attribute \"%s\" not found", foo);
while a separate tool scans the sources and builds the catalog,
annotating it with severity, line number, etc. Human translators
may edit copies of the resulting catalog. The call to _elog looks up
the string in the catalog, substitutes arguments into the translation,
and emits it along with the catalog index number and whatever else
has been requested in the config file. Alternatively, any other program
can use the number to pull the annotations out of the catalog given
just the index.
> Alternatively we could suppress most of this stuff unless the frontend
> specifically asks for it (and presumably is willing to digest it for
> the user).
>
> Bottom line for me is that if we are going to go to the trouble of
> examining and changing every single elog() in the system, we should
> try to get all of these issues cleaned up at once. Let's not have to
> go back and do it again later.
The more complex it is, the more likely that will need to be redone.
The simpler the calls look, the more likely that you can automate
(or implement invisibly) any later improvements.
Nathan Myers
ncm@zembu.com
---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?
http://www.postgresql.org/users-lounge/docs/faq.html
From pgsql-hackers-owner+M5638@postgresql.org Fri Mar 9 00:41:08 2001
Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28])
by candle.pha.pa.us (8.9.0/8.9.0) with ESMTP id AAA25061
for <pgman@candle.pha.pa.us>; Fri, 9 Mar 2001 00:41:08 -0500 (EST)
Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28])
by mail.postgresql.org (8.11.1/8.11.1) with SMTP id f295f9x37185;
Fri, 9 Mar 2001 00:41:09 -0500 (EST)
(envelope-from pgsql-hackers-owner+M5638@postgresql.org)
Received: from technoart.net ([212.17.18.2])
by mail.postgresql.org (8.11.1/8.11.1) with ESMTP id f295a9x17382
for <pgsql-hackers@postgresql.org>; Fri, 9 Mar 2001 00:36:09 -0500 (EST)
(envelope-from dyp@perchine.com)
Received: from dyp.perchine.com ([212.17.18.66])
by technoart.net (8.8.8/8.8.8) with SMTP id LAA22076
for <pgsql-hackers@postgresql.org>; Fri, 9 Mar 2001 11:36:07 +0600
Content-Type: text/plain;
charset="koi8-r"
From: Denis Perchine <dyp@perchine.com>
To: pgsql-hackers@postgresql.org
Subject: Re: [HACKERS] Internationalized error messages
Date: Fri, 9 Mar 2001 11:34:42 +0600
X-Mailer: KMail [version 1.2.1]
References: <Pine.LNX.4.30.0103082319150.1061-100000@peter.localdomain> <siwv9zeqzy.fsf@daffy.airs.com>
In-Reply-To: <siwv9zeqzy.fsf@daffy.airs.com>
MIME-Version: 1.0
Message-Id: <01030911344204.00457@dyp.perchine.com>
Content-Transfer-Encoding: 8bit
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR
> I like this approach. One of the nice things about Oracle is that
> they have an error manual. All Oracle errors have an associated
> number. You can look up that number in the error manual to find a
> paragraph giving details and workarounds. Admittedly, sometimes the
> further details are not helpful, but sometimes they are. The basic
> idea of being able to look up an error lets programmers balance the
> need for a terse error message with the need for a fuller explanation.
One of the examples when you need exact error message code is when you want
to separate unique index violations from other errors. This often needed when
you want just do insert, and leave all constraint checking to database...
--
Sincerely Yours,
Denis Perchine
----------------------------------
E-Mail: dyp@perchine.com
HomePage: http://www.perchine.com/dyp/
FidoNet: 2:5000/120.5
----------------------------------
---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?
http://www.postgresql.org/search.mpl
From pgsql-hackers-owner+M5640@postgresql.org Fri Mar 9 06:30:04 2001
Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28])
by candle.pha.pa.us (8.9.0/8.9.0) with ESMTP id GAA06293
for <pgman@candle.pha.pa.us>; Fri, 9 Mar 2001 06:30:04 -0500 (EST)
Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28])
by mail.postgresql.org (8.11.1/8.11.1) with SMTP id f29BTvx46311;
Fri, 9 Mar 2001 06:29:57 -0500 (EST)
(envelope-from pgsql-hackers-owner+M5640@postgresql.org)
Received: from ara.zf.jcu.cz (ara.zf.jcu.cz [160.217.161.4])
by mail.postgresql.org (8.11.1/8.11.1) with ESMTP id f29Agpx33552
for <pgsql-hackers@postgresql.org>; Fri, 9 Mar 2001 05:43:10 -0500 (EST)
(envelope-from zakkr@zf.jcu.cz)
Received: (from zakkr@localhost)
by ara.zf.jcu.cz (8.9.3/8.9.3/Debian 8.9.3-21) id IAA09255;
Fri, 9 Mar 2001 08:53:20 +0100
Date: Fri, 9 Mar 2001 08:53:20 +0100
From: Karel Zak <zakkr@zf.jcu.cz>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-hackers@postgresql.org
Subject: Re: [HACKERS] Internationalized error messages
Message-ID: <20010309085320.A7401@ara.zf.jcu.cz>
References: <Pine.LNX.4.30.0103082319150.1061-100000@peter.localdomain> <20010308164222.Y624@store.zembu.com> <4741.984103209@sss.pgh.pa.us>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
User-Agent: Mutt/1.0.1i
In-Reply-To: <4741.984103209@sss.pgh.pa.us>; from tgl@sss.pgh.pa.us on Thu, Mar 08, 2001 at 09:00:09PM -0500
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR
On Thu, Mar 08, 2001 at 09:00:09PM -0500, Tom Lane wrote:
> > On Thu, Mar 08, 2001 at 11:49:50PM +0100, Peter Eisentraut wrote:
> >> I really feel that translated error messages need to happen soon.
>
> Agreed.
Yes, error codes is *very* wanted feature.
>
> ERROR: Attribute "foo" not found -- basic message for dumb frontends
> ERRORCODE: UNREC_IDENT -- key for finding localized message
> PARAM1: foo -- something to embed in the localized message
> MESSAGE: Attribute or table name not known within context of query
> CODELOC: src/backend/parser/parse_clause.c line 345
> QUERYLOC: 22
Great idea! I agree that we need some powerful Error protocol instead
currect string based messages.
For transaltion to other languages I not sure with gettext() stuff on
backend -- IMHO better (faster) solution will postgres system catalog
with it.
May be add new command too: SET MESSAGE_LANGUAGE TO <xxx>, because
wanted language not must be always same as locale setting.
Something like elog(ERROR, gettext(...)); is usable, but not sounds good
for me.
Karel
--
Karel Zak <zakkr@zf.jcu.cz>
http://home.zf.jcu.cz/~zakkr/
C, PostgreSQL, PHP, WWW, http://docs.linux.cz, http://mape.jcu.cz
---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?
http://www.postgresql.org/users-lounge/docs/faq.html
From pgsql-hackers-owner+M5641@postgresql.org Fri Mar 9 06:43:48 2001
Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28])
by candle.pha.pa.us (8.9.0/8.9.0) with ESMTP id GAA10006
for <pgman@candle.pha.pa.us>; Fri, 9 Mar 2001 06:43:47 -0500 (EST)
Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28])
by mail.postgresql.org (8.11.1/8.11.1) with SMTP id f29Bhnx49065;
Fri, 9 Mar 2001 06:43:49 -0500 (EST)
(envelope-from pgsql-hackers-owner+M5641@postgresql.org)
Received: from sraigw.sra.co.jp (sraigw.sra.co.jp [202.32.10.2])
by mail.postgresql.org (8.11.1/8.11.1) with ESMTP id f29Bgpx48712
for <pgsql-hackers@postgresql.org>; Fri, 9 Mar 2001 06:42:53 -0500 (EST)
(envelope-from t-ishii@sra.co.jp)
Received: from sranhk.sra.co.jp (sranhk [133.137.36.134])
by sraigw.sra.co.jp (8.8.7/3.7W-sraigw) with ESMTP id UAA07670
for <pgsql-hackers@postgresql.org>; Fri, 9 Mar 2001 20:42:46 +0900 (JST)
Received: from localhost (IDENT:t-ishii@portsv3-8 [133.137.84.8])
by sranhk.sra.co.jp (8.9.3/3.7W-srambox) with ESMTP id UAA22314;
Fri, 9 Mar 2001 20:42:43 +0900
To: zakkr@zf.jcu.cz
Cc: tgl@sss.pgh.pa.us, pgsql-hackers@postgresql.org
Subject: Re: [HACKERS] Internationalized error messages
In-Reply-To: <20010309085320.A7401@ara.zf.jcu.cz>
References: <20010308164222.Y624@store.zembu.com>
<4741.984103209@sss.pgh.pa.us>
<20010309085320.A7401@ara.zf.jcu.cz>
X-Mailer: Mew version 1.94.2 on Emacs 20.7 / Mule 4.1
=?iso-2022-jp?B?KBskQjAqGyhCKQ==?=
Mime-Version: 1.0
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Message-Id: <20010309204226O.t-ishii@sra.co.jp>
Date: Fri, 09 Mar 2001 20:42:26 +0900
From: Tatsuo Ishii <t-ishii@sra.co.jp>
X-Dispatcher: imput version 20000228(IM140)
Lines: 17
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR
> For transaltion to other languages I not sure with gettext() stuff on
> backend -- IMHO better (faster) solution will postgres system catalog
> with it.
>
> May be add new command too: SET MESSAGE_LANGUAGE TO <xxx>, because
> wanted language not must be always same as locale setting.
In the multibyte enabled environment, that kind of command would not
be necessary except UNICODE and MULE_INTERNAL, since they are
multi-lingual encoding. For them, we might need something like:
SET LANGUAGE_PREFERENCE TO 'Japanese';
For the long term solutuon, this kind of problem should be solved in
the implemetaion of SQL-92/99 i18n features.
--
Tatsuo Ishii
---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
From pgsql-hackers-owner+M5645@postgresql.org Fri Mar 9 10:37:12 2001
Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28])
by candle.pha.pa.us (8.9.0/8.9.0) with ESMTP id KAA22198
for <pgman@candle.pha.pa.us>; Fri, 9 Mar 2001 10:37:11 -0500 (EST)
Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28])
by mail.postgresql.org (8.11.1/8.11.1) with SMTP id f29FbDx71892;
Fri, 9 Mar 2001 10:37:13 -0500 (EST)
(envelope-from pgsql-hackers-owner+M5645@postgresql.org)
Received: from mailout03.sul.t-online.com (mailout03.sul.t-online.com [194.25.134.81])
by mail.postgresql.org (8.11.1/8.11.1) with ESMTP id f29FaXx71776
for <pgsql-hackers@postgresql.org>; Fri, 9 Mar 2001 10:36:33 -0500 (EST)
(envelope-from peter_e@gmx.net)
Received: from fwd01.sul.t-online.com
by mailout03.sul.t-online.com with smtp
id 14bOwN-0001Ce-03; Fri, 09 Mar 2001 16:36:27 +0100
Received: from peter.localdomain (520083510237-0001@[212.185.245.76]) by fmrl01.sul.t-online.com
with esmtp id 14bOw7-0yVrI8C; Fri, 9 Mar 2001 16:36:11 +0100
Date: Fri, 9 Mar 2001 16:45:54 +0100 (CET)
From: Peter Eisentraut <peter_e@gmx.net>
To: <pgsql-hackers@postgresql.org>
Subject: Re: [HACKERS] Internationalized error messages
In-Reply-To: <20010308164222.Y624@store.zembu.com>
Message-ID: <Pine.LNX.4.30.0103091643350.929-100000@peter.localdomain>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
X-Sender: 520083510237-0001@t-dialin.net
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR
Nathan Myers writes:
> > elog(ERROR, "XYZ01", gettext("stuff happened"));
>
> Similar approaches have been tried frequently, and even enshrined
> in standards (e.g. POSIX catgets), but have almost always proven too
> cumbersome. The problem is that keeping programs that interpret the
> numeric code in sync with the program they monitor is hard, and trying
> to avoid breaking all those secondary programs hinders development on
> the primary program.
That's why no one uses catgets and everyone uses gettext.
> Furthermore, assigning code numbers is a nuisance, and they add
> uninformative clutter.
The error codes are exactly what we want, to allow client programs (as
opposed to humans) to identify the errors. The code in my example has
nothing to do with the message id in the catgets interface.
> It's better to scan the program for elog() arguments, and generate
> a catalog by using the string itself as the index code. Those
> maintaining the secondary programs can compare catalogs to see what
> has been broken by changes and what new messages to expect. elog()
> itself can (optionally) invent tokens (e.g. catalog indices) to help
> out those programs.
That's what gettext does for you.
--
Peter Eisentraut peter_e@gmx.net http://yi.org/peter-e/
---------------------------(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+M5646@postgresql.org Fri Mar 9 10:49:11 2001
Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28])
by candle.pha.pa.us (8.9.0/8.9.0) with ESMTP id KAA23130
for <pgman@candle.pha.pa.us>; Fri, 9 Mar 2001 10:49:11 -0500 (EST)
Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28])
by mail.postgresql.org (8.11.1/8.11.1) with SMTP id f29FnFx73540;
Fri, 9 Mar 2001 10:49:15 -0500 (EST)
(envelope-from pgsql-hackers-owner+M5646@postgresql.org)
Received: from mailout01.sul.t-online.com (mailout01.sul.t-online.com [194.25.134.80])
by mail.postgresql.org (8.11.1/8.11.1) with ESMTP id f29FmVx73372
for <pgsql-hackers@postgresql.org>; Fri, 9 Mar 2001 10:48:31 -0500 (EST)
(envelope-from peter_e@gmx.net)
Received: from fwd06.sul.t-online.com
by mailout01.sul.t-online.com with smtp
id 14bP7X-0001eg-00; Fri, 09 Mar 2001 16:47:59 +0100
Received: from peter.localdomain (520083510237-0001@[212.185.245.76]) by fmrl06.sul.t-online.com
with esmtp id 14bP79-1w2fj6C; Fri, 9 Mar 2001 16:47:35 +0100
Date: Fri, 9 Mar 2001 16:57:18 +0100 (CET)
From: Peter Eisentraut <peter_e@gmx.net>
To: Tom Lane <tgl@sss.pgh.pa.us>
cc: <pgsql-hackers@postgresql.org>
Subject: Re: [HACKERS] Internationalized error messages
In-Reply-To: <4741.984103209@sss.pgh.pa.us>
Message-ID: <Pine.LNX.4.30.0103091646150.929-100000@peter.localdomain>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
X-Sender: 520083510237-0001@t-dialin.net
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR
Tom Lane writes:
> There's a difficult tradeoff to make here, but I think we do want to
> distinguish between the "official error code" --- the thing that has
> translations into various languages --- and what the backend is actually
> allowed to print out. It seems to me that a fairly large fraction of
> the unique messages found in the backend can all be lumped under the
> category of "internal error", and that we need to have only one official
> error code and one user-level translated message for the lot of them.
That's exactly what I was trying to avoid. You'd still be allowed to
choose the error message text freely, but client programs will be able to
make sense of them by looking at the code only, as opposed to parsing the
message text. I'm trying to avoid making the message text to be computed
from the error code, because that obscures the source code.
> Another thing that's bothered me for a long time is our inconsistent
> approach to determining where in the code a message comes from. A lot
> of the messages currently embed the name of the generating routine right
> into the error text. Again, we ought to separate the functionality:
> the source-code location is valuable but ought not form part of the
> primary error message. I would like to see elog() become a macro that
> invokes __FILE__ and __LINE__ to automatically make the *exact* source
> code location become part of the secondary error information, and then
> drop the convention of using the routine name in the message text.
These sort of things have been on my mind as well, but they're really
independent of my issue. We can easily have runtime options to append or
not additional things to the error string. I don't see this as part of my
proposal.
> Another thing that I missed in Peter's proposal is how we are going to
> cope with messages that include parameters. Surely we do not expect
> gettext to start with 'Attribute "foo" not found' and distinguish fixed
> >from variable parts of that string?
Sure we do.
> That would mean we'd have to dump all the info into a single string,
> which is doable but would perhaps look pretty ugly:
>
> ERROR: Attribute "foo" not found -- basic message for dumb frontends
> ERRORCODE: UNREC_IDENT -- key for finding localized message
There should not be a "key" to look up localized messages. Remember that
the localization will also have to be done in all the front-end programs.
Surely we do not wish to make a list of messages that pg_dump or psql
print out. Gettext takes care of this stuff. The only reason why we need
error codes is for the sake of ease of interpreting by programs.
> PARAM1: foo -- something to embed in the localized message
Not necessary.
> MESSAGE: Attribute or table name not known within context of query
How's that different from ERROR:?
> CODELOC: src/backend/parser/parse_clause.c line 345
Can be appended to ERROR (or MESSAGE) depending on configuration setting.
> QUERYLOC: 22
Not all errors are related to a query.
The general problem here is also that this would introduce a client
incompatibility. Older clients that do not expect this amount of detail
will print all this garbage to the screen?
--
Peter Eisentraut peter_e@gmx.net http://yi.org/peter-e/
---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?
http://www.postgresql.org/users-lounge/docs/faq.html
From pgsql-hackers-owner+M5647@postgresql.org Fri Mar 9 11:01:42 2001
Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28])
by candle.pha.pa.us (8.9.0/8.9.0) with ESMTP id LAA24084
for <pgman@candle.pha.pa.us>; Fri, 9 Mar 2001 11:01:42 -0500 (EST)
Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28])
by mail.postgresql.org (8.11.1/8.11.1) with SMTP id f29G1kx75165;
Fri, 9 Mar 2001 11:01:46 -0500 (EST)
(envelope-from pgsql-hackers-owner+M5647@postgresql.org)
Received: from sss.pgh.pa.us (sss.pgh.pa.us [209.114.132.154])
by mail.postgresql.org (8.11.1/8.11.1) with ESMTP id f29G11x75037
for <pgsql-hackers@postgresql.org>; Fri, 9 Mar 2001 11:01: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.1/8.11.1) with ESMTP id f29G0r906898;
Fri, 9 Mar 2001 11:00:54 -0500 (EST)
To: Peter Eisentraut <peter_e@gmx.net>
cc: pgsql-hackers@postgresql.org
Subject: Re: [HACKERS] Internationalized error messages
In-reply-to: <Pine.LNX.4.30.0103091646150.929-100000@peter.localdomain>
References: <Pine.LNX.4.30.0103091646150.929-100000@peter.localdomain>
Comments: In-reply-to Peter Eisentraut <peter_e@gmx.net>
message dated "Fri, 09 Mar 2001 16:57:18 +0100"
Date: Fri, 09 Mar 2001 11:00:53 -0500
Message-ID: <6895.984153653@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:
> That's exactly what I was trying to avoid. You'd still be allowed to
> choose the error message text freely, but client programs will be able to
> make sense of them by looking at the code only, as opposed to parsing the
> message text. I'm trying to avoid making the message text to be computed
> from the error code, because that obscures the source code.
I guess I don't understand what you have in mind, because this seems
self-contradictory. If "client programs can look at the code only",
then how can the error message text be chosen independently of the code?
>> Surely we do not expect gettext to start with 'Attribute "foo" not
>> found' and distinguish fixed from variable parts of that string?
> Sure we do.
How does that work exactly? You're assuming an extremely intelligent
localization mechanism, I guess, which I was not. I think it makes more
sense to work a little harder in the backend to avoid requiring AI
software in every frontend.
>> MESSAGE: Attribute or table name not known within context of query
> How's that different from ERROR:?
Sorry, I meant that as an example of the "secondary message string", but
it's a pretty lame example...
> The general problem here is also that this would introduce a client
> incompatibility. Older clients that do not expect this amount of detail
> will print all this garbage to the screen?
Yes, if we send it to them. It would make sense to control the amount
of detail presented via some option (a GUC variable, probably). For
backwards compatibility reasons we'd want the default to correspond to
roughly the existing amount of detail.
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+M5649@postgresql.org Fri Mar 9 11:48:03 2001
Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28])
by candle.pha.pa.us (8.9.0/8.9.0) with ESMTP id LAA29403
for <pgman@candle.pha.pa.us>; Fri, 9 Mar 2001 11:48:02 -0500 (EST)
Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28])
by mail.postgresql.org (8.11.1/8.11.1) with SMTP id f29Gm7x82613;
Fri, 9 Mar 2001 11:48:07 -0500 (EST)
(envelope-from pgsql-hackers-owner+M5649@postgresql.org)
Received: from mailout03.sul.t-online.com (mailout03.sul.t-online.com [194.25.134.81])
by mail.postgresql.org (8.11.1/8.11.1) with ESMTP id f29Gftx80866
for <pgsql-hackers@postgresql.org>; Fri, 9 Mar 2001 11:41:55 -0500 (EST)
(envelope-from peter_e@gmx.net)
Received: from fwd06.sul.t-online.com
by mailout03.sul.t-online.com with smtp
id 14bPxV-0006Eh-06; Fri, 09 Mar 2001 17:41:41 +0100
Received: from peter.localdomain (520083510237-0001@[212.185.245.76]) by fmrl06.sul.t-online.com
with esmtp id 14bPwb-239C4mC; Fri, 9 Mar 2001 17:40:45 +0100
Date: Fri, 9 Mar 2001 17:50:28 +0100 (CET)
From: Peter Eisentraut <peter_e@gmx.net>
To: Tom Lane <tgl@sss.pgh.pa.us>
cc: <pgsql-hackers@postgresql.org>
Subject: Re: [HACKERS] Internationalized error messages
In-Reply-To: <6895.984153653@sss.pgh.pa.us>
Message-ID: <Pine.LNX.4.30.0103091733430.929-100000@peter.localdomain>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
X-Sender: 520083510237-0001@t-dialin.net
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR
Tom Lane writes:
> I guess I don't understand what you have in mind, because this seems
> self-contradictory. If "client programs can look at the code only",
> then how can the error message text be chosen independently of the code?
Let's say "type mismatch error", code 2200G acc. to SQL. At one place in
the source you write
elog(ERROR, "2200G", "type mismatch in CASE expression (%s vs %s)", ...);
Elsewhere you'd write
elog(ERROR, "2200G", "type mismatch in argument %d of function %s,
expected %s, got %s", ...);
Humans can look at this and have a fairly good idea what they'd need to
fix. However, a client program currently only has the option of failing
or not failing. In this example case it would probably better for it to
fail, but someone else already put forth the example of constraint
violation. In this case the program might want to do something else.
> >> Surely we do not expect gettext to start with 'Attribute "foo" not
> >> found' and distinguish fixed from variable parts of that string?
>
> > Sure we do.
>
> How does that work exactly? You're assuming an extremely intelligent
> localization mechanism, I guess, which I was not. I think it makes more
> sense to work a little harder in the backend to avoid requiring AI
> software in every frontend.
Gettext takes care of this. In the source you'd write
elog(ERROR, "2200G", gettext("type mismatch in CASE expression (%s vs %s)"),
string, string);
When you run the xgettext utility program it scans the source for cases of
gettext(...) and creates message catalogs for the translators. When it
finds printf arguments it automatically includes marks in the message,
such as
"type mismatch in CASE expression (%1$s vs %2$s)"
which the translator better keep in his version. This also handles the
case where the arguments might have to appear in a different order in a
different language.
> Sorry, I meant that as an example of the "secondary message string", but
> it's a pretty lame example...
I guess I'm not sold on the concept of primary and secondary message
strings. If the primary message isn't good enough you better fix that.
--
Peter Eisentraut peter_e@gmx.net http://yi.org/peter-e/
---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster
From pgsql-hackers-owner+M5650@postgresql.org Fri Mar 9 11:58:51 2001
Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28])
by candle.pha.pa.us (8.9.0/8.9.0) with ESMTP id LAA01102
for <pgman@candle.pha.pa.us>; Fri, 9 Mar 2001 11:58:51 -0500 (EST)
Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28])
by mail.postgresql.org (8.11.1/8.11.1) with SMTP id f29Gwux84498;
Fri, 9 Mar 2001 11:58:56 -0500 (EST)
(envelope-from pgsql-hackers-owner+M5650@postgresql.org)
Received: from mailout03.sul.t-online.com (mailout03.sul.t-online.com [194.25.134.81])
by mail.postgresql.org (8.11.1/8.11.1) with ESMTP id f29Gm0x82577
for <pgsql-hackers@postgresql.org>; Fri, 9 Mar 2001 11:48:00 -0500 (EST)
(envelope-from peter_e@gmx.net)
Received: from fwd06.sul.t-online.com
by mailout03.sul.t-online.com with smtp
id 14bQ3Q-0006Eh-05; Fri, 09 Mar 2001 17:47:48 +0100
Received: from peter.localdomain (520083510237-0001@[212.185.245.76]) by fmrl06.sul.t-online.com
with esmtp id 14bQ39-0bSV4SC; Fri, 9 Mar 2001 17:47:31 +0100
Date: Fri, 9 Mar 2001 17:57:13 +0100 (CET)
From: Peter Eisentraut <peter_e@gmx.net>
To: Karel Zak <zakkr@zf.jcu.cz>
cc: Tom Lane <tgl@sss.pgh.pa.us>, <pgsql-hackers@postgresql.org>
Subject: Re: [HACKERS] Internationalized error messages
In-Reply-To: <20010309085320.A7401@ara.zf.jcu.cz>
Message-ID: <Pine.LNX.4.30.0103091756220.929-100000@peter.localdomain>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
X-Sender: 520083510237-0001@t-dialin.net
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR
Karel Zak writes:
> For transaltion to other languages I not sure with gettext() stuff on
> backend -- IMHO better (faster) solution will postgres system catalog
> with it.
elog(ERROR, "cannot open message catalog table");
--
Peter Eisentraut peter_e@gmx.net http://yi.org/peter-e/
---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?
http://www.postgresql.org/users-lounge/docs/faq.html
From pgsql-hackers-owner+M5651@postgresql.org Fri Mar 9 12:08:40 2001
Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28])
by candle.pha.pa.us (8.9.0/8.9.0) with ESMTP id MAA03663
for <pgman@candle.pha.pa.us>; Fri, 9 Mar 2001 12:08:40 -0500 (EST)
Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28])
by mail.postgresql.org (8.11.1/8.11.1) with SMTP id f29H8fx86748;
Fri, 9 Mar 2001 12:08:41 -0500 (EST)
(envelope-from pgsql-hackers-owner+M5651@postgresql.org)
Received: from sss.pgh.pa.us (sss.pgh.pa.us [209.114.132.154])
by mail.postgresql.org (8.11.1/8.11.1) with ESMTP id f29H5Px86225
for <pgsql-hackers@postgresql.org>; Fri, 9 Mar 2001 12:05:25 -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.1/8.11.1) with ESMTP id f29H5M907103;
Fri, 9 Mar 2001 12:05:22 -0500 (EST)
To: Peter Eisentraut <peter_e@gmx.net>
cc: pgsql-hackers@postgresql.org
Subject: Re: [HACKERS] Internationalized error messages
In-reply-to: <Pine.LNX.4.30.0103091733430.929-100000@peter.localdomain>
References: <Pine.LNX.4.30.0103091733430.929-100000@peter.localdomain>
Comments: In-reply-to Peter Eisentraut <peter_e@gmx.net>
message dated "Fri, 09 Mar 2001 17:50:28 +0100"
Date: Fri, 09 Mar 2001 12:05:22 -0500
Message-ID: <7100.984157522@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:
> Let's say "type mismatch error", code 2200G acc. to SQL. At one place in
> the source you write
> elog(ERROR, "2200G", "type mismatch in CASE expression (%s vs %s)", ...);
> Elsewhere you'd write
> elog(ERROR, "2200G", "type mismatch in argument %d of function %s,
> expected %s, got %s", ...);
Okay, so your notion of an error code is not a localizable entity at
all, it's something for client programs to look at. Now I get it.
I object to writing "2200G" however, because that has no mnemonic value
whatever, and is much too easy to get wrong. How about
elog(ERROR, ERR_TYPE_MISMATCH, "type mismatch in argument %d of function %s,
expected %s, got %s", ...);
where ERR_TYPE_MISMATCH is #defined as "2200G" someplace? Or for that
matter #defined as "TYPE_MISMATCH"? Content-free numeric codes are no
fun to use on the client side either...
> Gettext takes care of this. In the source you'd write
> elog(ERROR, "2200G", gettext("type mismatch in CASE expression (%s vs %s)"),
> string, string);
Duh. For some reason I was envisioning the localization substitution as
occurring on the client side, but of course we'd want to do it on the
server side, and before parameters are substituted into the message.
Sorry for the noise.
I am not sure we can/should use gettext (possible license problems?),
but certainly something like this could be cooked up.
>> Sorry, I meant that as an example of the "secondary message string", but
>> it's a pretty lame example...
> I guess I'm not sold on the concept of primary and secondary message
> strings. If the primary message isn't good enough you better fix that.
The motivation isn't so much to improve on the primary message as to
reduce the number of distinct strings that really need to be translated.
Remember all those internal "can't happen" errors. If we have only one
message component then the translator is faced with a huge pile of
internal messages and not a lot of gain from translating them. If
there's a primary and secondary component then all the internal messages
can share the same primary component ("Internal error, please file a bug
report"). Now the translator translates that one message, and can
ignore the many secondary-component messages with a clear conscience.
(Of course, he can translate those too if he really wants to, but the
point is that he doesn't *have* to do it to attain reasonably friendly
behavior.)
Perhaps another way to look at it is that we have a bunch of errors that
are user-oriented (ie, relate pretty directly to something the user did
wrong) and another bunch that are system-oriented (relate to internal
problems, such as consistency check failures or violations of internal
APIs). We want to provide localized translations of the first set, for
sure. I don't think we need localized translations of the second set,
so long as we have some sort of "covering message" that can be localized
for them. Maybe instead of "primary" and "secondary" strings for a
single error, we ought to distinguish these two categories of error and
plan different localization strategies for them.
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+M5665@postgresql.org Fri Mar 9 14:43:45 2001
Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28])
by candle.pha.pa.us (8.9.0/8.9.0) with ESMTP id OAA13877
for <pgman@candle.pha.pa.us>; Fri, 9 Mar 2001 14:43:44 -0500 (EST)
Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28])
by mail.postgresql.org (8.11.1/8.11.1) with SMTP id f29Jhlx10520;
Fri, 9 Mar 2001 14:43:47 -0500 (EST)
(envelope-from pgsql-hackers-owner+M5665@postgresql.org)
Received: from exup.z.zembu.com (nat.zembu.com [209.128.96.253])
by mail.postgresql.org (8.11.1/8.11.1) with ESMTP id f29JhLx10390
for <pgsql-hackers@postgresql.org>; Fri, 9 Mar 2001 14:43:22 -0500 (EST)
(envelope-from andrew@zembu.com)
Received: from andrew by exup.z.zembu.com with local (Exim 3.12 #1 (Debian))
id 14bSnI-0003Qy-00
for <pgsql-hackers@postgresql.org>; Fri, 09 Mar 2001 11:43:20 -0800
Date: Fri, 9 Mar 2001 11:43:20 -0800
To: pgsql-hackers@postgresql.org
Subject: Re: [HACKERS] Internationalized error messages
Message-ID: <20010309114320.C12977@zembu.com>
Mail-Followup-To: pgsql-hackers@postgresql.org
References: <Pine.LNX.4.30.0103091733430.929-100000@peter.localdomain> <7100.984157522@sss.pgh.pa.us>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <7100.984157522@sss.pgh.pa.us>; from tgl@sss.pgh.pa.us on Fri, Mar 09, 2001 at 12:05:22PM -0500
From: Andrew Evans <andrew@zembu.com>
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR
> Peter Eisentraut <peter_e@gmx.net> writes:
> > Let's say "type mismatch error", code 2200G acc. to SQL. At one place in
> > the source you write
> > elog(ERROR, "2200G", "type mismatch in CASE expression (%s vs %s)", ...);
Tom Lane <tgl@sss.pgh.pa.us> spake:
> I object to writing "2200G" however, because that has no mnemonic value
> whatever, and is much too easy to get wrong. How about
>
> elog(ERROR, ERR_TYPE_MISMATCH, "type mismatch in argument %d of function %s,
> expected %s, got %s", ...);
>
> where ERR_TYPE_MISMATCH is #defined as "2200G" someplace? Or for that
> matter #defined as "TYPE_MISMATCH"? Content-free numeric codes are no
> fun to use on the client side either...
This is one thing I think VMS does well. All error messages are a
composite of the subsystem where they originated, the severity of the
error, and the actual error itself. Internally this is stored in a
32-bit word. It's been a long time, so I don't recall how many bits
they allocated for each component. The human-readable representation
looks like "<subsystem>-<severity>-<error>".
--
Andrew Evans
---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster
From pgsql-hackers-owner+M5666@postgresql.org Fri Mar 9 14:58:32 2001
Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28])
by candle.pha.pa.us (8.9.0/8.9.0) with ESMTP id OAA15747
for <pgman@candle.pha.pa.us>; Fri, 9 Mar 2001 14:58:31 -0500 (EST)
Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28])
by mail.postgresql.org (8.11.1/8.11.1) with SMTP id f29JwYx12257;
Fri, 9 Mar 2001 14:58:34 -0500 (EST)
(envelope-from pgsql-hackers-owner+M5666@postgresql.org)
Received: from store.d.zembu.com (nat.zembu.com [209.128.96.253])
by mail.postgresql.org (8.11.1/8.11.1) with ESMTP id f29JnJx11198
for <pgsql-hackers@postgresql.org>; Fri, 9 Mar 2001 14:49:19 -0500 (EST)
(envelope-from ncm@zembu.com)
Received: by store.d.zembu.com (Postfix, from userid 509)
id 0552DA75B; Fri, 9 Mar 2001 11:49:21 -0800 (PST)
Date: Fri, 9 Mar 2001 11:49:20 -0800
To: pgsql-hackers@postgresql.org
Subject: Re: [HACKERS] Internationalized error messages
Message-ID: <20010309114920.D624@store.zembu.com>
Reply-To: pgsql-hackers@postgresql.org
References: <Pine.LNX.4.30.0103091733430.929-100000@peter.localdomain> <7100.984157522@sss.pgh.pa.us>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
User-Agent: Mutt/1.2.5i
In-Reply-To: <7100.984157522@sss.pgh.pa.us>; from tgl@sss.pgh.pa.us on Fri, Mar 09, 2001 at 12:05:22PM -0500
From: ncm@zembu.com (Nathan Myers)
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR
On Fri, Mar 09, 2001 at 12:05:22PM -0500, Tom Lane wrote:
> > Gettext takes care of this. In the source you'd write
>
> > elog(ERROR, "2200G", gettext("type mismatch in CASE expression (%s vs %s)"),
> > string, string);
>
> Duh. For some reason I was envisioning the localization substitution as
> occurring on the client side, but of course we'd want to do it on the
> server side, and before parameters are substituted into the message.
> Sorry for the noise.
>
> I am not sure we can/should use gettext (possible license problems?),
> but certainly something like this could be cooked up.
I've been assuming that PG's needs are specialized enough that the
project wouldn't use gettext directly, but instead something inspired
by it.
If you look at my last posting on the subject, by the way, you will see
that it could work without a catalog underneath; integrating a catalog
would just require changes in a header file (and the programs to generate
the catalog, of course). That quality seems to me essential to allow the
changeover to be phased in gradually, and to allow different underlying
catalog implementations to be tried out.
Nathan
ncm
---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?
http://www.postgresql.org/users-lounge/docs/faq.html
From pgsql-hackers-owner+M5674@postgresql.org Fri Mar 9 15:36:01 2001
Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28])
by candle.pha.pa.us (8.9.0/8.9.0) with ESMTP id PAA19742
for <pgman@candle.pha.pa.us>; Fri, 9 Mar 2001 15:36:00 -0500 (EST)
Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28])
by mail.postgresql.org (8.11.1/8.11.1) with SMTP id f29Ka3x19411;
Fri, 9 Mar 2001 15:36:03 -0500 (EST)
(envelope-from pgsql-hackers-owner+M5674@postgresql.org)
Received: from mailout05.sul.t-online.com (mailout05.sul.t-online.com [194.25.134.82])
by mail.postgresql.org (8.11.1/8.11.1) with ESMTP id f29KZfx19290
for <pgsql-hackers@postgresql.org>; Fri, 9 Mar 2001 15:35:41 -0500 (EST)
(envelope-from peter_e@gmx.net)
Received: from fwd03.sul.t-online.com
by mailout05.sul.t-online.com with smtp
id 14bTbq-0007l3-0G; Fri, 09 Mar 2001 21:35:34 +0100
Received: from peter.localdomain (520083510237-0001@[212.185.245.76]) by fmrl03.sul.t-online.com
with esmtp id 14bTbm-0MoEWuC; Fri, 9 Mar 2001 21:35:30 +0100
Date: Fri, 9 Mar 2001 21:45:14 +0100 (CET)
From: Peter Eisentraut <peter_e@gmx.net>
To: Tom Lane <tgl@sss.pgh.pa.us>
cc: <pgsql-hackers@postgresql.org>
Subject: Re: [HACKERS] Internationalized error messages
In-Reply-To: <7100.984157522@sss.pgh.pa.us>
Message-ID: <Pine.LNX.4.30.0103092133380.929-100000@peter.localdomain>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
X-Sender: 520083510237-0001@t-dialin.net
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR
Tom Lane writes:
> I object to writing "2200G" however, because that has no mnemonic value
> whatever, and is much too easy to get wrong. How about
>
> elog(ERROR, ERR_TYPE_MISMATCH, "type mismatch in argument %d of function %s,
> expected %s, got %s", ...);
>
> where ERR_TYPE_MISMATCH is #defined as "2200G" someplace? Or for that
> matter #defined as "TYPE_MISMATCH"? Content-free numeric codes are no
> fun to use on the client side either...
Well, SQL defines these. Do we want to make our own list? However,
numeric codes also have the advantage that some hierarchy is possible.
E.g., the "22" in "2200G" is actually the category code "data exception".
Personally, I would stick to the SQL codes but make some readable macro
name for backend internal use.
> I am not sure we can/should use gettext (possible license problems?),
Gettext is an open standard, invented at Sun IIRC. There is also an
independent implementation for BSDs in the works. On GNU/Linux system
it's in the C library. I don't see any license problems that way. Is has
been used widely for free software and so far I haven't seen any real
alternative.
> but certainly something like this could be cooked up.
Well, I'm trying to avoid having to do the cooking. ;-)
> Perhaps another way to look at it is that we have a bunch of errors that
> are user-oriented (ie, relate pretty directly to something the user did
> wrong) and another bunch that are system-oriented (relate to internal
> problems, such as consistency check failures or violations of internal
> APIs). We want to provide localized translations of the first set, for
> sure. I don't think we need localized translations of the second set,
> so long as we have some sort of "covering message" that can be localized
> for them.
I'm sure this can be covered in some macro way. A random idea:
elog(ERROR, INTERNAL_ERROR("text"), ...)
expands to
elog(ERROR, gettext("Internal error: %s"), ...)
OTOH, we should not yet make presumptions about what dedicated translators
can be capable of. :-)
--
Peter Eisentraut peter_e@gmx.net http://yi.org/peter-e/
---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
From pgsql-hackers-owner+M5675@postgresql.org Fri Mar 9 15:49:07 2001
Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28])
by candle.pha.pa.us (8.9.0/8.9.0) with ESMTP id PAA20321
for <pgman@candle.pha.pa.us>; Fri, 9 Mar 2001 15:49:07 -0500 (EST)
Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28])
by mail.postgresql.org (8.11.1/8.11.1) with SMTP id f29Kn8x21185;
Fri, 9 Mar 2001 15:49:09 -0500 (EST)
(envelope-from pgsql-hackers-owner+M5675@postgresql.org)
Received: from sss.pgh.pa.us (sss.pgh.pa.us [209.114.132.154])
by mail.postgresql.org (8.11.1/8.11.1) with ESMTP id f29Kmbx20959
for <pgsql-hackers@postgresql.org>; Fri, 9 Mar 2001 15:48: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.1/8.11.1) with ESMTP id f29KmX908663;
Fri, 9 Mar 2001 15:48:33 -0500 (EST)
To: Peter Eisentraut <peter_e@gmx.net>
cc: pgsql-hackers@postgresql.org
Subject: Re: [HACKERS] Internationalized error messages
In-reply-to: <Pine.LNX.4.30.0103092133380.929-100000@peter.localdomain>
References: <Pine.LNX.4.30.0103092133380.929-100000@peter.localdomain>
Comments: In-reply-to Peter Eisentraut <peter_e@gmx.net>
message dated "Fri, 09 Mar 2001 21:45:14 +0100"
Date: Fri, 09 Mar 2001 15:48:33 -0500
Message-ID: <8660.984170913@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:
> Well, SQL defines these. Do we want to make our own list? However,
> numeric codes also have the advantage that some hierarchy is possible.
> E.g., the "22" in "2200G" is actually the category code "data exception".
> Personally, I would stick to the SQL codes but make some readable macro
> name for backend internal use.
We will probably find cases where we need codes not defined by SQL
(since we have non-SQL features). If there is room to invent our
own codes then I have no objection to this.
>> I am not sure we can/should use gettext (possible license problems?),
> Gettext is an open standard, invented at Sun IIRC. There is also an
> independent implementation for BSDs in the works. On GNU/Linux system
> it's in the C library. I don't see any license problems that way.
Unless that BSD implementation is ready to go, I think we'd be talking
about relying on GPL'd (not LGPL'd) code for an essential component of
the system functionality. Given RMS' recent antics I am much less
comfortable with that than I might once have been.
regards, tom lane
---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
From pgsql-hackers-owner+M5801@postgresql.org Tue Mar 13 08:13:36 2001
Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28])
by candle.pha.pa.us (8.9.0/8.9.0) with ESMTP id IAA03404
for <pgman@candle.pha.pa.us>; Tue, 13 Mar 2001 08:13:35 -0500 (EST)
Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28])
by mail.postgresql.org (8.11.1/8.11.1) with SMTP id f2DDCix16410;
Tue, 13 Mar 2001 08:12:44 -0500 (EST)
(envelope-from pgsql-hackers-owner+M5801@postgresql.org)
Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28])
by mail.postgresql.org (8.11.1/8.11.1) with SMTP id f2DDC4x16226
for <pgsql-hackers@postgresql.org>; Tue, 13 Mar 2001 08:12:04 -0500 (EST)
(envelope-from pgsql-hackers-owner@postgresql.org)
Received: from nemeton.com.au (202-76-170-108.dialin.swift.net.au [202.76.170.108])
by mail.postgresql.org (8.11.1/8.11.1) with SMTP id f2AM2xx82737
for <pgsql-hackers@postgresql.org>; Sat, 10 Mar 2001 17:03:00 -0500 (EST)
(envelope-from giles@nemeton.com.au)
Received: (qmail 5430 invoked from network); 10 Mar 2001 22:02:16 -0000
Received: from nemeton.com.au (203.8.3.33)
by nemeton.com.au with SMTP; 10 Mar 2001 22:02:16 -0000
To: pgsql-hackers@postgresql.org
Subject: Re: [HACKERS] Internationalized error messages
In-Reply-To: Message from Tom Lane <tgl@sss.pgh.pa.us>
of "Fri, 09 Mar 2001 12:05:22 CDT." <7100.984157522@sss.pgh.pa.us>
Date: Sun, 11 Mar 2001 09:02:16 +1100
Message-ID: <5428.984261736@nemeton.com.au>
From: Giles Lean <giles@nemeton.com.au>
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR
Tom Lane wrote:
> I am not sure we can/should use gettext (possible license problems?),
> but certainly something like this could be cooked up.
http://citrus.bsdclub.org/index-en.html
I'm not sure of the current status of the code.
Regards,
Giles
---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
From pgsql-hackers-owner+M5809@postgresql.org Tue Mar 13 10:01:04 2001
Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28])
by candle.pha.pa.us (8.9.0/8.9.0) with ESMTP id KAA10081
for <pgman@candle.pha.pa.us>; Tue, 13 Mar 2001 10:01:03 -0500 (EST)
Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28])
by mail.postgresql.org (8.11.1/8.11.1) with SMTP id f2DF01x32641;
Tue, 13 Mar 2001 10:00:01 -0500 (EST)
(envelope-from pgsql-hackers-owner+M5809@postgresql.org)
Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28])
by mail.postgresql.org (8.11.1/8.11.1) with SMTP id f2DESJx26149
for <pgsql-hackers@postgresql.org>; Tue, 13 Mar 2001 09:28:19 -0500 (EST)
(envelope-from pgsql-hackers-owner@postgresql.org)
Received: from henry.newn.cam.ac.uk (henry.newn.cam.ac.uk [131.111.204.130])
by mail.postgresql.org (8.11.1/8.11.1) with ESMTP id f2BIBGx97386
for <pgsql-hackers@postgresql.org>; Sun, 11 Mar 2001 13:11:16 -0500 (EST)
(envelope-from prlw1@newn.cam.ac.uk)
Received: from [131.111.204.180] (helo=quartz.newn.cam.ac.uk)
by henry.newn.cam.ac.uk with esmtp (Exim 3.13 #1)
id 14cAJ4-0002pP-00; Sun, 11 Mar 2001 18:11:02 +0000
Received: from prlw1 by quartz.newn.cam.ac.uk with local (Exim 3.13 #1)
id 14cAJ4-0002Em-00; Sun, 11 Mar 2001 18:11:02 +0000
Date: Sun, 11 Mar 2001 18:11:02 +0000
From: Patrick Welche <prlw1@newn.cam.ac.uk>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Peter Eisentraut <peter_e@gmx.net>, pgsql-hackers@postgresql.org
Subject: Re: [HACKERS] Internationalized error messages
Message-ID: <20010311181102.B8454@quartz.newn.cam.ac.uk>
Reply-To: prlw1@cam.ac.uk
References: <Pine.LNX.4.30.0103092133380.929-100000@peter.localdomain> <8660.984170913@sss.pgh.pa.us>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
User-Agent: Mutt/1.2i
In-Reply-To: <8660.984170913@sss.pgh.pa.us>; from tgl@sss.pgh.pa.us on Fri, Mar 09, 2001 at 03:48:33PM -0500
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR
On Fri, Mar 09, 2001 at 03:48:33PM -0500, Tom Lane wrote:
> Peter Eisentraut <peter_e@gmx.net> writes:
> > Well, SQL defines these. Do we want to make our own list? However,
> > numeric codes also have the advantage that some hierarchy is possible.
> > E.g., the "22" in "2200G" is actually the category code "data exception".
> > Personally, I would stick to the SQL codes but make some readable macro
> > name for backend internal use.
>
> We will probably find cases where we need codes not defined by SQL
> (since we have non-SQL features). If there is room to invent our
> own codes then I have no objection to this.
>
> >> I am not sure we can/should use gettext (possible license problems?),
>
> > Gettext is an open standard, invented at Sun IIRC. There is also an
> > independent implementation for BSDs in the works. On GNU/Linux system
> > it's in the C library. I don't see any license problems that way.
>
> Unless that BSD implementation is ready to go, I think we'd be talking
> about relying on GPL'd (not LGPL'd) code for an essential component of
> the system functionality. Given RMS' recent antics I am much less
> comfortable with that than I might once have been.
cf. http://citrus.bsdclub.org/
and the libintl in NetBSD, at least NetBSD-current, works. The hard part
was eg convincing gmake's configure to use it as there are bits like
#if __USE_GNU_GETTEXT
rather than just checking for the existence of the functions (as well as
the internal symbol _nl_msg_cat_cntr).
So yes it's ready to go, but please don't use the same m4 in configure.in as
for GNU gettext.
Cheers,
Patrick
---------------------------(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+M5729@postgresql.org Mon Mar 12 08:38:58 2001
Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28])
by candle.pha.pa.us (8.9.0/8.9.0) with ESMTP id IAA29321
for <pgman@candle.pha.pa.us>; Mon, 12 Mar 2001 08:38:57 -0500 (EST)
Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28])
by mail.postgresql.org (8.11.1/8.11.1) with SMTP id f2CDbhx08914;
Mon, 12 Mar 2001 08:37:43 -0500 (EST)
(envelope-from pgsql-hackers-owner+M5729@postgresql.org)
Received: from ara.zf.jcu.cz ([160.217.161.4])
by mail.postgresql.org (8.11.1/8.11.1) with ESMTP id f2CCDQx02184
for <pgsql-hackers@postgresql.org>; Mon, 12 Mar 2001 07:13:26 -0500 (EST)
(envelope-from zakkr@zf.jcu.cz)
Received: (from zakkr@localhost)
by ara.zf.jcu.cz (8.9.3/8.9.3/Debian 8.9.3-21) id KAA03098;
Mon, 12 Mar 2001 10:32:34 +0100
Date: Mon, 12 Mar 2001 10:32:33 +0100
From: Karel Zak <zakkr@zf.jcu.cz>
To: Peter Eisentraut <peter_e@gmx.net>
Cc: Karel Zak <zakkr@zf.jcu.cz>, Tom Lane <tgl@sss.pgh.pa.us>,
pgsql-hackers@postgresql.org
Subject: Re: [HACKERS] Internationalized error messages
Message-ID: <20010312103232.A2268@ara.zf.jcu.cz>
References: <20010309085320.A7401@ara.zf.jcu.cz> <Pine.LNX.4.30.0103091756220.929-100000@peter.localdomain>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
User-Agent: Mutt/1.0.1i
In-Reply-To: <Pine.LNX.4.30.0103091756220.929-100000@peter.localdomain>; from peter_e@gmx.net on Fri, Mar 09, 2001 at 05:57:13PM +0100
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR
On Fri, Mar 09, 2001 at 05:57:13PM +0100, Peter Eisentraut wrote:
> Karel Zak writes:
>
> > For transaltion to other languages I not sure with gettext() stuff on
> > backend -- IMHO better (faster) solution will postgres system catalog
> > with it.
>
> elog(ERROR, "cannot open message catalog table");
Sure, and what:
elog(ERROR, gettext("can't set LC_MESSAGES"));
We can generate our system catalog for this by simular way as gettext, it's
means all messages can be in sources in English too.
But this is reflexion, performance test show more.
Karel
--
Karel Zak <zakkr@zf.jcu.cz>
http://home.zf.jcu.cz/~zakkr/
C, PostgreSQL, PHP, WWW, http://docs.linux.cz, http://mape.jcu.cz
---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?
http://www.postgresql.org/users-lounge/docs/faq.html
From pgsql-hackers-owner+M5734@postgresql.org Mon Mar 12 11:30:24 2001
Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28])
by candle.pha.pa.us (8.9.0/8.9.0) with ESMTP id LAA06736
for <pgman@candle.pha.pa.us>; Mon, 12 Mar 2001 11:30:23 -0500 (EST)
Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28])
by mail.postgresql.org (8.11.1/8.11.1) with SMTP id f2CGUSx29891;
Mon, 12 Mar 2001 11:30:28 -0500 (EST)
(envelope-from pgsql-hackers-owner+M5734@postgresql.org)
Received: from mail.retep.org.uk ([216.126.85.184])
by mail.postgresql.org (8.11.1/8.11.1) with ESMTP id f2CGCYx27481
for <pgsql-hackers@postgresql.org>; Mon, 12 Mar 2001 11:12:34 -0500 (EST)
(envelope-from peter@retep.org.uk)
Received: from heather.retep.org.uk ([193.113.113.179])
(authenticated)
by mail.retep.org.uk (8.11.1/8.11.1) with ESMTP id f2CGCQR27465;
Mon, 12 Mar 2001 11:12:26 -0500 (EST)
(envelope-from peter@retep.org.uk)
Message-Id: <5.0.2.1.0.20010312143839.0214cc90@mail.retep.org.uk>
X-Sender: peter@mail.retep.org.uk
X-Mailer: QUALCOMM Windows Eudora Version 5.0.2
Date: Mon, 12 Mar 2001 15:09:53 +0000
To: Peter Eisentraut <peter_e@gmx.net>,
PostgreSQL Development <pgsql-hackers@postgresql.org>
From: Peter Mount <peter@retep.org.uk>
Subject: Re: [HACKERS] Internationalized error messages
In-Reply-To: <Pine.LNX.4.30.0103082319150.1061-100000@peter.localdomain>
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"; format=flowed
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR
At 23:49 08/03/01 +0100, Peter Eisentraut wrote:
>I really feel that translated error messages need to happen soon.
>Managing translated message catalogs can be done easily with available
>APIs. However, translatable messages really require an error code
>mechanism (otherwise it's completely impossible for programs to interpret
>error messages reliably). I've been thinking about this for much too long
>now and today I finally settled to the simplest possible solution.
>
>Let the actual method of allocating error codes be irrelevant for now,
>although the ones in the SQL standard are certainly to be considered for a
>start. Essentially, instead of writing
snip
>On the protocol front, this could be pretty easy to do. Instead of
>"message text" we'd send a string "XYZ01: message text". Worst case, we
>pass this unfiltered to the client and provide an extra function that
>returns only the first five characters. Alternatively we could strip off
>the prefix when returning the message text only.
Most other DB's (I'm thinking of Oracle here) pass the code unfiltered to
the client anyhow. Saying that, it's not impossible to get psql and other
interactive clients to strip the error code anyhow.
>At the end, the i18n part would actually be pretty easy, e.g.,
>
> elog(ERROR, "XYZ01", gettext("stuff happened"));
>
>
>Comments? Better ideas?
A couple of ideas. One, if we have a master list of error codes, we need to
have this in an independent format (ie not a .h file). However the other
idea is to expand on the JDBC's errors.properties files. Being
ascii/unicode, the format will work with just some extra code to implement
them in C.
Brief description:
------------------------
The ResourceBundle's handle one language per file. From a base filename,
each different language has a file based on:
filename_la_ct.properties
where la is the ISO 2 character language, and ct is the ISO 2 character
country code.
For example:
messages_en_GB.properties
messages_en_US.properties
messages_en.properties
messages_fr.properties
messages.properties
Now, here for the english locale for England it checks in this order:
messages_en_GB.properties messages_en.properties messages.properties.
In each file, a message is of the format:
key=message, and each parameter passed into the message written like {1}
{2} etc, so for example:
fathom=Unable to fathom update count {0}
Now apart from the base file (messages.properties in this case), the other
files are optional, and an entry only needs to be in there if they are
present in that language.
So, in french, fathom may be translated, but then again it may not (in JDBC
it isn't). Then it's not included in the file. Any new messages can be
added to the base language, but only included as and when they are translated.
Peter
---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?
http://www.postgresql.org/search.mpl
From pgsql-hackers-owner+M5736@postgresql.org Mon Mar 12 14:12:38 2001
Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28])
by candle.pha.pa.us (8.9.0/8.9.0) with ESMTP id OAA13271
for <pgman@candle.pha.pa.us>; Mon, 12 Mar 2001 14:12:36 -0500 (EST)
Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28])
by mail.postgresql.org (8.11.1/8.11.1) with SMTP id f2CJAMx49815;
Mon, 12 Mar 2001 14:10:22 -0500 (EST)
(envelope-from pgsql-hackers-owner+M5736@postgresql.org)
Received: from mailout03.sul.t-online.com (mailout03.sul.t-online.com [194.25.134.81])
by mail.postgresql.org (8.11.1/8.11.1) with ESMTP id f2CJ5kx49312
for <pgsql-hackers@postgresql.org>; Mon, 12 Mar 2001 14:05:46 -0500 (EST)
(envelope-from peter_e@gmx.net)
Received: from fwd05.sul.t-online.com
by mailout03.sul.t-online.com with smtp
id 14cXdC-0005sr-00; Mon, 12 Mar 2001 20:05:22 +0100
Received: from peter.localdomain (520083510237-0001@[212.185.245.45]) by fmrl05.sul.t-online.com
with esmtp id 14cXd2-1UHYcCC; Mon, 12 Mar 2001 20:05:12 +0100
Date: Mon, 12 Mar 2001 20:15:02 +0100 (CET)
From: Peter Eisentraut <peter_e@gmx.net>
To: Karel Zak <zakkr@zf.jcu.cz>
cc: Tom Lane <tgl@sss.pgh.pa.us>, <pgsql-hackers@postgresql.org>
Subject: Re: [HACKERS] Internationalized error messages
In-Reply-To: <20010312103232.A2268@ara.zf.jcu.cz>
Message-ID: <Pine.LNX.4.30.0103122013270.1047-100000@peter.localdomain>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
X-Sender: 520083510237-0001@t-dialin.net
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR
Karel Zak writes:
> > > For transaltion to other languages I not sure with gettext() stuff on
> > > backend -- IMHO better (faster) solution will postgres system catalog
> > > with it.
> >
> > elog(ERROR, "cannot open message catalog table");
>
> Sure, and what:
>
> elog(ERROR, gettext("can't set LC_MESSAGES"));
>
> We can generate our system catalog for this by simular way as gettext, it's
> means all messages can be in sources in English too.
When there is an error condition in the backend, the last thing you want
to do (and are allowed to do) is accessing tables. Also keep in mind that
we want to internationalize other parts of the system as well, such as
pg_dump and psql.
--
Peter Eisentraut peter_e@gmx.net http://yi.org/peter-e/
---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
From pgsql-hackers-owner+M5791@postgresql.org Tue Mar 13 02:41:02 2001
Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28])
by candle.pha.pa.us (8.9.0/8.9.0) with ESMTP id CAA18106
for <pgman@candle.pha.pa.us>; Tue, 13 Mar 2001 02:41:01 -0500 (EST)
Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28])
by mail.postgresql.org (8.11.1/8.11.1) with SMTP id f2D7dWx73584;
Tue, 13 Mar 2001 02:39:32 -0500 (EST)
(envelope-from pgsql-hackers-owner+M5791@postgresql.org)
Received: from ara.zf.jcu.cz (ara.zf.jcu.cz [160.217.161.4])
by mail.postgresql.org (8.11.1/8.11.1) with ESMTP id f2D7V5x72953
for <pgsql-hackers@postgresql.org>; Tue, 13 Mar 2001 02:31:05 -0500 (EST)
(envelope-from zakkr@zf.jcu.cz)
Received: (from zakkr@localhost)
by ara.zf.jcu.cz (8.9.3/8.9.3/Debian 8.9.3-21) id IAA26971;
Tue, 13 Mar 2001 08:30:59 +0100
Date: Tue, 13 Mar 2001 08:30:59 +0100
From: Karel Zak <zakkr@zf.jcu.cz>
To: Peter Eisentraut <peter_e@gmx.net>
Cc: Karel Zak <zakkr@zf.jcu.cz>, Tom Lane <tgl@sss.pgh.pa.us>,
pgsql-hackers@postgresql.org
Subject: Re: [HACKERS] Internationalized error messages
Message-ID: <20010313083058.C24468@ara.zf.jcu.cz>
References: <20010312103232.A2268@ara.zf.jcu.cz> <Pine.LNX.4.30.0103122013270.1047-100000@peter.localdomain>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
User-Agent: Mutt/1.0.1i
In-Reply-To: <Pine.LNX.4.30.0103122013270.1047-100000@peter.localdomain>; from peter_e@gmx.net on Mon, Mar 12, 2001 at 08:15:02PM +0100
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR
On Mon, Mar 12, 2001 at 08:15:02PM +0100, Peter Eisentraut wrote:
> Karel Zak writes:
>
> > > > For transaltion to other languages I not sure with gettext() stuff on
> > > > backend -- IMHO better (faster) solution will postgres system catalog
> > > > with it.
> > >
> > > elog(ERROR, "cannot open message catalog table");
> >
> > Sure, and what:
> >
> > elog(ERROR, gettext("can't set LC_MESSAGES"));
> >
> > We can generate our system catalog for this by simular way as gettext, it's
> > means all messages can be in sources in English too.
>
> When there is an error condition in the backend, the last thing you want
> to do (and are allowed to do) is accessing tables. Also keep in mind that
> we want to internationalize other parts of the system as well, such as
> pg_dump and psql.
Agree, the pg_xxxx application are good adepts for POSIX locales, all my
previous notes are about backend error/notice messages, but forget it --
after implementation we will more judicious.
--
Karel Zak <zakkr@zf.jcu.cz>
http://home.zf.jcu.cz/~zakkr/
C, PostgreSQL, PHP, WWW, http://docs.linux.cz, http://mape.jcu.cz
---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster
From pgsql-hackers-owner+M6177@postgresql.org Mon Mar 19 17:58:41 2001
Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28])
by candle.pha.pa.us (8.9.0/8.9.0) with ESMTP id RAA09211
for <pgman@candle.pha.pa.us>; Mon, 19 Mar 2001 17:58:40 -0500 (EST)
Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28])
by mail.postgresql.org (8.11.3/8.11.1) with SMTP id f2JMw5N07189;
Mon, 19 Mar 2001 17:58:05 -0500 (EST)
(envelope-from pgsql-hackers-owner+M6177@postgresql.org)
Received: from mailout03.sul.t-online.com (mailout03.sul.t-online.com [194.25.134.81])
by mail.postgresql.org (8.11.3/8.11.1) with ESMTP id f2JMkaN84648
for <pgsql-hackers@postgresql.org>; Mon, 19 Mar 2001 17:46:36 -0500 (EST)
(envelope-from peter_e@gmx.net)
Received: from fwd03.sul.t-online.com
by mailout03.sul.t-online.com with smtp
id 14f8Q5-0007Mt-01; Mon, 19 Mar 2001 23:46:33 +0100
Received: from peter.localdomain (520083510237-0001@[217.80.146.106]) by fmrl03.sul.t-online.com
with esmtp id 14f8Px-15zChUC; Mon, 19 Mar 2001 23:46:25 +0100
Date: Mon, 19 Mar 2001 23:56:32 +0100 (CET)
From: Peter Eisentraut <peter_e@gmx.net>
To: PostgreSQL Development <pgsql-hackers@postgresql.org>
Subject: [HACKERS] More on elog and error codes
Message-ID: <Pine.LNX.4.30.0103192110470.1131-100000@peter.localdomain>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
X-Sender: 520083510237-0001@t-dialin.net
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR
I've looked at the elog calls in the source, about 1700 in total (only
elog(ERROR)). If we mapped these to the SQL error codes then we'd have
about two dozen calls with an assigned code and the rest being "other".
The way I estimate it (I didn't really look at *each* call, of course) is
that about 2/3 of the calls are internal panic calls ("cache lookup of %s
failed"), 1/6 are SQL-level problems, and the rest are operating system,
storage problems, "not implemented", misconfigurations, etc.
A problem that makes this quite hard to manage is that many errors can be
reported from several places, e.g., the parser, the executor, the access
method. Some of these messages are probably not readily reproduceable
because they are caught elsewhere.
Consequentially, the most pragmatic approach to assigning error codes
might be to just pick some numbers and give them out gradually. A
hierarchical subsystem+code might be useful, beyond that it really depends
on what we expect from error codes in the first place. Does anyone have
good experiences from other products?
Essentially, I envision making up a new function, say "elogc", which has
elogc(<level>, [<subsys>,?] <code>, message...)
where the code is some macro, the expansion of which is to be determined.
A call to "elogc" would also require a formalized message wording, adding
the error code to the documentation, which also requires having a fairly
good idea how the error can happen and how to handle it. This could
perhaps even be automated to some extent.
All the calls that are not converted yet will be assigned a to the generic
"internal error" class; most of them will stay this way.
As for translations, I don't think we have to worry about this right now.
Assuming that we would use gettext or something similar, we can tell it
that all calls to elog (or "elogc" or whatever) contain translatable
strings, so we don't have to uglify it with gettext(...) or _(...) calls
or what else.
So we need some good error numbering scheme. Any ideas?
--
Peter Eisentraut peter_e@gmx.net http://yi.org/peter-e/
---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?
http://www.postgresql.org/search.mpl
From pgsql-hackers-owner+M6182@postgresql.org Mon Mar 19 19:19:38 2001
Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28])
by candle.pha.pa.us (8.9.0/8.9.0) with ESMTP id TAA13745
for <pgman@candle.pha.pa.us>; Mon, 19 Mar 2001 19:19:37 -0500 (EST)
Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28])
by mail.postgresql.org (8.11.3/8.11.1) with SMTP id f2K0J2N56455;
Mon, 19 Mar 2001 19:19:02 -0500 (EST)
(envelope-from pgsql-hackers-owner+M6182@postgresql.org)
Received: from acheron.rime.com.au (albatr.lnk.telstra.net [139.130.54.222])
by mail.postgresql.org (8.11.3/8.11.1) with ESMTP id f2JNnEN15608
for <pgsql-hackers@postgresql.org>; Mon, 19 Mar 2001 18:49:14 -0500 (EST)
(envelope-from pjw@rhyme.com.au)
Received: from oberon (Oberon.rime.com.au [203.8.195.100])
by acheron.rime.com.au (8.9.3/8.9.3) with SMTP id KAA19461;
Tue, 20 Mar 2001 10:48:55 +1100
Message-Id: <3.0.5.32.20010320104855.0339d300@mail.rhyme.com.au>
X-Sender: pjw@mail.rhyme.com.au
X-Mailer: QUALCOMM Windows Eudora Pro Version 3.0.5 (32)
Date: Tue, 20 Mar 2001 10:48:55 +1100
To: Peter Eisentraut <peter_e@gmx.net>,
PostgreSQL Development <pgsql-hackers@postgresql.org>
From: Philip Warner <pjw@rhyme.com.au>
Subject: Re: [HACKERS] More on elog and error codes
In-Reply-To: <Pine.LNX.4.30.0103192110470.1131-100000@peter.localdomain>
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR
At 23:56 19/03/01 +0100, Peter Eisentraut wrote:
>
>Essentially, I envision making up a new function, say "elogc", which has
>
> elogc(<level>, [<subsys>,?] <code>, message...)
>
>where the code is some macro, the expansion of which is to be determined.
>A call to "elogc" would also require a formalized message wording, adding
>the error code to the documentation, which also requires having a fairly
>good idea how the error can happen and how to handle it. This could
>perhaps even be automated to some extent.
>
>All the calls that are not converted yet will be assigned a to the generic
>"internal error" class; most of them will stay this way.
>
...
>
>So we need some good error numbering scheme. Any ideas?
>
FWIW, the VMS scheme has error numbers broken down to include system,
subsystem, error number & severity. These are maintained in an error
message source file. eg. the file system's 'file not found' error message
is something like:
FACILITY RMS (the file system)
...
SEVERITY WARNING
...
FILNFND "File %AS not found"
...
It's a while since I used VMS messages files regularly, this is at least
representative. It has the drawback that severity is often tied to the
message, not the circumstance, but this is a problem only rarely.
In code, the messages are used as external symbols (probably in our case
representing pointers to C format strings). In making extensive use of such
a mnemonics, I never really needed to have full text messages. Once a set
of standards is in place for message abbreviations, the most people can
read the message codes. This would mean that:
elogc(<level>, [<subsys>,?] <code>, message...)
becomes:
elogc(<code> [, parameter...])
eg.
"cache lookup of %s failed"
might be replaced by:
elog(CACHELOOKUPFAIL, cacheItemThatFailed);
and
"internal error: %s"
becomes
elog(INTERNAL, "could not find the VeryImportantThing");
Unlike VMS, it's probably a good idea to separate the severity from the
error code, since a CACHELOOKUPFAIL in one place may be less significant
than another (eg. severity=debug).
I also think it's important that we get the source file and line number
somewhere in the message, and if we have these, we may not need the subsystem.
----------------------------------------------------------------
Philip Warner | __---_____
Albatross Consulting Pty. Ltd. |----/ - \
(A.B.N. 75 008 659 498) | /(@) ______---_
Tel: (+61) 0500 83 82 81 | _________ \
Fax: (+61) 0500 83 82 82 | ___________ |
Http://www.rhyme.com.au | / \|
| --________--
PGP key available upon request, | /
and from pgp5.ai.mit.edu:11371 |/
---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
From pgsql-hackers-owner+M6184@postgresql.org Mon Mar 19 19:36:40 2001
Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28])
by candle.pha.pa.us (8.9.0/8.9.0) with ESMTP id TAA15177
for <pgman@candle.pha.pa.us>; Mon, 19 Mar 2001 19:36:40 -0500 (EST)
Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28])
by mail.postgresql.org (8.11.3/8.11.1) with SMTP id f2K0ZvN60485;
Mon, 19 Mar 2001 19:35:57 -0500 (EST)
(envelope-from pgsql-hackers-owner+M6184@postgresql.org)
Received: from sss.pgh.pa.us (sss.pgh.pa.us [209.114.132.154])
by mail.postgresql.org (8.11.3/8.11.1) with ESMTP id f2K0ZbN60358
for <pgsql-hackers@postgresql.org>; Mon, 19 Mar 2001 19:35: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.1/8.11.1) with ESMTP id f2K0ZMt08329;
Mon, 19 Mar 2001 19:35:22 -0500 (EST)
To: Philip Warner <pjw@rhyme.com.au>
cc: Peter Eisentraut <peter_e@gmx.net>,
PostgreSQL Development <pgsql-hackers@postgresql.org>
Subject: Re: [HACKERS] More on elog and error codes
In-reply-to: <3.0.5.32.20010320104855.0339d300@mail.rhyme.com.au>
References: <3.0.5.32.20010320104855.0339d300@mail.rhyme.com.au>
Comments: In-reply-to Philip Warner <pjw@rhyme.com.au>
message dated "Tue, 20 Mar 2001 10:48:55 +1100"
Date: Mon, 19 Mar 2001 19:35:22 -0500
Message-ID: <8326.985048522@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR
Philip Warner <pjw@rhyme.com.au> writes:
> I also think it's important that we get the source file and line number
> somewhere in the message, and if we have these, we may not need the
> subsystem.
I agree that the subsystem concept is not necessary, except possibly as
a means of avoiding collisions in the error-symbol namespace, and for
that it would only be a naming convention (PGERR_subsys_IDENTIFIER).
We probably do not need it considering that we have much less than 1000
distinct error identifiers to assign, judging from Peter's survey.
We do need severity to be distinct from the error code ("internal
errors" are surely not all the same severity, even if we don't bother
to assign formal error codes to each one).
BTW, the symbols used in the source code do need to have a common prefix
(PGERR_CACHELOOKUPFAIL not CACHELOOKUPFAIL) to avoid namespace pollution
problems. We blew this before with "DEBUG" and friends, let's learn
from that mistake.
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+M6205@postgresql.org Tue Mar 20 11:30:33 2001
Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28])
by candle.pha.pa.us (8.9.0/8.9.0) with ESMTP id LAA29491
for <pgman@candle.pha.pa.us>; Tue, 20 Mar 2001 11:30:32 -0500 (EST)
Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28])
by mail.postgresql.org (8.11.3/8.11.1) with SMTP id f2KGRqN30235;
Tue, 20 Mar 2001 11:27:53 -0500 (EST)
(envelope-from pgsql-hackers-owner+M6205@postgresql.org)
Received: from mailout05.sul.t-online.com (mailout05.sul.t-online.com [194.25.134.82])
by mail.postgresql.org (8.11.3/8.11.1) with ESMTP id f2KGQ2N29944
for <pgsql-hackers@postgresql.org>; Tue, 20 Mar 2001 11:26:02 -0500 (EST)
(envelope-from peter_e@gmx.net)
Received: from fwd06.sul.t-online.com
by mailout05.sul.t-online.com with smtp
id 14fOx7-0001ta-02; Tue, 20 Mar 2001 17:25:45 +0100
Received: from peter.localdomain (520083510237-0001@[217.80.146.107]) by fmrl06.sul.t-online.com
with esmtp id 14fOww-0JqouOC; Tue, 20 Mar 2001 17:25:34 +0100
Date: Tue, 20 Mar 2001 17:35:42 +0100 (CET)
From: Peter Eisentraut <peter_e@gmx.net>
To: Philip Warner <pjw@rhyme.com.au>
cc: PostgreSQL Development <pgsql-hackers@postgresql.org>
Subject: Re: [HACKERS] More on elog and error codes
In-Reply-To: <3.0.5.32.20010320104855.0339d300@mail.rhyme.com.au>
Message-ID: <Pine.LNX.4.30.0103201726200.1639-100000@peter.localdomain>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
X-Sender: 520083510237-0001@t-dialin.net
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR
Philip Warner writes:
> elog(CACHELOOKUPFAIL, cacheItemThatFailed);
The disadvantage of this approach, which I tried to explain in a previous
message, is that we might want to have different wordings for different
occurences of the same class of error.
Additionally, the whole idea behind having error *codes* is that the
client program can easily distinguish errors that it can handle specially.
Thus the codes should be numeric or some other short, fixed scheme. In
the backend they could be replaced by macros.
Example:
#define PGERR_TYPE 1854
/* somewhere... */
elogc(ERROR, PGERR_TYPE, "type %s cannot be created because it already exists", ...)
/* elsewhere... */
elogc(ERROR, PGERR_TYPE, "type %s used as argument %d of function %s doesn't exist", ...)
In fact, this is my proposal. The "1854" can be argued, but I like the
rest.
--
Peter Eisentraut peter_e@gmx.net http://yi.org/peter-e/
---------------------------(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+M6236@postgresql.org Tue Mar 20 16:59:30 2001
Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28])
by candle.pha.pa.us (8.9.0/8.9.0) with ESMTP id QAA23182
for <pgman@candle.pha.pa.us>; Tue, 20 Mar 2001 16:59:29 -0500 (EST)
Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28])
by mail.postgresql.org (8.11.3/8.11.1) with SMTP id f2KLwdH05279;
Tue, 20 Mar 2001 16:58:39 -0500 (EST)
(envelope-from pgsql-hackers-owner+M6236@postgresql.org)
Received: from mta1-rme.xtra.co.nz (mta1-rme.xtra.co.nz [203.96.92.1])
by mail.postgresql.org (8.11.3/8.11.1) with ESMTP id f2KLfiH02063
for <pgsql-hackers@postgresql.org>; Tue, 20 Mar 2001 16:41:45 -0500 (EST)
(envelope-from csawtell@xtra.co.nz)
Received: from berty ([210.54.106.166]) by mta1-rme.xtra.co.nz with SMTP
id <20010320214348.MNVZ4360745.mta1-rme.xtra.co.nz@berty>;
Wed, 21 Mar 2001 09:43:48 +1200
Content-Type: text/plain;
charset="iso-8859-1"
From: Christopher Sawtell <csawtell@xtra.co.nz>
Organization: At Home
To: Peter Eisentraut <peter_e@gmx.net>,
PostgreSQL Development <pgsql-hackers@postgresql.org>
Subject: Re: [HACKERS] More on elog and error codes
Date: Wed, 21 Mar 2001 09:41:44 +1200
X-Mailer: KMail [version 1.2]
References: <Pine.LNX.4.30.0103192110470.1131-100000@peter.localdomain>
In-Reply-To: <Pine.LNX.4.30.0103192110470.1131-100000@peter.localdomain>
MIME-Version: 1.0
Message-Id: <01032109414401.09393@berty>
Content-Transfer-Encoding: 8bit
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR
On Tue, 20 Mar 2001 10:56, you wrote:
> I've looked at the elog calls in the source, about 1700 in total (only
[ ... ]
> So we need some good error numbering scheme. Any ideas?
Just that it might be a good idea to incorporate the version / release
details in some way so that when somebody on the list is squeaking about
an error message it is obvious to the helper that the advice needed is to
upgrade from the Cretatious Period version to a modern release, and have
another go.
--
Sincerely etc.,
NAME Christopher Sawtell
CELL PHONE 021 257 4451
ICQ UIN 45863470
EMAIL csawtell @ xtra . co . nz
CNOTES ftp://ftp.funet.fi/pub/languages/C/tutorials/sawtell_C.tar.gz
-->> Please refrain from using HTML or WORD attachments in e-mails to me
<<--
---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
From pgsql-hackers-owner+M6239@postgresql.org Tue Mar 20 17:12:06 2001
Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28])
by candle.pha.pa.us (8.9.0/8.9.0) with ESMTP id RAA24116
for <pgman@candle.pha.pa.us>; Tue, 20 Mar 2001 17:12:06 -0500 (EST)
Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28])
by mail.postgresql.org (8.11.3/8.11.1) with SMTP id f2KMBKH08034;
Tue, 20 Mar 2001 17:11:20 -0500 (EST)
(envelope-from pgsql-hackers-owner+M6239@postgresql.org)
Received: from wallace.ece.rice.edu (wallace.ece.rice.edu [128.42.12.154])
by mail.postgresql.org (8.11.3/8.11.1) with ESMTP id f2KMAxH07894
for <pgsql-hackers@postgresql.org>; Tue, 20 Mar 2001 17:10:59 -0500 (EST)
(envelope-from reedstrm@rice.edu)
Received: by rice.edu
via sendmail from stdin
id <m14fULB-000LGUC@wallace.ece.rice.edu> (Debian Smail3.2.0.102)
for pgsql-hackers@postgresql.org; Tue, 20 Mar 2001 16:10:57 -0600 (CST)
Date: Tue, 20 Mar 2001 16:10:57 -0600
From: "Ross J. Reedstrom" <reedstrm@rice.edu>
To: PostgreSQL Development <pgsql-hackers@postgresql.org>
Subject: Re: [HACKERS] More on elog and error codes
Message-ID: <20010320161057.C1703@rice.edu>
Mail-Followup-To: PostgreSQL Development <pgsql-hackers@postgresql.org>
References: <Pine.LNX.4.30.0103192110470.1131-100000@peter.localdomain> <01032109414401.09393@berty>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
User-Agent: Mutt/1.0i
In-Reply-To: <01032109414401.09393@berty>; from csawtell@xtra.co.nz on Wed, Mar 21, 2001 at 09:41:44AM +1200
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR
On Wed, Mar 21, 2001 at 09:41:44AM +1200, Christopher Sawtell wrote:
> On Tue, 20 Mar 2001 10:56, you wrote:
>
> Just that it might be a good idea to incorporate the version / release
> details in some way so that when somebody on the list is squeaking about
> an error message it is obvious to the helper that the advice needed is to
> upgrade from the Cretatious Period version to a modern release, and have
ROFL - parsed this as Cretinous period on the first pass.
Ross
---------------------------(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+M6244@postgresql.org Tue Mar 20 17:46:15 2001
Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28])
by candle.pha.pa.us (8.9.0/8.9.0) with ESMTP id RAA29664
for <pgman@candle.pha.pa.us>; Tue, 20 Mar 2001 17:46:14 -0500 (EST)
Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28])
by mail.postgresql.org (8.11.3/8.11.1) with SMTP id f2KMj4H13670;
Tue, 20 Mar 2001 17:45:04 -0500 (EST)
(envelope-from pgsql-hackers-owner+M6244@postgresql.org)
Received: from acheron.rime.com.au (albatr.lnk.telstra.net [139.130.54.222])
by mail.postgresql.org (8.11.3/8.11.1) with ESMTP id f2KMi3H13356
for <pgsql-hackers@postgresql.org>; Tue, 20 Mar 2001 17:44:04 -0500 (EST)
(envelope-from pjw@rhyme.com.au)
Received: from oberon (Oberon.rime.com.au [203.8.195.100])
by acheron.rime.com.au (8.9.3/8.9.3) with SMTP id JAA06820;
Wed, 21 Mar 2001 09:43:53 +1100
Message-Id: <3.0.5.32.20010321094352.0287ad00@mail.rhyme.com.au>
X-Sender: pjw@mail.rhyme.com.au
X-Mailer: QUALCOMM Windows Eudora Pro Version 3.0.5 (32)
Date: Wed, 21 Mar 2001 09:43:52 +1100
To: Peter Eisentraut <peter_e@gmx.net>
From: Philip Warner <pjw@rhyme.com.au>
Subject: Re: [HACKERS] More on elog and error codes
Cc: PostgreSQL Development <pgsql-hackers@postgresql.org>
In-Reply-To: <Pine.LNX.4.30.0103201726200.1639-100000@peter.localdomain>
References: <3.0.5.32.20010320104855.0339d300@mail.rhyme.com.au>
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR
At 17:35 20/03/01 +0100, Peter Eisentraut wrote:
>Philip Warner writes:
>
>> elog(CACHELOOKUPFAIL, cacheItemThatFailed);
>
>The disadvantage of this approach, which I tried to explain in a previous
>message, is that we might want to have different wordings for different
>occurences of the same class of error.
>
>Additionally, the whole idea behind having error *codes* is that the
>client program can easily distinguish errors that it can handle specially.
>Thus the codes should be numeric or some other short, fixed scheme. In
>the backend they could be replaced by macros.
This seems to be just an argument for constructing the value of
PGERR_CACHELOOKUPFAIL carefully (which is what the VMS message source files
did). The point is that when they are used by a developer, they are simple.
>#define PGERR_TYPE 1854
>
>/* somewhere... */
>
>elogc(ERROR, PGERR_TYPE, "type %s cannot be created because it already
exists", ...)
>
>/* elsewhere... */
>
>elogc(ERROR, PGERR_TYPE, "type %s used as argument %d of function %s
doesn't exist", ...)
>
I can appreciate that there may be cases where the same message is reused,
but that is where parameter substitution comes in.
In the specific example above, returning the same error code is not going
to help the client. What if they want to handle "type %s used as argument
%d of function %s doesn't exist" by creating the type, and silently ignore
"type %s cannot be created because it already exists"?
How do you handle "type %s can not be used as a function return type"? Is
this PGERR_FUNC or PGERR_TYPE?
If the motivation behind this is to alloy easy translation to SQL error
codes, then I suggest we have an error definition file with explicit
translation:
Code SQL Text
PGERR_TYPALREXI 02xxx "type %s cannot be created because it already exists"
PGERR_FUNCNOTYPE 02xxx "type %s used as argument %d of function %s doesn't
exist"
and if we want a generic 'type does not exist', then:
PGERR_NOSUCHTYPE 02xxx "type %s does not exist - %s"
where the %s might contain 'it can't be used as a function argument'.
the we just have
elogc(ERROR, PGERR_TYPALEXI, ...)
/* elsewhere... */
elogc(ERROR, PGERR_FUNCNOTYPE, ...)
Creating central message files/objects has the added advantage of a much
simpler locale support - they're just resource files, and they're NOT
embedded throughout the code.
Finally, if you do want to have some kind of error classification beyond
the SQL code, it could be encoded in the error message file.
----------------------------------------------------------------
Philip Warner | __---_____
Albatross Consulting Pty. Ltd. |----/ - \
(A.B.N. 75 008 659 498) | /(@) ______---_
Tel: (+61) 0500 83 82 81 | _________ \
Fax: (+61) 0500 83 82 82 | ___________ |
Http://www.rhyme.com.au | / \|
| --________--
PGP key available upon request, | /
and from pgp5.ai.mit.edu:11371 |/
---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?
http://www.postgresql.org/search.mpl
From pgsql-hackers-owner+M6246@postgresql.org Tue Mar 20 17:48:13 2001
Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28])
by candle.pha.pa.us (8.9.0/8.9.0) with ESMTP id RAA29776
for <pgman@candle.pha.pa.us>; Tue, 20 Mar 2001 17:48:12 -0500 (EST)
Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28])
by mail.postgresql.org (8.11.3/8.11.1) with SMTP id f2KMlVH14127;
Tue, 20 Mar 2001 17:47:31 -0500 (EST)
(envelope-from pgsql-hackers-owner+M6246@postgresql.org)
Received: from acheron.rime.com.au (albatr.lnk.telstra.net [139.130.54.222])
by mail.postgresql.org (8.11.3/8.11.1) with ESMTP id f2KMlAH14010
for <pgsql-hackers@postgresql.org>; Tue, 20 Mar 2001 17:47:11 -0500 (EST)
(envelope-from pjw@rhyme.com.au)
Received: from oberon (Oberon.rime.com.au [203.8.195.100])
by acheron.rime.com.au (8.9.3/8.9.3) with SMTP id JAA06895;
Wed, 21 Mar 2001 09:46:55 +1100
Message-Id: <3.0.5.32.20010321094655.02852720@mail.rhyme.com.au>
X-Sender: pjw@mail.rhyme.com.au
X-Mailer: QUALCOMM Windows Eudora Pro Version 3.0.5 (32)
Date: Wed, 21 Mar 2001 09:46:55 +1100
To: Christopher Sawtell <csawtell@xtra.co.nz>,
Peter Eisentraut <peter_e@gmx.net>,
PostgreSQL Development <pgsql-hackers@postgresql.org>
From: Philip Warner <pjw@rhyme.com.au>
Subject: Re: [HACKERS] More on elog and error codes
In-Reply-To: <01032109414401.09393@berty>
References: <Pine.LNX.4.30.0103192110470.1131-100000@peter.localdomain>
<Pine.LNX.4.30.0103192110470.1131-100000@peter.localdomain>
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR
At 09:41 21/03/01 +1200, Christopher Sawtell wrote:
>Just that it might be a good idea to incorporate the version / release
>details in some way so that when somebody on the list is squeaking about
>an error message it is obvious to the helper that the advice needed is to
>upgrade from the Cretatious Period version to a modern release, and have
>another go.
This is better handled by the bug *reporting* system; the users can easily
get the current version number from PG and send it with their reports. We
don't really want all the error codes changing between releases.
----------------------------------------------------------------
Philip Warner | __---_____
Albatross Consulting Pty. Ltd. |----/ - \
(A.B.N. 75 008 659 498) | /(@) ______---_
Tel: (+61) 0500 83 82 81 | _________ \
Fax: (+61) 0500 83 82 82 | ___________ |
Http://www.rhyme.com.au | / \|
| --________--
PGP key available upon request, | /
and from pgp5.ai.mit.edu:11371 |/
---------------------------(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+M6288@postgresql.org Tue Mar 20 21:47:12 2001
Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28])
by candle.pha.pa.us (8.9.0/8.9.0) with ESMTP id VAA14475
for <pgman@candle.pha.pa.us>; Tue, 20 Mar 2001 21:47:11 -0500 (EST)
Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28])
by mail.postgresql.org (8.11.3/8.11.1) with SMTP id f2L2jHH28234;
Tue, 20 Mar 2001 21:45:17 -0500 (EST)
(envelope-from pgsql-hackers-owner+M6288@postgresql.org)
Received: from acheron.rime.com.au (albatr.lnk.telstra.net [139.130.54.222])
by mail.postgresql.org (8.11.3/8.11.1) with ESMTP id f2L2hcH27912
for <pgsql-hackers@postgresql.org>; Tue, 20 Mar 2001 21:43:38 -0500 (EST)
(envelope-from pjw@rhyme.com.au)
Received: from oberon (Oberon.rime.com.au [203.8.195.100])
by acheron.rime.com.au (8.9.3/8.9.3) with SMTP id NAA10433;
Wed, 21 Mar 2001 13:43:25 +1100
Message-Id: <3.0.5.32.20010321134325.028a4e90@mail.rhyme.com.au>
X-Sender: pjw@mail.rhyme.com.au
X-Mailer: QUALCOMM Windows Eudora Pro Version 3.0.5 (32)
Date: Wed, 21 Mar 2001 13:43:25 +1100
To: Peter Eisentraut <peter_e@gmx.net>
From: Philip Warner <pjw@rhyme.com.au>
Subject: Re: [HACKERS] More on elog and error codes
Cc: PostgreSQL Development <pgsql-hackers@postgresql.org>
In-Reply-To: <3.0.5.32.20010321094352.0287ad00@mail.rhyme.com.au>
References: <Pine.LNX.4.30.0103201726200.1639-100000@peter.localdomain>
<3.0.5.32.20010320104855.0339d300@mail.rhyme.com.au>
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR
At 09:43 21/03/01 +1100, Philip Warner wrote:
>
>Code SQL Text
>PGERR_TYPALREXI 02xxx "type %s cannot be created because it already exists"
>PGERR_FUNCNOTYPE 02xxx "type %s used as argument %d of function %s doesn't
>exist"
>
Peter,
Just to clarify, because in a previous email you seemed to believe that I
wanted 'PGERR_TYPALREXI' to resolve to a string. I have no such desire; a
meaningful number is fine, but we should never have to type it. One
possibility is that it is the address of an error-info function (built by
'compiling' the message file). Another possibility is that it could be a
prefix to several external symbols, PGERR_TYPALREXI_msg,
PGERR_TYPALREXI_code, PGERR_TYPALREXI_num, PGERR_TYPALREXI_sqlcode etc,
which are again built by compiling the message file. We can then encode
whatever we like into the message, have flexible text, and ease of use for
developers.
Hope this clarifies things...
----------------------------------------------------------------
Philip Warner | __---_____
Albatross Consulting Pty. Ltd. |----/ - \
(A.B.N. 75 008 659 498) | /(@) ______---_
Tel: (+61) 0500 83 82 81 | _________ \
Fax: (+61) 0500 83 82 82 | ___________ |
Http://www.rhyme.com.au | / \|
| --________--
PGP key available upon request, | /
and from pgp5.ai.mit.edu:11371 |/
---------------------------(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+M6357@postgresql.org Wed Mar 21 15:55:00 2001
Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28])
by candle.pha.pa.us (8.9.0/8.9.0) with ESMTP id PAA13050
for <pgman@candle.pha.pa.us>; Wed, 21 Mar 2001 15:54:59 -0500 (EST)
Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28])
by mail.postgresql.org (8.11.3/8.11.1) with SMTP id f2LKsCt45782;
Wed, 21 Mar 2001 15:54:12 -0500 (EST)
(envelope-from pgsql-hackers-owner+M6357@postgresql.org)
Received: from mailout01.sul.t-online.com (mailout01.sul.t-online.com [194.25.134.80])
by mail.postgresql.org (8.11.3/8.11.1) with ESMTP id f2LKrst45607
for <pgsql-hackers@postgresql.org>; Wed, 21 Mar 2001 15:53:54 -0500 (EST)
(envelope-from peter_e@gmx.net)
Received: from fwd07.sul.t-online.com
by mailout01.sul.t-online.com with smtp
id 14fpbU-0001v6-04; Wed, 21 Mar 2001 21:53:12 +0100
Received: from peter.localdomain (520083510237-0001@[212.185.245.125]) by fmrl07.sul.t-online.com
with esmtp id 14fpbH-25w9q4C; Wed, 21 Mar 2001 21:52:59 +0100
Date: Wed, 21 Mar 2001 22:03:09 +0100 (CET)
From: Peter Eisentraut <peter_e@gmx.net>
To: Philip Warner <pjw@rhyme.com.au>
cc: PostgreSQL Development <pgsql-hackers@postgresql.org>
Subject: Re: [HACKERS] More on elog and error codes
In-Reply-To: <3.0.5.32.20010321094352.0287ad00@mail.rhyme.com.au>
Message-ID: <Pine.LNX.4.30.0103212158370.1694-100000@peter.localdomain>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
X-Sender: 520083510237-0001@t-dialin.net
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR
Philip Warner writes:
> If the motivation behind this is to alloy easy translation to SQL error
> codes, then I suggest we have an error definition file with explicit
> translation:
>
> Code SQL Text
> PGERR_TYPALREXI 02xxx "type %s cannot be created because it already exists"
> PGERR_FUNCNOTYPE 02xxx "type %s used as argument %d of function %s doesn't
> exist"
>
> and if we want a generic 'type does not exist', then:
>
> PGERR_NOSUCHTYPE 02xxx "type %s does not exist - %s"
>
> where the %s might contain 'it can't be used as a function argument'.
>
> the we just have
>
> elogc(ERROR, PGERR_TYPALEXI, ...)
>
> /* elsewhere... */
>
> elogc(ERROR, PGERR_FUNCNOTYPE, ...)
This is going to be a disaster for the coder. Every time you look at an
elog you don't know what it does? Is the first arg a %s or a %d? What's
the first %s, what the second? How can this be checked against bugs? (I
know GCC can be pretty helpful here, but does it catch all problems?)
Conversely, when you look at the error message you don't know from what
contexts it's called. The error messages will degrade rapidly in quality
because changing one will become a major project.
> Creating central message files/objects has the added advantage of a much
> simpler locale support - they're just resource files, and they're NOT
> embedded throughout the code.
Actually, the fact that the messages are in the code, where they're used,
and not in a catalog file is a reason why gettext is so popular and
catgets gets laughed at.
--
Peter Eisentraut peter_e@gmx.net http://yi.org/peter-e/
---------------------------(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+M6370@postgresql.org Wed Mar 21 20:32:02 2001
Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28])
by candle.pha.pa.us (8.9.0/8.9.0) with ESMTP id UAA03400
for <pgman@candle.pha.pa.us>; Wed, 21 Mar 2001 20:32:02 -0500 (EST)
Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28])
by mail.postgresql.org (8.11.3/8.11.1) with SMTP id f2M1VSt53916;
Wed, 21 Mar 2001 20:31:28 -0500 (EST)
(envelope-from pgsql-hackers-owner+M6370@postgresql.org)
Received: from acheron.rime.com.au (albatr.lnk.telstra.net [139.130.54.222])
by mail.postgresql.org (8.11.3/8.11.1) with ESMTP id f2M1UZt53760
for <pgsql-hackers@postgresql.org>; Wed, 21 Mar 2001 20:30:36 -0500 (EST)
(envelope-from pjw@rhyme.com.au)
Received: from oberon (Oberon.rime.com.au [203.8.195.100])
by acheron.rime.com.au (8.9.3/8.9.3) with SMTP id MAA11046;
Thu, 22 Mar 2001 12:30:19 +1100
Message-Id: <3.0.5.32.20010322123019.02a9e760@mail.rhyme.com.au>
X-Sender: pjw@mail.rhyme.com.au
X-Mailer: QUALCOMM Windows Eudora Pro Version 3.0.5 (32)
Date: Thu, 22 Mar 2001 12:30:19 +1100
To: Peter Eisentraut <peter_e@gmx.net>
From: Philip Warner <pjw@rhyme.com.au>
Subject: Re: [HACKERS] More on elog and error codes
Cc: PostgreSQL Development <pgsql-hackers@postgresql.org>
In-Reply-To: <Pine.LNX.4.30.0103212158370.1694-100000@peter.localdomain>
References: <3.0.5.32.20010321094352.0287ad00@mail.rhyme.com.au>
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR
At 22:03 21/03/01 +0100, Peter Eisentraut wrote:
>Philip Warner writes:
>
>> If the motivation behind this is to alloy easy translation to SQL error
>> codes, then I suggest we have an error definition file with explicit
>> translation:
>>
>> Code SQL Text
>> PGERR_TYPALREXI 02xxx "type %s cannot be created because it already
exists"
>> PGERR_FUNCNOTYPE 02xxx "type %s used as argument %d of function %s doesn't
>> exist"
>>
>> and if we want a generic 'type does not exist', then:
>>
>> PGERR_NOSUCHTYPE 02xxx "type %s does not exist - %s"
>>
>> where the %s might contain 'it can't be used as a function argument'.
>>
>> the we just have
>>
>> elogc(ERROR, PGERR_TYPALEXI, ...)
>>
>> /* elsewhere... */
>>
>> elogc(ERROR, PGERR_FUNCNOTYPE, ...)
>
>This is going to be a disaster for the coder. Every time you look at an
>elog you don't know what it does? Is the first arg a %s or a %d? What's
>the first %s, what the second?
>From experience using this sort of system, probably 80% of errors in new
code are new; if you don't know the format of your own errors, then you
have a larger problem. Secondly, most errors have obvious parameters, and
it only ever gets confusing when they have more than one parameter, and
even then it's pretty obvious. This concern was often raised by people new
to the system, but generally turned out to be more FUD than fact.
>How can this be checked against bugs?
>Conversely, when you look at the error message you don't know from what
>contexts it's called.
Am I missing something here? The user gets a message like:
TYPALREXI: Specified type 'fred' already exists.
then we do
glimpse TYPALREXI
It is actually a lot easier than the plain text search we already have to
do, when we have to guess at the words that have been substituted into the
message. Besides, in *both* proposed systems, if we have done things
properly, then the postgres log also contains the module name & line #.
>The error messages will degrade rapidly in quality
>because changing one will become a major project.
Changing one will be a major project only if it is used everywhere. Most
will be relatively localized. And, with glimpse 'XYZ', it's not really that
big a task. Finally, you would need to ask why it was being changed - would
a new message work better? Tell me where the degradation in quality is in
comparison with text-in-the-source versions, with umpteen dozen slightly
different versions of essentially the same error messages?
>> Creating central message files/objects has the added advantage of a much
>> simpler locale support - they're just resource files, and they're NOT
>> embedded throughout the code.
>
>Actually, the fact that the messages are in the code, where they're used,
>and not in a catalog file is a reason why gettext is so popular and
>catgets gets laughed at.
Is there a URL for a getcats vs. gettext debate would help me understand
the reason for the laughter? I can understand laughing at code that looks
like:
elog(ERROR, 123456, typename);
but
elog(ERROR, TYPALREXI, typename);
is a whole lot more readable.
Also, you failed to address the two points below:
>#define PGERR_TYPE 1854
>
>/* somewhere... */
>
>elogc(ERROR, PGERR_TYPE, "type %s cannot be created because it already
exists", ...)
>
>/* elsewhere... */
>
>elogc(ERROR, PGERR_TYPE, "type %s used as argument %d of function %s
doesn't exist", ...)
>
In the specific example above, returning the same error code is not going
to help the client. What if they want to handle "type %s used as argument
%d of function %s doesn't exist" by creating the type, and silently ignore
"type %s cannot be created because it already exists"?
How do you handle "type %s can not be used as a function return type"? Is
this PGERR_FUNC or PGERR_TYPE?
----------------------------------------------------------------
Philip Warner | __---_____
Albatross Consulting Pty. Ltd. |----/ - \
(A.B.N. 75 008 659 498) | /(@) ______---_
Tel: (+61) 0500 83 82 81 | _________ \
Fax: (+61) 0500 83 82 82 | ___________ |
Http://www.rhyme.com.au | / \|
| --________--
PGP key available upon request, | /
and from pgp5.ai.mit.edu:11371 |/
---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?
http://www.postgresql.org/users-lounge/docs/faq.html
From pgsql-hackers-owner+M6392@postgresql.org Wed Mar 21 23:27:40 2001
Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28])
by candle.pha.pa.us (8.9.0/8.9.0) with ESMTP id XAA12785
for <pgman@candle.pha.pa.us>; Wed, 21 Mar 2001 23:27:38 -0500 (EST)
Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28])
by mail.postgresql.org (8.11.3/8.11.1) with SMTP id f2M4QOt75962;
Wed, 21 Mar 2001 23:26:24 -0500 (EST)
(envelope-from pgsql-hackers-owner+M6392@postgresql.org)
Received: from sss.pgh.pa.us (sss.pgh.pa.us [209.114.132.154])
by mail.postgresql.org (8.11.3/8.11.1) with ESMTP id f2M4PWt75732
for <pgsql-hackers@postgresql.org>; Wed, 21 Mar 2001 23:25:32 -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.1/8.11.1) with ESMTP id f2M4Ov607983;
Wed, 21 Mar 2001 23:24:57 -0500 (EST)
To: Philip Warner <pjw@rhyme.com.au>
cc: Peter Eisentraut <peter_e@gmx.net>,
PostgreSQL Development <pgsql-hackers@postgresql.org>
Subject: Re: [HACKERS] More on elog and error codes
In-reply-to: <3.0.5.32.20010322123019.02a9e760@mail.rhyme.com.au>
References: <3.0.5.32.20010321094352.0287ad00@mail.rhyme.com.au> <3.0.5.32.20010322123019.02a9e760@mail.rhyme.com.au>
Comments: In-reply-to Philip Warner <pjw@rhyme.com.au>
message dated "Thu, 22 Mar 2001 12:30:19 +1100"
Date: Wed, 21 Mar 2001 23:24:57 -0500
Message-ID: <7980.985235097@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR
I've pretty much got to agree with Peter on both of these points.
Philip Warner <pjw@rhyme.com.au> writes:
> At 22:03 21/03/01 +0100, Peter Eisentraut wrote:
>>>> elogc(ERROR, PGERR_FUNCNOTYPE, ...)
>>
>> This is going to be a disaster for the coder. Every time you look at an
>> elog you don't know what it does? Is the first arg a %s or a %d? What's
>> the first %s, what the second?
>> From experience using this sort of system, probably 80% of errors in new
> code are new; if you don't know the format of your own errors, then you
> have a larger problem. Secondly, most errors have obvious parameters, and
> it only ever gets confusing when they have more than one parameter, and
> even then it's pretty obvious.
The general set of parameters might be pretty obvious, but the exact
type that the format string expects them to be is not so obvious. We
have enough ints, longs, unsigned longs, etc etc running around the
system that care is required. If you look at the existing elog calls
you'll find quite a lot of explicit casts to make certain that the right
thing will happen. If the format strings are not directly visible to
the guy writing an elog call, then errors of that kind will creep in
more easily.
>> The error messages will degrade rapidly in quality
>> because changing one will become a major project.
> Changing one will be a major project only if it is used everywhere.
I agree with Peter on this one too. Even having to edit a separate
file will create enough friction that people will tend to use an
existing string if it's even marginally appropriate. What I fear even
more is that people will simply not code error checks, especially for
"can't happen" cases, because it's too much of a pain in the neck to
register the appropriate message.
We must not raise the cost of adding error checks significantly, or we
will lose the marginal checks that sometimes save our bacon by revealing
bugs.
regards, tom lane
---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster
From pgsql-hackers-owner+M6397@postgresql.org Wed Mar 21 23:50:40 2001
Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28])
by candle.pha.pa.us (8.9.0/8.9.0) with ESMTP id XAA13781
for <pgman@candle.pha.pa.us>; Wed, 21 Mar 2001 23:50:39 -0500 (EST)
Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28])
by mail.postgresql.org (8.11.3/8.11.1) with SMTP id f2M4oDt78916;
Wed, 21 Mar 2001 23:50:13 -0500 (EST)
(envelope-from pgsql-hackers-owner+M6397@postgresql.org)
Received: from acheron.rime.com.au (albatr.lnk.telstra.net [139.130.54.222])
by mail.postgresql.org (8.11.3/8.11.1) with ESMTP id f2M4m9t78519
for <pgsql-hackers@postgresql.org>; Wed, 21 Mar 2001 23:48:09 -0500 (EST)
(envelope-from pjw@rhyme.com.au)
Received: from oberon (Oberon.rime.com.au [203.8.195.100])
by acheron.rime.com.au (8.9.3/8.9.3) with SMTP id PAA14815;
Thu, 22 Mar 2001 15:47:52 +1100
Message-Id: <3.0.5.32.20010322154752.02983550@mail.rhyme.com.au>
X-Sender: pjw@mail.rhyme.com.au
X-Mailer: QUALCOMM Windows Eudora Pro Version 3.0.5 (32)
Date: Thu, 22 Mar 2001 15:47:52 +1100
To: Peter Eisentraut <peter_e@gmx.net>
From: Philip Warner <pjw@rhyme.com.au>
Subject: Re: [HACKERS] More on elog and error codes
Cc: PostgreSQL Development <pgsql-hackers@postgresql.org>
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR
At 22:03 21/03/01 +0100, Peter Eisentraut wrote:
>
>This is going to be a disaster for the coder. Every time you look at an
>elog you don't know what it does? Is the first arg a %s or a %d? What's
>the first %s, what the second?
FWIW, I did a quick scan for elog in PG and found:
- 6856 calls (may include commented-out calls)
- 2528 unique messages
- 1248 have no parameters
- 859 have exactly one argument
- 285 have exactly 2 args
- 136 have 3 or more args
so 83% have one or no arguments, which is probably not going to be very
confusing.
Looking at the actual messages, there is also a great deal of opportunity
to standardize and simplify since many of the messages only differ by their
prefixed function name.
----------------------------------------------------------------
Philip Warner | __---_____
Albatross Consulting Pty. Ltd. |----/ - \
(A.B.N. 75 008 659 498) | /(@) ______---_
Tel: (+61) 0500 83 82 81 | _________ \
Fax: (+61) 0500 83 82 82 | ___________ |
Http://www.rhyme.com.au | / \|
| --________--
PGP key available upon request, | /
and from pgp5.ai.mit.edu:11371 |/
---------------------------(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+M6411@postgresql.org Thu Mar 22 00:21:12 2001
Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28])
by candle.pha.pa.us (8.9.0/8.9.0) with ESMTP id AAA15497
for <pgman@candle.pha.pa.us>; Thu, 22 Mar 2001 00:21:11 -0500 (EST)
Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28])
by mail.postgresql.org (8.11.3/8.11.1) with SMTP id f2M5Kkt84723;
Thu, 22 Mar 2001 00:20:46 -0500 (EST)
(envelope-from pgsql-hackers-owner+M6411@postgresql.org)
Received: from acheron.rime.com.au (albatr.lnk.telstra.net [139.130.54.222])
by mail.postgresql.org (8.11.3/8.11.1) with ESMTP id f2M5K5t84513
for <pgsql-hackers@postgresql.org>; Thu, 22 Mar 2001 00:20:06 -0500 (EST)
(envelope-from pjw@rhyme.com.au)
Received: from oberon (Oberon.rime.com.au [203.8.195.100])
by acheron.rime.com.au (8.9.3/8.9.3) with SMTP id QAA15327;
Thu, 22 Mar 2001 16:19:38 +1100
Message-Id: <3.0.5.32.20010322161938.02a87a70@mail.rhyme.com.au>
X-Sender: pjw@mail.rhyme.com.au
X-Mailer: QUALCOMM Windows Eudora Pro Version 3.0.5 (32)
Date: Thu, 22 Mar 2001 16:19:38 +1100
To: Tom Lane <tgl@sss.pgh.pa.us>
From: Philip Warner <pjw@rhyme.com.au>
Subject: Re: [HACKERS] More on elog and error codes
Cc: Peter Eisentraut <peter_e@gmx.net>,
PostgreSQL Development <pgsql-hackers@postgresql.org>
In-Reply-To: <7980.985235097@sss.pgh.pa.us>
References: <3.0.5.32.20010322123019.02a9e760@mail.rhyme.com.au>
<3.0.5.32.20010321094352.0287ad00@mail.rhyme.com.au>
<3.0.5.32.20010322123019.02a9e760@mail.rhyme.com.au>
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR
At 23:24 21/03/01 -0500, Tom Lane wrote:
>I've pretty much got to agree with Peter on both of these points.
Damn.
>Philip Warner <pjw@rhyme.com.au> writes:
>> At 22:03 21/03/01 +0100, Peter Eisentraut wrote:
>>>>> elogc(ERROR, PGERR_FUNCNOTYPE, ...)
>>>
>>> This is going to be a disaster for the coder. Every time you look at an
>>> elog you don't know what it does? Is the first arg a %s or a %d? What's
>>> the first %s, what the second?
>
>>> From experience using this sort of system, probably 80% of errors in new
>> code are new; if you don't know the format of your own errors, then you
>> have a larger problem. Secondly, most errors have obvious parameters, and
>> it only ever gets confusing when they have more than one parameter, and
>> even then it's pretty obvious.
>
>The general set of parameters might be pretty obvious, but the exact
>type that the format string expects them to be is not so obvious. We
>have enough ints, longs, unsigned longs, etc etc running around the
>system that care is required. If you look at the existing elog calls
>you'll find quite a lot of explicit casts to make certain that the right
>thing will happen. If the format strings are not directly visible to
>the guy writing an elog call, then errors of that kind will creep in
>more easily.
I agree it's more likely, but most (all?) cases can be caught by the
compiler. It's not ideal, but neither is having eight different versions of
the same message.
>>> The error messages will degrade rapidly in quality
>>> because changing one will become a major project.
>
>> Changing one will be a major project only if it is used everywhere.
>
>I agree with Peter on this one too. Even having to edit a separate
>file will create enough friction that people will tend to use an
>existing string if it's even marginally appropriate. What I fear even
>more is that people will simply not code error checks, especially for
>"can't happen" cases, because it's too much of a pain in the neck to
>register the appropriate message.
>
>We must not raise the cost of adding error checks significantly, or we
>will lose the marginal checks that sometimes save our bacon by revealing
>bugs.
This is a problem, I agree - but a procedural one. We need to make
registering messages easy. To do this, rather than having a central message
file, perhaps do the following:
- allow multiple message files (which can be processed to produce .h
files). eg. pg_dump would have it's own pg_dump_messages.xxx file.
- define a message that will assume it's first arg is really a format
string for use in the "can't happen" classes, and which has the SQLCODE for
'internal error'.
We do need some central control, but by creating module-based message files
we can allocate number ranges easily, and we at least take a step down the
path towards a both easy locale handling and a 'big book of error codes'.
----------------------------------------------------------------
Philip Warner | __---_____
Albatross Consulting Pty. Ltd. |----/ - \
(A.B.N. 75 008 659 498) | /(@) ______---_
Tel: (+61) 0500 83 82 81 | _________ \
Fax: (+61) 0500 83 82 82 | ___________ |
Http://www.rhyme.com.au | / \|
| --________--
PGP key available upon request, | /
and from pgp5.ai.mit.edu:11371 |/
---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?
http://www.postgresql.org/users-lounge/docs/faq.html
From pgsql-hackers-owner+M6412@postgresql.org Thu Mar 22 00:39:33 2001
Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28])
by candle.pha.pa.us (8.9.0/8.9.0) with ESMTP id AAA16152
for <pgman@candle.pha.pa.us>; Thu, 22 Mar 2001 00:39:33 -0500 (EST)
Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28])
by mail.postgresql.org (8.11.3/8.11.1) with SMTP id f2M5d5t87081;
Thu, 22 Mar 2001 00:39:06 -0500 (EST)
(envelope-from pgsql-hackers-owner+M6412@postgresql.org)
Received: from sss.pgh.pa.us (sss.pgh.pa.us [209.114.132.154])
by mail.postgresql.org (8.11.3/8.11.1) with ESMTP id f2M5aCt86851
for <pgsql-hackers@postgresql.org>; Thu, 22 Mar 2001 00:36: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.1/8.11.1) with ESMTP id f2M5Zm618634;
Thu, 22 Mar 2001 00:35:48 -0500 (EST)
To: Philip Warner <pjw@rhyme.com.au>
cc: Peter Eisentraut <peter_e@gmx.net>,
PostgreSQL Development <pgsql-hackers@postgresql.org>
Subject: Re: [HACKERS] More on elog and error codes
In-reply-to: <3.0.5.32.20010322161938.02a87a70@mail.rhyme.com.au>
References: <3.0.5.32.20010322123019.02a9e760@mail.rhyme.com.au> <3.0.5.32.20010321094352.0287ad00@mail.rhyme.com.au> <3.0.5.32.20010322123019.02a9e760@mail.rhyme.com.au> <3.0.5.32.20010322161938.02a87a70@mail.rhyme.com.au>
Comments: In-reply-to Philip Warner <pjw@rhyme.com.au>
message dated "Thu, 22 Mar 2001 16:19:38 +1100"
Date: Thu, 22 Mar 2001 00:35:48 -0500
Message-ID: <18631.985239348@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR
Philip Warner <pjw@rhyme.com.au> writes:
> This is a problem, I agree - but a procedural one. We need to make
> registering messages easy. To do this, rather than having a central message
> file, perhaps do the following:
> - allow multiple message files (which can be processed to produce .h
> files). eg. pg_dump would have it's own pg_dump_messages.xxx file.
I guess I fail to see why that's better than processing the .c files
to extract the message strings from them.
I agree that the sort of system Peter proposes doesn't have any direct
forcing function to discourage gratuitous variations of what's basically
the same message. The forcing function would have to come from the
translators, who will look at the extracted list of messages and
complain that there are near-duplicates. Then we fix the
near-duplicates. Seems like no big deal.
However, a system that uses multiple message files is also not going to
discourage near-duplicates very effectively. I don't think you can have
it both ways: if you are discouraging near-duplicates, then you are
making it harder to for people to create new messages, whether
duplicates or not.
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+M6417@postgresql.org Thu Mar 22 01:42:24 2001
Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28])
by candle.pha.pa.us (8.9.0/8.9.0) with ESMTP id BAA20802
for <pgman@candle.pha.pa.us>; Thu, 22 Mar 2001 01:42:23 -0500 (EST)
Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28])
by mail.postgresql.org (8.11.3/8.11.1) with SMTP id f2M6g2t94104;
Thu, 22 Mar 2001 01:42:02 -0500 (EST)
(envelope-from pgsql-hackers-owner+M6417@postgresql.org)
Received: from acheron.rime.com.au (albatr.lnk.telstra.net [139.130.54.222])
by mail.postgresql.org (8.11.3/8.11.1) with ESMTP id f2M6eut94000
for <pgsql-hackers@postgresql.org>; Thu, 22 Mar 2001 01:40:57 -0500 (EST)
(envelope-from pjw@rhyme.com.au)
Received: from oberon (Oberon.rime.com.au [203.8.195.100])
by acheron.rime.com.au (8.9.3/8.9.3) with SMTP id RAA16408;
Thu, 22 Mar 2001 17:40:23 +1100
Message-Id: <3.0.5.32.20010322174022.00b4fe60@mail.rhyme.com.au>
X-Sender: pjw@mail.rhyme.com.au
X-Mailer: QUALCOMM Windows Eudora Pro Version 3.0.5 (32)
Date: Thu, 22 Mar 2001 17:40:22 +1100
To: Tom Lane <tgl@sss.pgh.pa.us>
From: Philip Warner <pjw@rhyme.com.au>
Subject: Re: [HACKERS] More on elog and error codes
Cc: Peter Eisentraut <peter_e@gmx.net>,
PostgreSQL Development <pgsql-hackers@postgresql.org>
In-Reply-To: <18631.985239348@sss.pgh.pa.us>
References: <3.0.5.32.20010322161938.02a87a70@mail.rhyme.com.au>
<3.0.5.32.20010322123019.02a9e760@mail.rhyme.com.au>
<3.0.5.32.20010321094352.0287ad00@mail.rhyme.com.au>
<3.0.5.32.20010322123019.02a9e760@mail.rhyme.com.au>
<3.0.5.32.20010322161938.02a87a70@mail.rhyme.com.au>
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR
At 00:35 22/03/01 -0500, Tom Lane wrote:
>Philip Warner <pjw@rhyme.com.au> writes:
>> This is a problem, I agree - but a procedural one. We need to make
>> registering messages easy. To do this, rather than having a central message
>> file, perhaps do the following:
>
>> - allow multiple message files (which can be processed to produce .h
>> files). eg. pg_dump would have it's own pg_dump_messages.xxx file.
>
>However, a system that uses multiple message files is also not going to
>discourage near-duplicates very effectively. I don't think you can have
>it both ways: if you are discouraging near-duplicates, then you are
>making it harder to for people to create new messages, whether
>duplicates or not.
Many of the near duplicates are in the same, or related, code so with local
message files there should be a good chance of reduced duplicates.
Other advantages of a separate definition include:
- Extra fields (eg. description, resolution) which could be used by client
programs.
- Message IDs which can be checked by clients to detect specific errors,
independent of locale.
- SQLCODE set in one place, rather than developers having to code it in
multiple places.
The original proposal also included a 'class' field:
elogc(ERROR, PGERR_TYPE, "type %s cannot be created because it already
ISTM that we will have a similar allocation problem with these. But, more
recent example have exluded them, so I am not sure about their status is
Peter's plans.
----------------------------------------------------------------
Philip Warner | __---_____
Albatross Consulting Pty. Ltd. |----/ - \
(A.B.N. 75 008 659 498) | /(@) ______---_
Tel: (+61) 0500 83 82 81 | _________ \
Fax: (+61) 0500 83 82 82 | ___________ |
Http://www.rhyme.com.au | / \|
| --________--
PGP key available upon request, | /
and from pgp5.ai.mit.edu:11371 |/
---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?
http://www.postgresql.org/users-lounge/docs/faq.html
From pgsql-hackers-owner+M6178@postgresql.org Mon Mar 19 18:04:16 2001
Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28])
by candle.pha.pa.us (8.9.0/8.9.0) with ESMTP id SAA09636
for <pgman@candle.pha.pa.us>; Mon, 19 Mar 2001 18:04:15 -0500 (EST)
Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28])
by mail.postgresql.org (8.11.3/8.11.1) with SMTP id f2JN3VN17922;
Mon, 19 Mar 2001 18:03:31 -0500 (EST)
(envelope-from pgsql-hackers-owner+M6178@postgresql.org)
Received: from mailout02.sul.t-online.com (mailout02.sul.t-online.com [194.25.134.17])
by mail.postgresql.org (8.11.3/8.11.1) with ESMTP id f2JN0nN17660
for <pgsql-hackers@postgresql.org>; Mon, 19 Mar 2001 18:00:49 -0500 (EST)
(envelope-from peter_e@gmx.net)
Received: from fwd03.sul.t-online.com
by mailout02.sul.t-online.com with smtp
id 14f8dr-0005W0-04; Tue, 20 Mar 2001 00:00:47 +0100
Received: from peter.localdomain (520083510237-0001@[217.80.146.106]) by fmrl03.sul.t-online.com
with esmtp id 14f8dg-26MpaCC; Tue, 20 Mar 2001 00:00:36 +0100
Date: Tue, 20 Mar 2001 00:10:43 +0100 (CET)
From: Peter Eisentraut <peter_e@gmx.net>
To: PostgreSQL Development <pgsql-hackers@postgresql.org>
Subject: [HACKERS] elog with automatic file, line, and function
Message-ID: <Pine.LNX.4.30.0103192356450.5764-100000@peter.localdomain>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
X-Sender: 520083510237-0001@t-dialin.net
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR
It has been brought up that elog should be able to automatically fill in
the file, line, and perhaps the function name where it's called, to avoid
having to prefix each message with the function name by hand, which is
quite ugly.
This is doable, but it requires a C preprocessor that can handle varargs
macros. Since this is required by C99 and has been available in GCC for a
while, it *might* be okay to rely on this.
Additionally, C99 (and GCC for a while) would allow filling in the
function name automatically.
Since these would be mostly developer features, how do people feel about
relying on modern tools for implementing these? The bottom line seems to
be that without these tools it would simply not be possible.
--
Peter Eisentraut peter_e@gmx.net http://yi.org/peter-e/
---------------------------(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+M6181@postgresql.org Mon Mar 19 18:26:30 2001
Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28])
by candle.pha.pa.us (8.9.0/8.9.0) with ESMTP id SAA10579
for <pgman@candle.pha.pa.us>; Mon, 19 Mar 2001 18:26:29 -0500 (EST)
Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28])
by mail.postgresql.org (8.11.3/8.11.1) with SMTP id f2JNQ1N53252;
Mon, 19 Mar 2001 18:26:01 -0500 (EST)
(envelope-from pgsql-hackers-owner+M6181@postgresql.org)
Received: from sss.pgh.pa.us (sss.pgh.pa.us [209.114.132.154])
by mail.postgresql.org (8.11.3/8.11.1) with ESMTP id f2JNNXN45362
for <pgsql-hackers@postgresql.org>; Mon, 19 Mar 2001 18:23: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.1/8.11.1) with ESMTP id f2JNNUt07935;
Mon, 19 Mar 2001 18:23:30 -0500 (EST)
To: Peter Eisentraut <peter_e@gmx.net>
cc: PostgreSQL Development <pgsql-hackers@postgresql.org>
Subject: Re: [HACKERS] elog with automatic file, line, and function
In-reply-to: <Pine.LNX.4.30.0103192356450.5764-100000@peter.localdomain>
References: <Pine.LNX.4.30.0103192356450.5764-100000@peter.localdomain>
Comments: In-reply-to Peter Eisentraut <peter_e@gmx.net>
message dated "Tue, 20 Mar 2001 00:10:43 +0100"
Date: Mon, 19 Mar 2001 18:23:30 -0500
Message-ID: <7932.985044210@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:
> It has been brought up that elog should be able to automatically fill in
> the file, line, and perhaps the function name where it's called, to avoid
> having to prefix each message with the function name by hand, which is
> quite ugly.
> Since these would be mostly developer features, how do people feel about
> relying on modern tools for implementing these?
Not happy. A primary reason for wanting the exact location is to make
bug reports more specific. If Joe User's copy of Postgres doesn't
report error location then it doesn't help me much that my copy does
(if I could reproduce the reported failure, then gdb will tell me where
the elog call is...). In particular, we *cannot* remove the habit of
mentioning the reporting routine name in the message text unless there
is an adequate substitute in all builds.
> The bottom line seems to be that without these tools it would simply
> not be possible.
Sure it is, it just requires a marginal increase in ugliness, namely
double parentheses:
ELOG((level, format, arg1, arg2, ...))
which might work like
#define ELOG(ARGS) (elog_setloc(__FILE__, __LINE__), elog ARGS)
> Additionally, C99 (and GCC for a while) would allow filling in the
> function name automatically.
We could probably treat the function name as something that's optionally
added to the file/line error report info if the compiler supports it.
BTW, how does that work exactly? I assume it can't be a macro ...
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+M6183@postgresql.org Mon Mar 19 19:34:34 2001
Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28])
by candle.pha.pa.us (8.9.0/8.9.0) with ESMTP id TAA15096
for <pgman@candle.pha.pa.us>; Mon, 19 Mar 2001 19:34:33 -0500 (EST)
Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28])
by mail.postgresql.org (8.11.3/8.11.1) with SMTP id f2K0Y3N60007;
Mon, 19 Mar 2001 19:34:03 -0500 (EST)
(envelope-from pgsql-hackers-owner+M6183@postgresql.org)
Received: from foghorn.airs.com (foghorn.airs.com [63.201.54.26])
by mail.postgresql.org (8.11.3/8.11.1) with SMTP id f2K0XZN59897
for <pgsql-hackers@postgresql.org>; Mon, 19 Mar 2001 19:33:35 -0500 (EST)
(envelope-from ian@airs.com)
Received: (qmail 8819 invoked by uid 10); 20 Mar 2001 00:33:32 -0000
Received: (qmail 1971 invoked by uid 269); 20 Mar 2001 00:33:28 -0000
Mail-Followup-To: peter_e@gmx.net,
pgsql-hackers@postgresql.org,
tgl@sss.pgh.pa.us
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Peter Eisentraut <peter_e@gmx.net>,
PostgreSQL Development <pgsql-hackers@postgresql.org>
Subject: Re: [HACKERS] elog with automatic file, line, and function
References: <Pine.LNX.4.30.0103192356450.5764-100000@peter.localdomain>
<7932.985044210@sss.pgh.pa.us>
From: Ian Lance Taylor <ian@airs.com>
Date: 19 Mar 2001 16:33:28 -0800
In-Reply-To: Tom Lane's message of "Mon, 19 Mar 2001 18:23:30 -0500"
Message-ID: <siy9u11dpj.fsf@daffy.airs.com>
Lines: 17
User-Agent: Gnus/5.0807 (Gnus v5.8.7) Emacs/20.7
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR
Tom Lane <tgl@sss.pgh.pa.us> writes:
> > Additionally, C99 (and GCC for a while) would allow filling in the
> > function name automatically.
>
> We could probably treat the function name as something that's optionally
> added to the file/line error report info if the compiler supports it.
>
> BTW, how does that work exactly? I assume it can't be a macro ...
It's a macro just like __FILE__ and __LINE__ are macros.
gcc has supported __FUNCTION__ and __PRETTY_FUNCTION__ for a long time
(the latter is the demangled version of the function name when using
C++).
Ian
---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster
From pgsql-hackers-owner+M6185@postgresql.org Mon Mar 19 20:00:25 2001
Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28])
by candle.pha.pa.us (8.9.0/8.9.0) with ESMTP id UAA15947
for <pgman@candle.pha.pa.us>; Mon, 19 Mar 2001 20:00:24 -0500 (EST)
Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28])
by mail.postgresql.org (8.11.3/8.11.1) with SMTP id f2K0xjN63216;
Mon, 19 Mar 2001 19:59:45 -0500 (EST)
(envelope-from pgsql-hackers-owner+M6185@postgresql.org)
Received: from sss.pgh.pa.us (sss.pgh.pa.us [209.114.132.154])
by mail.postgresql.org (8.11.3/8.11.1) with ESMTP id f2K0ciN60815
for <pgsql-hackers@postgresql.org>; Mon, 19 Mar 2001 19:38:44 -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.1/8.11.1) with ESMTP id f2K0cbt08356;
Mon, 19 Mar 2001 19:38:37 -0500 (EST)
To: Ian Lance Taylor <ian@airs.com>
cc: Peter Eisentraut <peter_e@gmx.net>,
PostgreSQL Development <pgsql-hackers@postgresql.org>
Subject: Re: [HACKERS] elog with automatic file, line, and function
In-reply-to: <siy9u11dpj.fsf@daffy.airs.com>
References: <Pine.LNX.4.30.0103192356450.5764-100000@peter.localdomain> <7932.985044210@sss.pgh.pa.us> <siy9u11dpj.fsf@daffy.airs.com>
Comments: In-reply-to Ian Lance Taylor <ian@airs.com>
message dated "19 Mar 2001 16:33:28 -0800"
Date: Mon, 19 Mar 2001 19:38:36 -0500
Message-ID: <8353.985048716@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR
Ian Lance Taylor <ian@airs.com> writes:
> Tom Lane <tgl@sss.pgh.pa.us> writes:
>> BTW, how does that work exactly? I assume it can't be a macro ...
> It's a macro just like __FILE__ and __LINE__ are macros.
> gcc has supported __FUNCTION__ and __PRETTY_FUNCTION__ for a long time
> (the latter is the demangled version of the function name when using
> C++).
Now that I know the name, I can find it in the gcc docs, which clearly
explain that these names are not macros ;-). The preprocessor would
have a tough time making such a substitution.
However, if the C99 spec has such a concept, they didn't use that name
for it ...
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+M6188@postgresql.org Mon Mar 19 20:29:45 2001
Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28])
by candle.pha.pa.us (8.9.0/8.9.0) with ESMTP id UAA16850
for <pgman@candle.pha.pa.us>; Mon, 19 Mar 2001 20:29:45 -0500 (EST)
Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28])
by mail.postgresql.org (8.11.3/8.11.1) with SMTP id f2K1T5N83769;
Mon, 19 Mar 2001 20:29:05 -0500 (EST)
(envelope-from pgsql-hackers-owner+M6188@postgresql.org)
Received: from lerami.lerctr.org (lerami.lerctr.org [207.158.72.11])
by mail.postgresql.org (8.11.3/8.11.1) with ESMTP id f2K1PrN75990
for <pgsql-hackers@postgresql.org>; Mon, 19 Mar 2001 20:25:53 -0500 (EST)
(envelope-from ler@lerctr.org)
Received: (from ler@localhost)
by lerami.lerctr.org (8.12.0.Beta5/8.12.0.Beta5/20010318/$Revision: 1.1 $) id f2K1Pm1K029350;
Mon, 19 Mar 2001 19:25:48 -0600 (CST)
(envelope-from ler)
Date: Mon, 19 Mar 2001 19:25:48 -0600
From: Larry Rosenman <ler@lerctr.org>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Ian Lance Taylor <ian@airs.com>, Peter Eisentraut <peter_e@gmx.net>,
PostgreSQL Development <pgsql-hackers@postgresql.org>
Subject: Re: [HACKERS] elog with automatic file, line, and function
Message-ID: <20010319192547.A29294@lerami.lerctr.org>
References: <Pine.LNX.4.30.0103192356450.5764-100000@peter.localdomain> <7932.985044210@sss.pgh.pa.us> <siy9u11dpj.fsf@daffy.airs.com> <8353.985048716@sss.pgh.pa.us>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
User-Agent: Mutt/1.3.16i
In-Reply-To: <8353.985048716@sss.pgh.pa.us>; from tgl@sss.pgh.pa.us on Mon, Mar 19, 2001 at 07:38:36PM -0500
X-Mailer: Mutt http://www.mutt.org/
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR
* Tom Lane <tgl@sss.pgh.pa.us> [010319 18:58]:
> Ian Lance Taylor <ian@airs.com> writes:
> > Tom Lane <tgl@sss.pgh.pa.us> writes:
> >> BTW, how does that work exactly? I assume it can't be a macro ...
>
> > It's a macro just like __FILE__ and __LINE__ are macros.
>
> > gcc has supported __FUNCTION__ and __PRETTY_FUNCTION__ for a long time
> > (the latter is the demangled version of the function name when using
> > C++).
>
> Now that I know the name, I can find it in the gcc docs, which clearly
> explain that these names are not macros ;-). The preprocessor would
> have a tough time making such a substitution.
>
> However, if the C99 spec has such a concept, they didn't use that name
> for it ...
My C99 compiler (SCO, UDK FS 7.1.1b), defines the following:
Predefined names
The following identifiers are predefined as object-like macros:
__LINE__
The current line number as a decimal constant.
__FILE__
A string literal representing the name of the file being compiled.
__DATE__
The date of compilation as a string literal in the form ``Mmm dd
yyyy.''
__TIME__
The time of compilation, as a string literal in the form
``hh:mm:ss.''
__STDC__
The constant 1 under compilation mode -Xc, otherwise 0.
__USLC__
A positive integer constant; its definition signifies a USL C
compilation system.
Nothing for function that I can find.
LER
>
> 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
--
Larry Rosenman http://www.lerctr.org/~ler
Phone: +1 972-414-9812 E-Mail: ler@lerctr.org
US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749
---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?
http://www.postgresql.org/search.mpl
From pgsql-hackers-owner+M6189@postgresql.org Mon Mar 19 20:49:49 2001
Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28])
by candle.pha.pa.us (8.9.0/8.9.0) with ESMTP id UAA17752
for <pgman@candle.pha.pa.us>; Mon, 19 Mar 2001 20:49:48 -0500 (EST)
Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28])
by mail.postgresql.org (8.11.3/8.11.1) with SMTP id f2K1n8N87285;
Mon, 19 Mar 2001 20:49:08 -0500 (EST)
(envelope-from pgsql-hackers-owner+M6189@postgresql.org)
Received: from smtp014.mail.yahoo.com (smtp014.mail.yahoo.com [216.136.173.58])
by mail.postgresql.org (8.11.3/8.11.1) with SMTP id f2K1iFN86846
for <pgsql-hackers@postgresql.org>; Mon, 19 Mar 2001 20:44:15 -0500 (EST)
(envelope-from nnorwitz@yahoo.com)
Received: from 207-172-137-172.s45.as3.dam.md.dialup.rcn.com (HELO yahoo.com) (207.172.137.172)
by smtp.mail.vip.sc5.yahoo.com with SMTP; 20 Mar 2001 01:44:11 -0000
X-Apparently-From: <nnorwitz@yahoo.com>
Message-ID: <3AB6B5EB.21F2D551@yahoo.com>
Date: Mon, 19 Mar 2001 20:44:11 -0500
From: Neal Norwitz <nnorwitz@yahoo.com>
Organization: MetaSlash, Inc.
X-Mailer: Mozilla 4.75 [en] (X11; U; Linux 2.2.16-22 i686)
X-Accept-Language: en
MIME-Version: 1.0
To: peter_e@gmx.net, pgsql-hackers@postgresql.org
Subject: Re: [HACKERS] elog with automatic file, line, and function
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR
Peter Eisentraut wrote:
>
> It has been brought up that elog should be able to automatically fill in
> the file, line, and perhaps the function name where it's called, to avoid
> having to prefix each message with the function name by hand, which is
> quite ugly.
>
> This is doable, but it requires a C preprocessor that can handle varargs
> macros. Since this is required by C99 and has been available in GCC for a
> while, it *might* be okay to rely on this.
>
> Additionally, C99 (and GCC for a while) would allow filling in the
> function name automatically.
>
> Since these would be mostly developer features, how do people feel about
> relying on modern tools for implementing these? The bottom line seems to
> be that without these tools it would simply not be possible.
It is possible, however, the macros require an extra set of parentheses:
void elog_internal(const char* file, unsigned long line, ... );
#define ELOG(args) elog_internal(__FILE__, __LINE__, args)
ELOG(("%s error", string))
For portability to older compilers, you should probably not require C99.
Also, I'm not positive, but I think that varargs are not part of C++
yet.
However, they will likely be added (if not already in draft form).
Neal
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com
---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?
http://www.postgresql.org/users-lounge/docs/faq.html
From pgsql-hackers-owner+M6355@postgresql.org Wed Mar 21 15:48:41 2001
Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28])
by candle.pha.pa.us (8.9.0/8.9.0) with ESMTP id PAA12714
for <pgman@candle.pha.pa.us>; Wed, 21 Mar 2001 15:48:40 -0500 (EST)
Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28])
by mail.postgresql.org (8.11.3/8.11.1) with SMTP id f2LKltt44369;
Wed, 21 Mar 2001 15:47:55 -0500 (EST)
(envelope-from pgsql-hackers-owner+M6355@postgresql.org)
Received: from mailout02.sul.t-online.com (mailout02.sul.t-online.com [194.25.134.17])
by mail.postgresql.org (8.11.3/8.11.1) with ESMTP id f2LKlCt44260
for <pgsql-hackers@postgresql.org>; Wed, 21 Mar 2001 15:47:13 -0500 (EST)
(envelope-from peter_e@gmx.net)
Received: from fwd01.sul.t-online.com
by mailout02.sul.t-online.com with smtp
id 14fpVX-00064K-01; Wed, 21 Mar 2001 21:47:03 +0100
Received: from peter.localdomain (520083510237-0001@[212.185.245.125]) by fmrl01.sul.t-online.com
with esmtp id 14fpVN-1fGPi4C; Wed, 21 Mar 2001 21:46:53 +0100
Date: Wed, 21 Mar 2001 21:57:04 +0100 (CET)
From: Peter Eisentraut <peter_e@gmx.net>
To: Tom Lane <tgl@sss.pgh.pa.us>
cc: PostgreSQL Development <pgsql-hackers@postgresql.org>
Subject: Re: [HACKERS] elog with automatic file, line, and function
In-Reply-To: <7932.985044210@sss.pgh.pa.us>
Message-ID: <Pine.LNX.4.30.0103212156130.1694-100000@peter.localdomain>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
X-Sender: 520083510237-0001@t-dialin.net
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR
Tom Lane writes:
> Sure it is, it just requires a marginal increase in ugliness, namely
> double parentheses:
>
> ELOG((level, format, arg1, arg2, ...))
>
> which might work like
>
> #define ELOG(ARGS) (elog_setloc(__FILE__, __LINE__), elog ARGS)
Would the first function save the data in global variables?
--
Peter Eisentraut peter_e@gmx.net http://yi.org/peter-e/
---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?
http://www.postgresql.org/search.mpl
From pgsql-hackers-owner+M6376@postgresql.org Wed Mar 21 21:55:11 2001
Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28])
by candle.pha.pa.us (8.9.0/8.9.0) with ESMTP id VAA28552
for <pgman@candle.pha.pa.us>; Wed, 21 Mar 2001 21:55:11 -0500 (EST)
Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28])
by mail.postgresql.org (8.11.3/8.11.1) with SMTP id f2M2slt64569;
Wed, 21 Mar 2001 21:54:47 -0500 (EST)
(envelope-from pgsql-hackers-owner+M6376@postgresql.org)
Received: from sss.pgh.pa.us (sss.pgh.pa.us [209.114.132.154])
by mail.postgresql.org (8.11.3/8.11.1) with ESMTP id f2M2sSt64463
for <pgsql-hackers@postgresql.org>; Wed, 21 Mar 2001 21:54:28 -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.1/8.11.1) with ESMTP id f2M2sN602818;
Wed, 21 Mar 2001 21:54:23 -0500 (EST)
To: Peter Eisentraut <peter_e@gmx.net>
cc: PostgreSQL Development <pgsql-hackers@postgresql.org>
Subject: Re: [HACKERS] elog with automatic file, line, and function
In-reply-to: <Pine.LNX.4.30.0103212156130.1694-100000@peter.localdomain>
References: <Pine.LNX.4.30.0103212156130.1694-100000@peter.localdomain>
Comments: In-reply-to Peter Eisentraut <peter_e@gmx.net>
message dated "Wed, 21 Mar 2001 21:57:04 +0100"
Date: Wed, 21 Mar 2001 21:54:23 -0500
Message-ID: <2815.985229663@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:
>> #define ELOG(ARGS) (elog_setloc(__FILE__, __LINE__), elog ARGS)
> Would the first function save the data in global variables?
Yes, that's what I was envisioning. Not a super clean solution,
but workable, and better than requiring varargs macros.
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+M6210@postgresql.org Tue Mar 20 11:55:39 2001
Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28])
by candle.pha.pa.us (8.9.0/8.9.0) with ESMTP id LAA01567
for <pgman@candle.pha.pa.us>; Tue, 20 Mar 2001 11:55:39 -0500 (EST)
Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28])
by mail.postgresql.org (8.11.3/8.11.1) with SMTP id f2KGseN34601;
Tue, 20 Mar 2001 11:54:40 -0500 (EST)
(envelope-from pgsql-hackers-owner+M6210@postgresql.org)
Received: from reorxrsm.server.lan.at (zep3.it-austria.net [213.150.1.73])
by mail.postgresql.org (8.11.3/8.11.1) with ESMTP id f2KGsFN34478
for <pgsql-hackers@postgresql.org>; Tue, 20 Mar 2001 11:54:16 -0500 (EST)
(envelope-from ZeugswetterA@wien.spardat.at)
Received: from gz0153.gc.spardat.at (gz0153.gc.spardat.at [172.20.10.149])
by reorxrsm.server.lan.at (8.11.2/8.11.2) with ESMTP id f2KGs5T20888
for <pgsql-hackers@postgresql.org>; Tue, 20 Mar 2001 17:54:05 +0100
Received: by sdexcgtw01.f000.d0188.sd.spardat.at with Internet Mail Service (5.5.2650.21)
id <G8TZMX0Z>; Tue, 20 Mar 2001 17:53:58 +0100
Message-ID: <11C1E6749A55D411A9670001FA687963368256@sdexcsrv1.f000.d0188.sd.spardat.at>
From: Zeugswetter Andreas SB <ZeugswetterA@wien.spardat.at>
To: "'Peter Eisentraut'" <peter_e@gmx.net>, Philip Warner <pjw@rhyme.com.au>
Cc: PostgreSQL Development <pgsql-hackers@postgresql.org>
Subject: AW: [HACKERS] More on elog and error codes
Date: Tue, 20 Mar 2001 17:53:47 +0100
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
> #define PGERR_TYPE 1854
#define PGSQLSTATE_TYPE "S0021" // char(5) SQLSTATE
The standard calls this error variable SQLSTATE
(look up in ESQL standard)
first 2 chars are class next 3 are subclass
"00000" is e.g. Success
"02000" is Data not found
"U0xxx" user defined routine error xxx is user defined
> /* somewhere... */
>
> elogc(ERROR, PGERR_TYPE, "type %s cannot be created because it already exists", ...)
PGELOG(ERROR, PGSQLSTATE_TYPE, ("type %s cannot be created because it already exists", ...))
put varargs into parentheses to avoid need for ... macros see Tom's proposal
I also agree, that we can group different text messages into the same SQLSTATE,
if it seems appropriate for the client to handle them alike.
Andreas
---------------------------(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+M6212@postgresql.org Tue Mar 20 12:35:33 2001
Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28])
by candle.pha.pa.us (8.9.0/8.9.0) with ESMTP id MAA03977
for <pgman@candle.pha.pa.us>; Tue, 20 Mar 2001 12:35:32 -0500 (EST)
Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28])
by mail.postgresql.org (8.11.3/8.11.1) with SMTP id f2KHXTN82858;
Tue, 20 Mar 2001 12:33:29 -0500 (EST)
(envelope-from pgsql-hackers-owner+M6212@postgresql.org)
Received: from sss.pgh.pa.us (sss.pgh.pa.us [209.114.132.154])
by mail.postgresql.org (8.11.3/8.11.1) with ESMTP id f2KHTsN75514
for <pgsql-hackers@postgresql.org>; Tue, 20 Mar 2001 12:29:54 -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.1/8.11.1) with ESMTP id f2KHTdt11501;
Tue, 20 Mar 2001 12:29:39 -0500 (EST)
To: Zeugswetter Andreas SB <ZeugswetterA@wien.spardat.at>
cc: "'Peter Eisentraut'" <peter_e@gmx.net>, Philip Warner <pjw@rhyme.com.au>,
PostgreSQL Development <pgsql-hackers@postgresql.org>
Subject: Re: AW: [HACKERS] More on elog and error codes
In-reply-to: <11C1E6749A55D411A9670001FA687963368256@sdexcsrv1.f000.d0188.sd.spardat.at>
References: <11C1E6749A55D411A9670001FA687963368256@sdexcsrv1.f000.d0188.sd.spardat.at>
Comments: In-reply-to Zeugswetter Andreas SB <ZeugswetterA@wien.spardat.at>
message dated "Tue, 20 Mar 2001 17:53:47 +0100"
Date: Tue, 20 Mar 2001 12:29:38 -0500
Message-ID: <11498.985109378@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR
Zeugswetter Andreas SB <ZeugswetterA@wien.spardat.at> writes:
> PGELOG(ERROR, PGSQLSTATE_TYPE, ("type %s cannot be created because it already exists", ...))
> put varargs into parentheses to avoid need for ... macros see Tom's proposal
I'd be inclined to make it
PGELOG((ERROR, PGSQLSTATE_TYPE, "type %s cannot be created because it already exists", ...))
The extra parens are ugly and annoying in any case, but they seem
slightly less so if you just double the parens associated with the
PGELOG call. Takes less thought than adding a paren somewhere in the
middle of the call. IMHO anyway...
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+M6211@postgresql.org Tue Mar 20 11:59:14 2001
Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28])
by candle.pha.pa.us (8.9.0/8.9.0) with ESMTP id LAA01976
for <pgman@candle.pha.pa.us>; Tue, 20 Mar 2001 11:59:14 -0500 (EST)
Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28])
by mail.postgresql.org (8.11.3/8.11.1) with SMTP id f2KGwMN35326;
Tue, 20 Mar 2001 11:58:22 -0500 (EST)
(envelope-from pgsql-hackers-owner+M6211@postgresql.org)
Received: from lerami.lerctr.org (lerami.lerctr.org [207.158.72.11])
by mail.postgresql.org (8.11.3/8.11.1) with ESMTP id f2KGvjN35102
for <pgsql-hackers@postgresql.org>; Tue, 20 Mar 2001 11:57:45 -0500 (EST)
(envelope-from ler@lerctr.org)
Received: from ler-freebie.iadfw.net (ler-freebie.iadfw.net [206.66.13.221])
by lerami.lerctr.org (8.12.0.Beta5/8.12.0.Beta5/20010318/$Revision: 1.1 $) with SMTP id f2KGvcOh016935;
Tue, 20 Mar 2001 10:57:38 -0600 (CST)
(envelope-from ler@lerctr.org)
From: Larry Rosenman <ler@lerctr.org>
Date: Tue, 20 Mar 2001 16:57:38 GMT
Message-ID: <20010320.16573800@ler-freebie.iadfw.net>
Subject: Re: AW: [HACKERS] Re: More on elog and error codes
To: Peter Eisentraut <peter_e@gmx.net>
CC: Zeugswetter Andreas SB <ZeugswetterA@wien.spardat.at>,
=?US-ASCII?Q?=27lockhart=40fourpalms=2Eorg=27?= <lockhart@fourpalms.org>,
=?US-ASCII?Q?PostgreSQL?= Development <pgsql-hackers@postgresql.org>
In-Reply-To: <Pine.LNX.4.30.0103201750450.1639-100000@peter.localdomain>
References: <Pine.LNX.4.30.0103201750450.1639-100000@peter.localdomain>
X-Mailer: Mozilla/3.0 (compatible; StarOffice/5.2; Linux)
X-Priority: 3 (Normal)
MIME-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
X-MIME-Autoconverted: from quoted-printable to 8bit by mail.postgresql.org id f2KGvkN35103
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR
Coming from an IBM Mainframe background, I'm used to ALL OS/Product
messages having a message number, and a fat messages and codes book.
I hope we can do that eventually.
(maybe a database of the error numbers and codes?)
LER
>>>>>>>>>>>>>>>>>> Original Message <<<<<<<<<<<<<<<<<<
On 3/20/01, 10:53:42 AM, Peter Eisentraut <peter_e@gmx.net> wrote regarding
Re: AW: [HACKERS] Re: More on elog and error codes:
> Zeugswetter Andreas SB writes:
> > > SQL9x specifies some error codes, with no particular numbering scheme
> > > other than negative numbers indicate a problem afaicr.
> > >
> > > Shouldn't we map to those where possible?
> >
> > Yes, it defines at least a few dozen char(5) error codes. These are
hierarchical,
> > grouped into Warnings and Errors, and have room for implementation
specific
> > message codes.
> Let's use those then to start with.
> Anyone got a good idea for a client API to this? I think we could just
> prefix the actual message with the error code, at least as a start.
> Since they're all fixed width the client could take them apart easily. I
> recall other RDBMS' (Oracle?) also having an error code before each
> message.
> --
> Peter Eisentraut peter_e@gmx.net http://yi.org/peter-e/
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
> http://www.postgresql.org/users-lounge/docs/faq.html
---------------------------(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+M6238@postgresql.org Tue Mar 20 17:10:47 2001
Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28])
by candle.pha.pa.us (8.9.0/8.9.0) with ESMTP id RAA23987
for <pgman@candle.pha.pa.us>; Tue, 20 Mar 2001 17:10:47 -0500 (EST)
Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28])
by mail.postgresql.org (8.11.3/8.11.1) with SMTP id f2KMAAH07636;
Tue, 20 Mar 2001 17:10:10 -0500 (EST)
(envelope-from pgsql-hackers-owner+M6238@postgresql.org)
Received: from mail.olabinc.com (mail.olabinc.com [63.102.247.99])
by mail.postgresql.org (8.11.3/8.11.1) with ESMTP id f2KM88H07164
for <pgsql-hackers@postgresql.org>; Tue, 20 Mar 2001 17:08:09 -0500 (EST)
(envelope-from otto.hirr@olabinc.com)
Received: (from mail@localhost)
by mail.olabinc.com (8.9.3/8.9.3) id OAA02920
for <pgsql-hackers@postgresql.org>; Tue, 20 Mar 2001 14:18:21 -0800 (PST)
(envelope-from otto.hirr@olabinc.com)
X-Authentication-Warning: mail.olabinc.com: mail set sender to <otto.hirr@olabinc.com> using -f
Received: from xcdt.olabinc.com(63.102.247.123) by mail.olabinc.com via smap (V2.0)
id xma002916; Tue, 20 Mar 01 14:18:10 -0800
Reply-To: <otto.hirr@olabinc.com>
From: "Otto A. Hirr, Jr." <otto.hirr@olabinc.com>
To: "PostgreSQL Development" <pgsql-hackers@postgresql.org>
Subject: [HACKERS] RE: Re: More on elog and error codes
Date: Tue, 20 Mar 2001 13:48:49 -0800
Message-ID: <000001c0b187$8d761000$7bf7663f@xcdt.olabinc.com>
MIME-Version: 1.0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
X-Priority: 3 (Normal)
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook 8.5, Build 4.71.2173.0
Importance: Normal
In-Reply-To: <11C1E6749A55D411A9670001FA687963368255@sdexcsrv1.f000.d0188.sd.spardat.at>
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.2106.4
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR
> So we need some good error numbering scheme. Any ideas?
I'm a newbie, but have been following dev and have a few comments
and these are thoughts not criticisms:
1) I've seen a huge mixture of "how to implement" to support some
desired feature without first knowing "all" of the features that
are desired. Examination over all of the mailings reveals some
but not all of possible features you may want to include.
2) Define what you want to have without worrying about how to do it.
3) Design something that can implement all of the features.
4) Reconsider design if there are performance issues.
e.g.
Features desired
* system
* subsystem
* function
* file, line, etc
* severity
* user-ability-to-recover
* standards conformance - e.g.. SQL std
* default msg statement
* locale msg statement lookup mech, os dep or indep (careful here)
* success/warning/failure
* semantic taxonomy
* syntactic taxonomy
* forced to user, available to api, logging or not, tracing
* concept of level
* reports filtering on some attribute
* interoperation with existing system reports e.g. syslog, event log,...
* system environment snapshot option
(e.g. resource low/empty may/should trigger a log of conn cnt,
sys resource counts, load, etc)
* non-mnemonic internal numbers (mnemonic only to obey stds and then
only as a function call, not by implementation)
* ease of use (i.e. pgsql-dev-hacker use)
* ease of use (i.e. api development use)
* ease of use (i.e. rolling into an existing system, e.g. during
transition both may need to be in use.)
* ease of use (i.e. looking through existing errors to find one
that may "correctly" fit the situation, instead of
creating yet-another-error-message.)
* ease of use (i.e. maybe having each "sub-system" having its own
"error domain" but using the same error mechanism)
* distinction btwn error report, debug report, tracing report, etc
* separate the concepts of
- report creation
- report delivery
- report reception
- report interpretation
* what do other's do, other's as in os, db, middleware, etc
along with their strong and weak points
... what else do you want... and lets flesh out the meaning of
each of these. Then we can go on to a design...
Sorry if this sounds like a lecture.
With regards to mnemonic things - ugh - this is a database.
I've worked with a LARGE electronics company that had
10 and 12 digit mnemonic part numbers. The mnemonic-ness
begins to break down. (So you have a part number of an eprom,
what is the part number when it is blown - still an eprom?
how about including the version of the sw on the eprom? is it
now an assembly? opps that tended to mean multiple parts attached
together, humm still looks like an eprom?) They have gone through
a huge transition to move away, as has the industry from mnemonic
numbers to simply an id number. You look up the id number in a
>database< :-) to find out what it is.
So why not drop the mnemonic concept and apply a function to a
blackbox dataitem to determine its attribute? But again first
determine what attributes you want, which are mandatory, optional,
system supplied (e.g. __LINE__ etc), is it for erroring, tracing,
debugging, some combo; then the appropriate dataitem can be
designed and functions defined. Functions (macros) for both the
report creation, report distribution, report reception, and
report interpretation. Some other email pointed out that
there are different people doing different things. Each of these
people-groups should identify what they need with regards to
error, debug, tracing reports. Each may have some nuances that
are not needed elsewhere, but the reporting system should be able
to support them all.
Ok, so I've got my flame suit on... but I am really trying to give
an "outsiders" birdseye view of what I've been reading, hopefully
which may be helpful.
Best regards,
.. Otto
Otto Hirr
OLAB Inc.
otto.hirr@olabinc.com
503 / 617-6595
---------------------------(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+M6294@postgresql.org Tue Mar 20 22:29:16 2001
Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28])
by candle.pha.pa.us (8.9.0/8.9.0) with ESMTP id WAA16697
for <pgman@candle.pha.pa.us>; Tue, 20 Mar 2001 22:29:16 -0500 (EST)
Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28])
by mail.postgresql.org (8.11.3/8.11.1) with SMTP id f2L3SnH40522;
Tue, 20 Mar 2001 22:28:49 -0500 (EST)
(envelope-from pgsql-hackers-owner+M6294@postgresql.org)
Received: from golem.fourpalms.org (www.fourpalms.org [64.3.68.148])
by mail.postgresql.org (8.11.3/8.11.1) with ESMTP id f2L3SRH40406
for <pgsql-hackers@postgresql.org>; Tue, 20 Mar 2001 22:28:28 -0500 (EST)
(envelope-from lockhart@alumni.caltech.edu)
Received: from alumni.caltech.edu (localhost.localdomain [127.0.0.1])
by golem.fourpalms.org (Postfix) with ESMTP
id 65C4CFEB4; Wed, 21 Mar 2001 03:28:24 +0000 (UTC)
Message-ID: <3AB81FD8.5260E97A@alumni.caltech.edu>
Date: Wed, 21 Mar 2001 03:28:24 +0000
From: Thomas Lockhart <lockhart@alumni.caltech.edu>
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: Philip Warner <pjw@rhyme.com.au>
Cc: Peter Eisentraut <peter_e@gmx.net>,
PostgreSQL Development <pgsql-hackers@postgresql.org>
Subject: [HACKERS] Re: More on elog and error codes
References: <3.0.5.32.20010320104855.0339d300@mail.rhyme.com.au> <3.0.5.32.20010321094352.0287ad00@mail.rhyme.com.au>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR
> Creating central message files/objects has the added advantage of a much
> simpler locale support - they're just resource files, and they're NOT
> embedded throughout the code.
> Finally, if you do want to have some kind of error classification beyond
> the SQL code, it could be encoded in the error message file.
We could also (automatically) build a DBMS reference table *from* this
message file (or files), which would allow lookup of messages from codes
for applications which are not "message-aware".
Not a requirement, and it does not meet all needs (e.g. you would have
to be connected to get the messages in that case) but it would be
helpful for some use cases...
- Thomas
---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
From pgsql-hackers-owner+M6295@postgresql.org Tue Mar 20 22:40:59 2001
Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28])
by candle.pha.pa.us (8.9.0/8.9.0) with ESMTP id WAA17120
for <pgman@candle.pha.pa.us>; Tue, 20 Mar 2001 22:40:58 -0500 (EST)
Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28])
by mail.postgresql.org (8.11.3/8.11.1) with SMTP id f2L3dFH41288;
Tue, 20 Mar 2001 22:39:15 -0500 (EST)
(envelope-from pgsql-hackers-owner+M6295@postgresql.org)
Received: from acheron.rime.com.au (albatr.lnk.telstra.net [139.130.54.222])
by mail.postgresql.org (8.11.3/8.11.1) with ESMTP id f2L3caH41183
for <pgsql-hackers@postgresql.org>; Tue, 20 Mar 2001 22:38:36 -0500 (EST)
(envelope-from pjw@rhyme.com.au)
Received: from oberon (Oberon.rime.com.au [203.8.195.100])
by acheron.rime.com.au (8.9.3/8.9.3) with SMTP id OAA11228;
Wed, 21 Mar 2001 14:38:20 +1100
Message-Id: <3.0.5.32.20010321143821.00af1e70@mail.rhyme.com.au>
X-Sender: pjw@mail.rhyme.com.au
X-Mailer: QUALCOMM Windows Eudora Pro Version 3.0.5 (32)
Date: Wed, 21 Mar 2001 14:38:21 +1100
To: lockhart@fourpalms.org
From: Philip Warner <pjw@rhyme.com.au>
Subject: [HACKERS] Re: More on elog and error codes
Cc: Peter Eisentraut <peter_e@gmx.net>,
PostgreSQL Development <pgsql-hackers@postgresql.org>
In-Reply-To: <3AB81FD8.5260E97A@alumni.caltech.edu>
References: <3.0.5.32.20010320104855.0339d300@mail.rhyme.com.au>
<3.0.5.32.20010321094352.0287ad00@mail.rhyme.com.au>
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Precedence: bulk
Sender: pgsql-hackers-owner@postgresql.org
Status: OR
At 03:28 21/03/01 +0000, Thomas Lockhart wrote:
>> Creating central message files/objects has the added advantage of a much
>> simpler locale support - they're just resource files, and they're NOT
>> embedded throughout the code.
>> Finally, if you do want to have some kind of error classification beyond
>> the SQL code, it could be encoded in the error message file.
>
>We could also (automatically) build a DBMS reference table *from* this
>message file (or files), which would allow lookup of messages from codes
>for applications which are not "message-aware".
>
>Not a requirement, and it does not meet all needs (e.g. you would have
>to be connected to get the messages in that case) but it would be
>helpful for some use cases...
If we extended the message definitions to have (optional) description &
user-resolution sections, then we have the possibilty of asking psql to
explain the last error, and (broadly) how to fix it. Of course, in the
first pass, these would all be empty.
----------------------------------------------------------------
Philip Warner | __---_____
Albatross Consulting Pty. Ltd. |----/ - \
(A.B.N. 75 008 659 498) | /(@) ______---_
Tel: (+61) 0500 83 82 81 | _________ \
Fax: (+61) 0500 83 82 82 | ___________ |
Http://www.rhyme.com.au | / \|
| --________--
PGP key available upon request, | /
and from pgp5.ai.mit.edu:11371 |/
---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
|