Re: [BUGS] BUG #4070: Join more then ~15 tables let postgreSQL produces wrong data - Mailing list pgsql-patches

From Heikki Linnakangas
Subject Re: [BUGS] BUG #4070: Join more then ~15 tables let postgreSQL produces wrong data
Date
Msg-id 47F4DA1A.3000508@enterprisedb.com
Whole thread Raw
Responses Re: Re: [BUGS] BUG #4070: Join more then ~15 tables let postgreSQL produces wrong data
List pgsql-patches
Heikki Linnakangas wrote:
> Ceschia, Marcello wrote:
>> In query "query_not_working" all values from column "136_119" has the
>> value of the first column.
>>
>> Using the splitted query ("working_version") it works.
>>
>> I hope this data will help to find the bug.
>
> Thanks.
>
> Oh, the query actually gives an assertion failure on an
> assertion-enabled build, so this is clearly a bug:
>
> TRAP: FailedAssertion("!(attnum > 0 && attnum <=
> list_length(rte->joinaliasvars))", File: "parse_relation.c", Line: 1697)
>
> gdb tells that attnum is -31393 at that point. That's because
> get_rte_attribute_type() takes an AttrNumber, which is int16, and
> make_var() is trying to pass 34143, so it overflows.
>
> It seems we should extend AttrNumber to int32; we don't use AttrNumber
> in any of the on-disk structs. Though you still couldn't have more than
> MaxHeapAttributeNumber (1600) attributes in a table or
> MaxTupleAttributeNumber (1664) in a result set or intermediate tuples,
> like the output of a sort node, at least you could join ridiculously
> wide tables like that as long as you project out enough columns.

Attached is a self-contained test script to reproduce this. It produces
an assertion failure in 8.1 - CVS HEAD. On 8.0, it runs for ~5 minutes,
and finally produces an "ERROR:  invalid varattno -32768" elog. On 7.4,
it runs for even longer, but returns the correct result in the end.
Looking at the code, I believe the same bug is present in 8.0 and 7.4 as
well, but is masked by something else in those releases.

On second thought, expanding AttrNumber to int32, wholesale, might not
be a good idea, because AttrNumber is used in the function signature of
TupleDescInitEntry and some other functions that might be used in
C-language user-defined functions. They would need to be recompiled. Is
this something to worry about?

Another approach is to track down all uses of AttrNumber where it's used
to refer to an entry in a target list (varattno), and change those to
plain ints. Attached is a patch to do that. This seems like a safer
approach, but I'm slightly worried that I might've missed some variables
that need to be changed.

Thoughts?

--
   Heikki Linnakangas
   EnterpriseDB   http://www.enterprisedb.com
DROP TABLE IF EXISTS widetable;

CREATE TABLE widetable (
col0000 int4,
col0001 int4,
col0002 int4,
col0003 int4,
col0004 int4,
col0005 int4,
col0006 int4,
col0007 int4,
col0008 int4,
col0009 int4,
col0010 int4,
col0011 int4,
col0012 int4,
col0013 int4,
col0014 int4,
col0015 int4,
col0016 int4,
col0017 int4,
col0018 int4,
col0019 int4,
col0020 int4,
col0021 int4,
col0022 int4,
col0023 int4,
col0024 int4,
col0025 int4,
col0026 int4,
col0027 int4,
col0028 int4,
col0029 int4,
col0030 int4,
col0031 int4,
col0032 int4,
col0033 int4,
col0034 int4,
col0035 int4,
col0036 int4,
col0037 int4,
col0038 int4,
col0039 int4,
col0040 int4,
col0041 int4,
col0042 int4,
col0043 int4,
col0044 int4,
col0045 int4,
col0046 int4,
col0047 int4,
col0048 int4,
col0049 int4,
col0050 int4,
col0051 int4,
col0052 int4,
col0053 int4,
col0054 int4,
col0055 int4,
col0056 int4,
col0057 int4,
col0058 int4,
col0059 int4,
col0060 int4,
col0061 int4,
col0062 int4,
col0063 int4,
col0064 int4,
col0065 int4,
col0066 int4,
col0067 int4,
col0068 int4,
col0069 int4,
col0070 int4,
col0071 int4,
col0072 int4,
col0073 int4,
col0074 int4,
col0075 int4,
col0076 int4,
col0077 int4,
col0078 int4,
col0079 int4,
col0080 int4,
col0081 int4,
col0082 int4,
col0083 int4,
col0084 int4,
col0085 int4,
col0086 int4,
col0087 int4,
col0088 int4,
col0089 int4,
col0090 int4,
col0091 int4,
col0092 int4,
col0093 int4,
col0094 int4,
col0095 int4,
col0096 int4,
col0097 int4,
col0098 int4,
col0099 int4,
col0100 int4,
col0101 int4,
col0102 int4,
col0103 int4,
col0104 int4,
col0105 int4,
col0106 int4,
col0107 int4,
col0108 int4,
col0109 int4,
col0110 int4,
col0111 int4,
col0112 int4,
col0113 int4,
col0114 int4,
col0115 int4,
col0116 int4,
col0117 int4,
col0118 int4,
col0119 int4,
col0120 int4,
col0121 int4,
col0122 int4,
col0123 int4,
col0124 int4,
col0125 int4,
col0126 int4,
col0127 int4,
col0128 int4,
col0129 int4,
col0130 int4,
col0131 int4,
col0132 int4,
col0133 int4,
col0134 int4,
col0135 int4,
col0136 int4,
col0137 int4,
col0138 int4,
col0139 int4,
col0140 int4,
col0141 int4,
col0142 int4,
col0143 int4,
col0144 int4,
col0145 int4,
col0146 int4,
col0147 int4,
col0148 int4,
col0149 int4,
col0150 int4,
col0151 int4,
col0152 int4,
col0153 int4,
col0154 int4,
col0155 int4,
col0156 int4,
col0157 int4,
col0158 int4,
col0159 int4,
col0160 int4,
col0161 int4,
col0162 int4,
col0163 int4,
col0164 int4,
col0165 int4,
col0166 int4,
col0167 int4,
col0168 int4,
col0169 int4,
col0170 int4,
col0171 int4,
col0172 int4,
col0173 int4,
col0174 int4,
col0175 int4,
col0176 int4,
col0177 int4,
col0178 int4,
col0179 int4,
col0180 int4,
col0181 int4,
col0182 int4,
col0183 int4,
col0184 int4,
col0185 int4,
col0186 int4,
col0187 int4,
col0188 int4,
col0189 int4,
col0190 int4,
col0191 int4,
col0192 int4,
col0193 int4,
col0194 int4,
col0195 int4,
col0196 int4,
col0197 int4,
col0198 int4,
col0199 int4,
col0200 int4,
col0201 int4,
col0202 int4,
col0203 int4,
col0204 int4,
col0205 int4,
col0206 int4,
col0207 int4,
col0208 int4,
col0209 int4,
col0210 int4,
col0211 int4,
col0212 int4,
col0213 int4,
col0214 int4,
col0215 int4,
col0216 int4,
col0217 int4,
col0218 int4,
col0219 int4,
col0220 int4,
col0221 int4,
col0222 int4,
col0223 int4,
col0224 int4,
col0225 int4,
col0226 int4,
col0227 int4,
col0228 int4,
col0229 int4,
col0230 int4,
col0231 int4,
col0232 int4,
col0233 int4,
col0234 int4,
col0235 int4,
col0236 int4,
col0237 int4,
col0238 int4,
col0239 int4,
col0240 int4,
col0241 int4,
col0242 int4,
col0243 int4,
col0244 int4,
col0245 int4,
col0246 int4,
col0247 int4,
col0248 int4,
col0249 int4,
col0250 int4,
col0251 int4,
col0252 int4,
col0253 int4,
col0254 int4,
col0255 int4,
col0256 int4,
col0257 int4,
col0258 int4,
col0259 int4,
col0260 int4,
col0261 int4,
col0262 int4,
col0263 int4,
col0264 int4,
col0265 int4,
col0266 int4,
col0267 int4,
col0268 int4,
col0269 int4,
col0270 int4,
col0271 int4,
col0272 int4,
col0273 int4,
col0274 int4,
col0275 int4,
col0276 int4,
col0277 int4,
col0278 int4,
col0279 int4,
col0280 int4,
col0281 int4,
col0282 int4,
col0283 int4,
col0284 int4,
col0285 int4,
col0286 int4,
col0287 int4,
col0288 int4,
col0289 int4,
col0290 int4,
col0291 int4,
col0292 int4,
col0293 int4,
col0294 int4,
col0295 int4,
col0296 int4,
col0297 int4,
col0298 int4,
col0299 int4,
col0300 int4,
col0301 int4,
col0302 int4,
col0303 int4,
col0304 int4,
col0305 int4,
col0306 int4,
col0307 int4,
col0308 int4,
col0309 int4,
col0310 int4,
col0311 int4,
col0312 int4,
col0313 int4,
col0314 int4,
col0315 int4,
col0316 int4,
col0317 int4,
col0318 int4,
col0319 int4,
col0320 int4,
col0321 int4,
col0322 int4,
col0323 int4,
col0324 int4,
col0325 int4,
col0326 int4,
col0327 int4,
col0328 int4,
col0329 int4,
col0330 int4,
col0331 int4,
col0332 int4,
col0333 int4,
col0334 int4,
col0335 int4,
col0336 int4,
col0337 int4,
col0338 int4,
col0339 int4,
col0340 int4,
col0341 int4,
col0342 int4,
col0343 int4,
col0344 int4,
col0345 int4,
col0346 int4,
col0347 int4,
col0348 int4,
col0349 int4,
col0350 int4,
col0351 int4,
col0352 int4,
col0353 int4,
col0354 int4,
col0355 int4,
col0356 int4,
col0357 int4,
col0358 int4,
col0359 int4,
col0360 int4,
col0361 int4,
col0362 int4,
col0363 int4,
col0364 int4,
col0365 int4,
col0366 int4,
col0367 int4,
col0368 int4,
col0369 int4,
col0370 int4,
col0371 int4,
col0372 int4,
col0373 int4,
col0374 int4,
col0375 int4,
col0376 int4,
col0377 int4,
col0378 int4,
col0379 int4,
col0380 int4,
col0381 int4,
col0382 int4,
col0383 int4,
col0384 int4,
col0385 int4,
col0386 int4,
col0387 int4,
col0388 int4,
col0389 int4,
col0390 int4,
col0391 int4,
col0392 int4,
col0393 int4,
col0394 int4,
col0395 int4,
col0396 int4,
col0397 int4,
col0398 int4,
col0399 int4,
col0400 int4,
col0401 int4,
col0402 int4,
col0403 int4,
col0404 int4,
col0405 int4,
col0406 int4,
col0407 int4,
col0408 int4,
col0409 int4,
col0410 int4,
col0411 int4,
col0412 int4,
col0413 int4,
col0414 int4,
col0415 int4,
col0416 int4,
col0417 int4,
col0418 int4,
col0419 int4,
col0420 int4,
col0421 int4,
col0422 int4,
col0423 int4,
col0424 int4,
col0425 int4,
col0426 int4,
col0427 int4,
col0428 int4,
col0429 int4,
col0430 int4,
col0431 int4,
col0432 int4,
col0433 int4,
col0434 int4,
col0435 int4,
col0436 int4,
col0437 int4,
col0438 int4,
col0439 int4,
col0440 int4,
col0441 int4,
col0442 int4,
col0443 int4,
col0444 int4,
col0445 int4,
col0446 int4,
col0447 int4,
col0448 int4,
col0449 int4,
col0450 int4,
col0451 int4,
col0452 int4,
col0453 int4,
col0454 int4,
col0455 int4,
col0456 int4,
col0457 int4,
col0458 int4,
col0459 int4,
col0460 int4,
col0461 int4,
col0462 int4,
col0463 int4,
col0464 int4,
col0465 int4,
col0466 int4,
col0467 int4,
col0468 int4,
col0469 int4,
col0470 int4,
col0471 int4,
col0472 int4,
col0473 int4,
col0474 int4,
col0475 int4,
col0476 int4,
col0477 int4,
col0478 int4,
col0479 int4,
col0480 int4,
col0481 int4,
col0482 int4,
col0483 int4,
col0484 int4,
col0485 int4,
col0486 int4,
col0487 int4,
col0488 int4,
col0489 int4,
col0490 int4,
col0491 int4,
col0492 int4,
col0493 int4,
col0494 int4,
col0495 int4,
col0496 int4,
col0497 int4,
col0498 int4,
col0499 int4,
col0500 int4,
col0501 int4,
col0502 int4,
col0503 int4,
col0504 int4,
col0505 int4,
col0506 int4,
col0507 int4,
col0508 int4,
col0509 int4,
col0510 int4,
col0511 int4,
col0512 int4,
col0513 int4,
col0514 int4,
col0515 int4,
col0516 int4,
col0517 int4,
col0518 int4,
col0519 int4,
col0520 int4,
col0521 int4,
col0522 int4,
col0523 int4,
col0524 int4,
col0525 int4,
col0526 int4,
col0527 int4,
col0528 int4,
col0529 int4,
col0530 int4,
col0531 int4,
col0532 int4,
col0533 int4,
col0534 int4,
col0535 int4,
col0536 int4,
col0537 int4,
col0538 int4,
col0539 int4,
col0540 int4,
col0541 int4,
col0542 int4,
col0543 int4,
col0544 int4,
col0545 int4,
col0546 int4,
col0547 int4,
col0548 int4,
col0549 int4,
col0550 int4,
col0551 int4,
col0552 int4,
col0553 int4,
col0554 int4,
col0555 int4,
col0556 int4,
col0557 int4,
col0558 int4,
col0559 int4,
col0560 int4,
col0561 int4,
col0562 int4,
col0563 int4,
col0564 int4,
col0565 int4,
col0566 int4,
col0567 int4,
col0568 int4,
col0569 int4,
col0570 int4,
col0571 int4,
col0572 int4,
col0573 int4,
col0574 int4,
col0575 int4,
col0576 int4,
col0577 int4,
col0578 int4,
col0579 int4,
col0580 int4,
col0581 int4,
col0582 int4,
col0583 int4,
col0584 int4,
col0585 int4,
col0586 int4,
col0587 int4,
col0588 int4,
col0589 int4,
col0590 int4,
col0591 int4,
col0592 int4,
col0593 int4,
col0594 int4,
col0595 int4,
col0596 int4,
col0597 int4,
col0598 int4,
col0599 int4,
col0600 int4,
col0601 int4,
col0602 int4,
col0603 int4,
col0604 int4,
col0605 int4,
col0606 int4,
col0607 int4,
col0608 int4,
col0609 int4,
col0610 int4,
col0611 int4,
col0612 int4,
col0613 int4,
col0614 int4,
col0615 int4,
col0616 int4,
col0617 int4,
col0618 int4,
col0619 int4,
col0620 int4,
col0621 int4,
col0622 int4,
col0623 int4,
col0624 int4,
col0625 int4,
col0626 int4,
col0627 int4,
col0628 int4,
col0629 int4,
col0630 int4,
col0631 int4,
col0632 int4,
col0633 int4,
col0634 int4,
col0635 int4,
col0636 int4,
col0637 int4,
col0638 int4,
col0639 int4,
col0640 int4,
col0641 int4,
col0642 int4,
col0643 int4,
col0644 int4,
col0645 int4,
col0646 int4,
col0647 int4,
col0648 int4,
col0649 int4,
col0650 int4,
col0651 int4,
col0652 int4,
col0653 int4,
col0654 int4,
col0655 int4,
col0656 int4,
col0657 int4,
col0658 int4,
col0659 int4,
col0660 int4,
col0661 int4,
col0662 int4,
col0663 int4,
col0664 int4,
col0665 int4,
col0666 int4,
col0667 int4,
col0668 int4,
col0669 int4,
col0670 int4,
col0671 int4,
col0672 int4,
col0673 int4,
col0674 int4,
col0675 int4,
col0676 int4,
col0677 int4,
col0678 int4,
col0679 int4,
col0680 int4,
col0681 int4,
col0682 int4,
col0683 int4,
col0684 int4,
col0685 int4,
col0686 int4,
col0687 int4,
col0688 int4,
col0689 int4,
col0690 int4,
col0691 int4,
col0692 int4,
col0693 int4,
col0694 int4,
col0695 int4,
col0696 int4,
col0697 int4,
col0698 int4,
col0699 int4,
col0700 int4,
col0701 int4,
col0702 int4,
col0703 int4,
col0704 int4,
col0705 int4,
col0706 int4,
col0707 int4,
col0708 int4,
col0709 int4,
col0710 int4,
col0711 int4,
col0712 int4,
col0713 int4,
col0714 int4,
col0715 int4,
col0716 int4,
col0717 int4,
col0718 int4,
col0719 int4,
col0720 int4,
col0721 int4,
col0722 int4,
col0723 int4,
col0724 int4,
col0725 int4,
col0726 int4,
col0727 int4,
col0728 int4,
col0729 int4,
col0730 int4,
col0731 int4,
col0732 int4,
col0733 int4,
col0734 int4,
col0735 int4,
col0736 int4,
col0737 int4,
col0738 int4,
col0739 int4,
col0740 int4,
col0741 int4,
col0742 int4,
col0743 int4,
col0744 int4,
col0745 int4,
col0746 int4,
col0747 int4,
col0748 int4,
col0749 int4,
col0750 int4,
col0751 int4,
col0752 int4,
col0753 int4,
col0754 int4,
col0755 int4,
col0756 int4,
col0757 int4,
col0758 int4,
col0759 int4,
col0760 int4,
col0761 int4,
col0762 int4,
col0763 int4,
col0764 int4,
col0765 int4,
col0766 int4,
col0767 int4,
col0768 int4,
col0769 int4,
col0770 int4,
col0771 int4,
col0772 int4,
col0773 int4,
col0774 int4,
col0775 int4,
col0776 int4,
col0777 int4,
col0778 int4,
col0779 int4,
col0780 int4,
col0781 int4,
col0782 int4,
col0783 int4,
col0784 int4,
col0785 int4,
col0786 int4,
col0787 int4,
col0788 int4,
col0789 int4,
col0790 int4,
col0791 int4,
col0792 int4,
col0793 int4,
col0794 int4,
col0795 int4,
col0796 int4,
col0797 int4,
col0798 int4,
col0799 int4,
col0800 int4,
col0801 int4,
col0802 int4,
col0803 int4,
col0804 int4,
col0805 int4,
col0806 int4,
col0807 int4,
col0808 int4,
col0809 int4,
col0810 int4,
col0811 int4,
col0812 int4,
col0813 int4,
col0814 int4,
col0815 int4,
col0816 int4,
col0817 int4,
col0818 int4,
col0819 int4,
col0820 int4,
col0821 int4,
col0822 int4,
col0823 int4,
col0824 int4,
col0825 int4,
col0826 int4,
col0827 int4,
col0828 int4,
col0829 int4,
col0830 int4,
col0831 int4,
col0832 int4,
col0833 int4,
col0834 int4,
col0835 int4,
col0836 int4,
col0837 int4,
col0838 int4,
col0839 int4,
col0840 int4,
col0841 int4,
col0842 int4,
col0843 int4,
col0844 int4,
col0845 int4,
col0846 int4,
col0847 int4,
col0848 int4,
col0849 int4,
col0850 int4,
col0851 int4,
col0852 int4,
col0853 int4,
col0854 int4,
col0855 int4,
col0856 int4,
col0857 int4,
col0858 int4,
col0859 int4,
col0860 int4,
col0861 int4,
col0862 int4,
col0863 int4,
col0864 int4,
col0865 int4,
col0866 int4,
col0867 int4,
col0868 int4,
col0869 int4,
col0870 int4,
col0871 int4,
col0872 int4,
col0873 int4,
col0874 int4,
col0875 int4,
col0876 int4,
col0877 int4,
col0878 int4,
col0879 int4,
col0880 int4,
col0881 int4,
col0882 int4,
col0883 int4,
col0884 int4,
col0885 int4,
col0886 int4,
col0887 int4,
col0888 int4,
col0889 int4,
col0890 int4,
col0891 int4,
col0892 int4,
col0893 int4,
col0894 int4,
col0895 int4,
col0896 int4,
col0897 int4,
col0898 int4,
col0899 int4,
col0900 int4,
col0901 int4,
col0902 int4,
col0903 int4,
col0904 int4,
col0905 int4,
col0906 int4,
col0907 int4,
col0908 int4,
col0909 int4,
col0910 int4,
col0911 int4,
col0912 int4,
col0913 int4,
col0914 int4,
col0915 int4,
col0916 int4,
col0917 int4,
col0918 int4,
col0919 int4,
col0920 int4,
col0921 int4,
col0922 int4,
col0923 int4,
col0924 int4,
col0925 int4,
col0926 int4,
col0927 int4,
col0928 int4,
col0929 int4,
col0930 int4,
col0931 int4,
col0932 int4,
col0933 int4,
col0934 int4,
col0935 int4,
col0936 int4,
col0937 int4,
col0938 int4,
col0939 int4,
col0940 int4,
col0941 int4,
col0942 int4,
col0943 int4,
col0944 int4,
col0945 int4,
col0946 int4,
col0947 int4,
col0948 int4,
col0949 int4,
col0950 int4,
col0951 int4,
col0952 int4,
col0953 int4,
col0954 int4,
col0955 int4,
col0956 int4,
col0957 int4,
col0958 int4,
col0959 int4,
col0960 int4,
col0961 int4,
col0962 int4,
col0963 int4,
col0964 int4,
col0965 int4,
col0966 int4,
col0967 int4,
col0968 int4,
col0969 int4,
col0970 int4,
col0971 int4,
col0972 int4,
col0973 int4,
col0974 int4,
col0975 int4,
col0976 int4,
col0977 int4,
col0978 int4,
col0979 int4,
col0980 int4,
col0981 int4,
col0982 int4,
col0983 int4,
col0984 int4,
col0985 int4,
col0986 int4,
col0987 int4,
col0988 int4,
col0989 int4,
col0990 int4,
col0991 int4,
col0992 int4,
col0993 int4,
col0994 int4,
col0995 int4,
col0996 int4,
col0997 int4,
col0998 int4,
col0999 int4,
col1000 int4,
col1001 int4,
col1002 int4,
col1003 int4,
col1004 int4,
col1005 int4,
col1006 int4,
col1007 int4,
col1008 int4,
col1009 int4,
col1010 int4,
col1011 int4,
col1012 int4,
col1013 int4,
col1014 int4,
col1015 int4,
col1016 int4,
col1017 int4,
col1018 int4,
col1019 int4,
col1020 int4,
col1021 int4,
col1022 int4,
col1023 int4,
col1024 int4,
col1025 int4,
col1026 int4,
col1027 int4,
col1028 int4,
col1029 int4,
col1030 int4,
col1031 int4,
col1032 int4,
col1033 int4,
col1034 int4,
col1035 int4,
col1036 int4,
col1037 int4,
col1038 int4,
col1039 int4,
col1040 int4,
col1041 int4,
col1042 int4,
col1043 int4,
col1044 int4,
col1045 int4,
col1046 int4,
col1047 int4,
col1048 int4,
col1049 int4,
col1050 int4,
col1051 int4,
col1052 int4,
col1053 int4,
col1054 int4,
col1055 int4,
col1056 int4,
col1057 int4,
col1058 int4,
col1059 int4,
col1060 int4,
col1061 int4,
col1062 int4,
col1063 int4,
col1064 int4,
col1065 int4,
col1066 int4,
col1067 int4,
col1068 int4,
col1069 int4,
col1070 int4,
col1071 int4,
col1072 int4,
col1073 int4,
col1074 int4,
col1075 int4,
col1076 int4,
col1077 int4,
col1078 int4,
col1079 int4,
col1080 int4,
col1081 int4,
col1082 int4,
col1083 int4,
col1084 int4,
col1085 int4,
col1086 int4,
col1087 int4,
col1088 int4,
col1089 int4,
col1090 int4,
col1091 int4,
col1092 int4,
col1093 int4,
col1094 int4,
col1095 int4,
col1096 int4,
col1097 int4,
col1098 int4,
col1099 int4,
col1100 int4,
col1101 int4,
col1102 int4,
col1103 int4,
col1104 int4,
col1105 int4,
col1106 int4,
col1107 int4,
col1108 int4,
col1109 int4,
col1110 int4,
col1111 int4,
col1112 int4,
col1113 int4,
col1114 int4,
col1115 int4,
col1116 int4,
col1117 int4,
col1118 int4,
col1119 int4,
col1120 int4,
col1121 int4,
col1122 int4,
col1123 int4,
col1124 int4,
col1125 int4,
col1126 int4,
col1127 int4,
col1128 int4,
col1129 int4,
col1130 int4,
col1131 int4,
col1132 int4,
col1133 int4,
col1134 int4,
col1135 int4,
col1136 int4,
col1137 int4,
col1138 int4,
col1139 int4,
col1140 int4,
col1141 int4,
col1142 int4,
col1143 int4,
col1144 int4,
col1145 int4,
col1146 int4,
col1147 int4,
col1148 int4,
col1149 int4,
col1150 int4,
col1151 int4,
col1152 int4,
col1153 int4,
col1154 int4,
col1155 int4,
col1156 int4,
col1157 int4,
col1158 int4,
col1159 int4,
col1160 int4,
col1161 int4,
col1162 int4,
col1163 int4,
col1164 int4,
col1165 int4,
col1166 int4,
col1167 int4,
col1168 int4,
col1169 int4,
col1170 int4,
col1171 int4,
col1172 int4,
col1173 int4,
col1174 int4,
col1175 int4,
col1176 int4,
col1177 int4,
col1178 int4,
col1179 int4,
col1180 int4,
col1181 int4,
col1182 int4,
col1183 int4,
col1184 int4,
col1185 int4,
col1186 int4,
col1187 int4,
col1188 int4,
col1189 int4,
col1190 int4,
col1191 int4,
col1192 int4,
col1193 int4,
col1194 int4,
col1195 int4,
col1196 int4,
col1197 int4,
col1198 int4,
col1199 int4,
col1200 int4,
col1201 int4,
col1202 int4,
col1203 int4,
col1204 int4,
col1205 int4,
col1206 int4,
col1207 int4,
col1208 int4,
col1209 int4,
col1210 int4,
col1211 int4,
col1212 int4,
col1213 int4,
col1214 int4,
col1215 int4,
col1216 int4,
col1217 int4,
col1218 int4,
col1219 int4,
col1220 int4,
col1221 int4,
col1222 int4,
col1223 int4,
col1224 int4,
col1225 int4,
col1226 int4,
col1227 int4,
col1228 int4,
col1229 int4,
col1230 int4,
col1231 int4,
col1232 int4,
col1233 int4,
col1234 int4,
col1235 int4,
col1236 int4,
col1237 int4,
col1238 int4,
col1239 int4,
col1240 int4,
col1241 int4,
col1242 int4,
col1243 int4,
col1244 int4,
col1245 int4,
col1246 int4,
col1247 int4,
col1248 int4,
col1249 int4,
col1250 int4,
col1251 int4,
col1252 int4,
col1253 int4,
col1254 int4,
col1255 int4,
col1256 int4,
col1257 int4,
col1258 int4,
col1259 int4,
col1260 int4,
col1261 int4,
col1262 int4,
col1263 int4,
col1264 int4,
col1265 int4,
col1266 int4,
col1267 int4,
col1268 int4,
col1269 int4,
col1270 int4,
col1271 int4,
col1272 int4,
col1273 int4,
col1274 int4,
col1275 int4,
col1276 int4,
col1277 int4,
col1278 int4,
col1279 int4,
col1280 int4,
col1281 int4,
col1282 int4,
col1283 int4,
col1284 int4,
col1285 int4,
col1286 int4,
col1287 int4,
col1288 int4,
col1289 int4,
col1290 int4,
col1291 int4,
col1292 int4,
col1293 int4,
col1294 int4,
col1295 int4,
col1296 int4,
col1297 int4,
col1298 int4,
col1299 int4,
col1300 int4,
col1301 int4,
col1302 int4,
col1303 int4,
col1304 int4,
col1305 int4,
col1306 int4,
col1307 int4,
col1308 int4,
col1309 int4,
col1310 int4,
col1311 int4,
col1312 int4,
col1313 int4,
col1314 int4,
col1315 int4,
col1316 int4,
col1317 int4,
col1318 int4,
col1319 int4,
col1320 int4,
col1321 int4,
col1322 int4,
col1323 int4,
col1324 int4,
col1325 int4,
col1326 int4,
col1327 int4,
col1328 int4,
col1329 int4,
col1330 int4,
col1331 int4,
col1332 int4,
col1333 int4,
col1334 int4,
col1335 int4,
col1336 int4,
col1337 int4,
col1338 int4,
col1339 int4,
col1340 int4,
col1341 int4,
col1342 int4,
col1343 int4,
col1344 int4,
col1345 int4,
col1346 int4,
col1347 int4,
col1348 int4,
col1349 int4,
col1350 int4,
col1351 int4,
col1352 int4,
col1353 int4,
col1354 int4,
col1355 int4,
col1356 int4,
col1357 int4,
col1358 int4,
col1359 int4,
col1360 int4,
col1361 int4,
col1362 int4,
col1363 int4,
col1364 int4,
col1365 int4,
col1366 int4,
col1367 int4,
col1368 int4,
col1369 int4,
col1370 int4,
col1371 int4,
col1372 int4,
col1373 int4,
col1374 int4,
col1375 int4,
col1376 int4,
col1377 int4,
col1378 int4,
col1379 int4,
col1380 int4,
col1381 int4,
col1382 int4,
col1383 int4,
col1384 int4,
col1385 int4,
col1386 int4,
col1387 int4,
col1388 int4,
col1389 int4,
col1390 int4,
col1391 int4,
col1392 int4,
col1393 int4,
col1394 int4,
col1395 int4,
col1396 int4,
col1397 int4,
col1398 int4,
col1399 int4,
col1400 int4,
col1401 int4,
col1402 int4,
col1403 int4,
col1404 int4,
col1405 int4,
col1406 int4,
col1407 int4,
col1408 int4,
col1409 int4,
col1410 int4,
col1411 int4,
col1412 int4,
col1413 int4,
col1414 int4,
col1415 int4,
col1416 int4,
col1417 int4,
col1418 int4,
col1419 int4,
col1420 int4,
col1421 int4,
col1422 int4,
col1423 int4,
col1424 int4,
col1425 int4,
col1426 int4,
col1427 int4,
col1428 int4,
col1429 int4,
col1430 int4,
col1431 int4,
col1432 int4,
col1433 int4,
col1434 int4,
col1435 int4,
col1436 int4,
col1437 int4,
col1438 int4,
col1439 int4,
col1440 int4,
col1441 int4,
col1442 int4,
col1443 int4,
col1444 int4,
col1445 int4,
col1446 int4,
col1447 int4,
col1448 int4,
col1449 int4,
col1450 int4,
col1451 int4,
col1452 int4,
col1453 int4,
col1454 int4,
col1455 int4,
col1456 int4,
col1457 int4,
col1458 int4,
col1459 int4,
col1460 int4,
col1461 int4,
col1462 int4,
col1463 int4,
col1464 int4,
col1465 int4,
col1466 int4,
col1467 int4,
col1468 int4,
col1469 int4,
col1470 int4,
col1471 int4,
col1472 int4,
col1473 int4,
col1474 int4,
col1475 int4,
col1476 int4,
col1477 int4,
col1478 int4,
col1479 int4,
col1480 int4,
col1481 int4,
col1482 int4,
col1483 int4,
col1484 int4,
col1485 int4,
col1486 int4,
col1487 int4,
col1488 int4,
col1489 int4,
col1490 int4,
col1491 int4,
col1492 int4,
col1493 int4,
col1494 int4,
col1495 int4,
col1496 int4,
col1497 int4,
col1498 int4,
col1499 int4,
col1500 int4,
col1501 int4,
col1502 int4,
col1503 int4,
col1504 int4,
col1505 int4,
col1506 int4,
col1507 int4,
col1508 int4,
col1509 int4,
col1510 int4,
col1511 int4,
col1512 int4,
col1513 int4,
col1514 int4,
col1515 int4,
col1516 int4,
col1517 int4,
col1518 int4,
col1519 int4,
col1520 int4,
col1521 int4,
col1522 int4,
col1523 int4,
col1524 int4,
col1525 int4,
col1526 int4,
col1527 int4,
col1528 int4,
col1529 int4,
col1530 int4,
col1531 int4,
col1532 int4,
col1533 int4,
col1534 int4,
col1535 int4,
col1536 int4,
col1537 int4,
col1538 int4,
col1539 int4,
col1540 int4,
col1541 int4,
col1542 int4,
col1543 int4,
col1544 int4,
col1545 int4,
col1546 int4,
col1547 int4,
col1548 int4,
col1549 int4,
col1550 int4,
col1551 int4,
col1552 int4,
col1553 int4,
col1554 int4,
col1555 int4,
col1556 int4,
col1557 int4,
col1558 int4,
col1559 int4,
col1560 int4,
col1561 int4,
col1562 int4,
col1563 int4,
col1564 int4,
col1565 int4,
col1566 int4,
col1567 int4,
col1568 int4,
col1569 int4,
col1570 int4,
col1571 int4,
col1572 int4,
col1573 int4,
col1574 int4,
col1575 int4,
col1576 int4,
col1577 int4,
col1578 int4,
col1579 int4,
col1580 int4,
col1581 int4,
col1582 int4,
col1583 int4,
col1584 int4,
col1585 int4,
col1586 int4,
col1587 int4,
col1588 int4,
col1589 int4,
col1590 int4,
col1591 int4,
col1592 int4,
col1593 int4,
col1594 int4,
col1595 int4,
col1596 int4,
col1597 int4,
col1598 int4,
col1599 int4
);

CREATE TABLE narrowtable (ntcol int4);

INSERT INTO widetable VALUES (1, 2, 3);
INSERT INTO narrowtable VALUES (1);

SELECT wt000.col0000, ntcol
FROM widetable wt000
INNER JOIN widetable wt001 ON (wt001.col0000 = wt000.col0000)
INNER JOIN widetable wt002 ON (wt002.col0000 = wt001.col0000)
INNER JOIN widetable wt003 ON (wt003.col0000 = wt002.col0000)
INNER JOIN widetable wt004 ON (wt004.col0000 = wt003.col0000)
INNER JOIN widetable wt005 ON (wt005.col0000 = wt004.col0000)
INNER JOIN widetable wt006 ON (wt006.col0000 = wt005.col0000)
INNER JOIN widetable wt007 ON (wt007.col0000 = wt006.col0000)
INNER JOIN widetable wt008 ON (wt008.col0000 = wt007.col0000)
INNER JOIN widetable wt009 ON (wt009.col0000 = wt008.col0000)
INNER JOIN widetable wt010 ON (wt010.col0000 = wt009.col0000)
INNER JOIN widetable wt011 ON (wt011.col0000 = wt010.col0000)
INNER JOIN widetable wt012 ON (wt012.col0000 = wt011.col0000)
INNER JOIN widetable wt013 ON (wt013.col0000 = wt012.col0000)
INNER JOIN widetable wt014 ON (wt014.col0000 = wt013.col0000)
INNER JOIN widetable wt015 ON (wt015.col0000 = wt014.col0000)
INNER JOIN widetable wt016 ON (wt016.col0000 = wt015.col0000)
INNER JOIN widetable wt017 ON (wt017.col0000 = wt016.col0000)
INNER JOIN widetable wt018 ON (wt018.col0000 = wt017.col0000)
INNER JOIN widetable wt019 ON (wt019.col0000 = wt018.col0000)
INNER JOIN widetable wt020 ON (wt020.col0000 = wt019.col0000)
INNER JOIN widetable wt021 ON (wt021.col0000 = wt020.col0000)
INNER JOIN widetable wt022 ON (wt022.col0000 = wt021.col0000)
INNER JOIN widetable wt023 ON (wt023.col0000 = wt022.col0000)
INNER JOIN widetable wt024 ON (wt024.col0000 = wt023.col0000)
INNER JOIN widetable wt025 ON (wt025.col0000 = wt024.col0000)
INNER JOIN widetable wt026 ON (wt026.col0000 = wt025.col0000)
INNER JOIN widetable wt027 ON (wt027.col0000 = wt026.col0000)
INNER JOIN widetable wt028 ON (wt028.col0000 = wt027.col0000)
INNER JOIN widetable wt029 ON (wt029.col0000 = wt028.col0000)
INNER JOIN narrowtable nt ON (nt.ntcol = wt029.col0000)
;
Index: src/backend/executor/execQual.c
===================================================================
RCS file: /home/hlinnaka/pgcvsrepository/pgsql/src/backend/executor/execQual.c,v
retrieving revision 1.226
diff -c -r1.226 execQual.c
*** src/backend/executor/execQual.c    1 Jan 2008 19:45:49 -0000    1.226
--- src/backend/executor/execQual.c    3 Apr 2008 12:25:22 -0000
***************
*** 450,456 ****
  {
      Var           *variable = (Var *) exprstate->expr;
      TupleTableSlot *slot;
!     AttrNumber    attnum;

      if (isDone)
          *isDone = ExprSingleResult;
--- 450,456 ----
  {
      Var           *variable = (Var *) exprstate->expr;
      TupleTableSlot *slot;
!     int            attnum;

      if (isDone)
          *isDone = ExprSingleResult;
***************
*** 637,643 ****
  {
      Var           *variable = (Var *) exprstate->expr;
      TupleTableSlot *slot;
!     AttrNumber    attnum;

      if (isDone)
          *isDone = ExprSingleResult;
--- 637,643 ----
  {
      Var           *variable = (Var *) exprstate->expr;
      TupleTableSlot *slot;
!     int            attnum;

      if (isDone)
          *isDone = ExprSingleResult;
Index: src/backend/nodes/makefuncs.c
===================================================================
RCS file: /home/hlinnaka/pgcvsrepository/pgsql/src/backend/nodes/makefuncs.c,v
retrieving revision 1.58
diff -c -r1.58 makefuncs.c
*** src/backend/nodes/makefuncs.c    1 Jan 2008 19:45:50 -0000    1.58
--- src/backend/nodes/makefuncs.c    3 Apr 2008 12:10:17 -0000
***************
*** 62,68 ****
   */
  Var *
  makeVar(Index varno,
!         AttrNumber varattno,
          Oid vartype,
          int32 vartypmod,
          Index varlevelsup)
--- 62,68 ----
   */
  Var *
  makeVar(Index varno,
!         int varattno,
          Oid vartype,
          int32 vartypmod,
          Index varlevelsup)
***************
*** 93,99 ****
   */
  TargetEntry *
  makeTargetEntry(Expr *expr,
!                 AttrNumber resno,
                  char *resname,
                  bool resjunk)
  {
--- 93,99 ----
   */
  TargetEntry *
  makeTargetEntry(Expr *expr,
!                 int resno,
                  char *resname,
                  bool resjunk)
  {
Index: src/backend/optimizer/util/var.c
===================================================================
RCS file: /home/hlinnaka/pgcvsrepository/pgsql/src/backend/optimizer/util/var.c,v
retrieving revision 1.73
diff -c -r1.73 var.c
*** src/backend/optimizer/util/var.c    1 Jan 2008 19:45:50 -0000    1.73
--- src/backend/optimizer/util/var.c    3 Apr 2008 12:22:41 -0000
***************
*** 595,608 ****
              /* Must expand whole-row reference */
              RowExpr    *rowexpr;
              List       *fields = NIL;
-             AttrNumber    attnum;
              ListCell   *l;

-             attnum = 0;
              foreach(l, rte->joinaliasvars)
              {
                  newvar = (Node *) lfirst(l);
-                 attnum++;
                  /* Ignore dropped columns */
                  if (IsA(newvar, Const))
                      continue;
--- 595,605 ----
Index: src/backend/parser/parse_relation.c
===================================================================
RCS file: /home/hlinnaka/pgcvsrepository/pgsql/src/backend/parser/parse_relation.c,v
retrieving revision 1.130
diff -c -r1.130 parse_relation.c
*** src/backend/parser/parse_relation.c    1 Jan 2008 19:45:51 -0000    1.130
--- src/backend/parser/parse_relation.c    3 Apr 2008 12:10:25 -0000
***************
*** 1506,1512 ****
          TargetEntry *te;

          te = makeTargetEntry((Expr *) varnode,
!                              (AttrNumber) pstate->p_next_resno++,
                               label,
                               false);
          te_list = lappend(te_list, te);
--- 1506,1512 ----
          TargetEntry *te;

          te = makeTargetEntry((Expr *) varnode,
!                              pstate->p_next_resno++,
                               label,
                               false);
          te_list = lappend(te_list, te);
***************
*** 1529,1535 ****
   * occurs when a Var represents a whole tuple of a relation.
   */
  char *
! get_rte_attribute_name(RangeTblEntry *rte, AttrNumber attnum)
  {
      if (attnum == InvalidAttrNumber)
          return "*";
--- 1529,1535 ----
   * occurs when a Var represents a whole tuple of a relation.
   */
  char *
! get_rte_attribute_name(RangeTblEntry *rte, int attnum)
  {
      if (attnum == InvalidAttrNumber)
          return "*";
***************
*** 1567,1573 ****
   *        Get attribute type information from a RangeTblEntry
   */
  void
! get_rte_attribute_type(RangeTblEntry *rte, AttrNumber attnum,
                         Oid *vartype, int32 *vartypmod)
  {
      switch (rte->rtekind)
--- 1567,1573 ----
   *        Get attribute type information from a RangeTblEntry
   */
  void
! get_rte_attribute_type(RangeTblEntry *rte, int attnum,
                         Oid *vartype, int32 *vartypmod)
  {
      switch (rte->rtekind)
***************
*** 1710,1716 ****
   *        Check whether attempted attribute ref is to a dropped column
   */
  bool
! get_rte_attribute_is_dropped(RangeTblEntry *rte, AttrNumber attnum)
  {
      bool        result;

--- 1710,1716 ----
   *        Check whether attempted attribute ref is to a dropped column
   */
  bool
! get_rte_attribute_is_dropped(RangeTblEntry *rte, int attnum)
  {
      bool        result;

Index: src/backend/parser/parse_target.c
===================================================================
RCS file: /home/hlinnaka/pgcvsrepository/pgsql/src/backend/parser/parse_target.c,v
retrieving revision 1.158
diff -c -r1.158 parse_target.c
*** src/backend/parser/parse_target.c    1 Jan 2008 19:45:51 -0000    1.158
--- src/backend/parser/parse_target.c    3 Apr 2008 12:13:47 -0000
***************
*** 83,89 ****
      }

      return makeTargetEntry((Expr *) expr,
!                            (AttrNumber) pstate->p_next_resno++,
                             colname,
                             resjunk);
  }
--- 83,89 ----
      }

      return makeTargetEntry((Expr *) expr,
!                            pstate->p_next_resno++,
                             colname,
                             resjunk);
  }
***************
*** 254,260 ****
  {
      int            netlevelsup;
      RangeTblEntry *rte;
!     AttrNumber    attnum;

      if (var == NULL || !IsA(var, Var))
          return;
--- 254,260 ----
  {
      int            netlevelsup;
      RangeTblEntry *rte;
!     int    attnum;

      if (var == NULL || !IsA(var, Var))
          return;
Index: src/backend/utils/adt/ruleutils.c
===================================================================
RCS file: /home/hlinnaka/pgcvsrepository/pgsql/src/backend/utils/adt/ruleutils.c,v
retrieving revision 1.269
diff -c -r1.269 ruleutils.c
*** src/backend/utils/adt/ruleutils.c    6 Jan 2008 01:03:16 -0000    1.269
--- src/backend/utils/adt/ruleutils.c    3 Apr 2008 12:16:10 -0000
***************
*** 2616,2622 ****
  {
      StringInfo    buf = context->buf;
      RangeTblEntry *rte;
!     AttrNumber    attnum;
      int            netlevelsup;
      deparse_namespace *dpns;
      char       *schemaname;
--- 2616,2622 ----
  {
      StringInfo    buf = context->buf;
      RangeTblEntry *rte;
!     int            attnum;
      int            netlevelsup;
      deparse_namespace *dpns;
      char       *schemaname;
***************
*** 2802,2808 ****
                         int levelsup, deparse_context *context)
  {
      RangeTblEntry *rte;
!     AttrNumber    attnum;
      int            netlevelsup;
      deparse_namespace *dpns;
      TupleDesc    tupleDesc;
--- 2802,2808 ----
                         int levelsup, deparse_context *context)
  {
      RangeTblEntry *rte;
!     int            attnum;
      int            netlevelsup;
      deparse_namespace *dpns;
      TupleDesc    tupleDesc;
***************
*** 4964,4970 ****
  {
      StringInfo    buf = context->buf;
      ListCell   *col;
!     AttrNumber    attnum;
      bool        first = true;

      if (alias == NULL || alias->colnames == NIL)
--- 4964,4970 ----
  {
      StringInfo    buf = context->buf;
      ListCell   *col;
!     int            attnum;
      bool        first = true;

      if (alias == NULL || alias->colnames == NIL)
Index: src/include/nodes/makefuncs.h
===================================================================
RCS file: /home/hlinnaka/pgcvsrepository/pgsql/src/include/nodes/makefuncs.h,v
retrieving revision 1.61
diff -c -r1.61 makefuncs.h
*** src/include/nodes/makefuncs.h    1 Jan 2008 19:45:58 -0000    1.61
--- src/include/nodes/makefuncs.h    3 Apr 2008 12:10:57 -0000
***************
*** 24,36 ****
                   Node *lexpr, Node *rexpr, int location);

  extern Var *makeVar(Index varno,
!         AttrNumber varattno,
          Oid vartype,
          int32 vartypmod,
          Index varlevelsup);

  extern TargetEntry *makeTargetEntry(Expr *expr,
!                 AttrNumber resno,
                  char *resname,
                  bool resjunk);

--- 24,36 ----
                   Node *lexpr, Node *rexpr, int location);

  extern Var *makeVar(Index varno,
!         int varattno,
          Oid vartype,
          int32 vartypmod,
          Index varlevelsup);

  extern TargetEntry *makeTargetEntry(Expr *expr,
!                 int resno,
                  char *resname,
                  bool resjunk);

Index: src/include/nodes/primnodes.h
===================================================================
RCS file: /home/hlinnaka/pgcvsrepository/pgsql/src/include/nodes/primnodes.h,v
retrieving revision 1.137
diff -c -r1.137 primnodes.h
*** src/include/nodes/primnodes.h    1 Jan 2008 19:45:58 -0000    1.137
--- src/include/nodes/primnodes.h    3 Apr 2008 12:10:06 -0000
***************
*** 134,140 ****
      Expr        xpr;
      Index        varno;            /* index of this var's relation in the range
                                   * table (could also be INNER or OUTER) */
!     AttrNumber    varattno;        /* attribute number of this var, or zero for
                                   * all */
      Oid            vartype;        /* pg_type OID for the type of this var */
      int32        vartypmod;        /* pg_attribute typmod value */
--- 134,140 ----
      Expr        xpr;
      Index        varno;            /* index of this var's relation in the range
                                   * table (could also be INNER or OUTER) */
!     int            varattno;        /* attribute number of this var, or zero for
                                   * all */
      Oid            vartype;        /* pg_type OID for the type of this var */
      int32        vartypmod;        /* pg_attribute typmod value */
***************
*** 145,151 ****
       * >0 means N levels up
       */
      Index        varnoold;        /* original value of varno, for debugging */
!     AttrNumber    varoattno;        /* original value of varattno */
  } Var;

  /*
--- 145,151 ----
       * >0 means N levels up
       */
      Index        varnoold;        /* original value of varno, for debugging */
!     int            varoattno;        /* original value of varattno */
  } Var;

  /*
***************
*** 497,503 ****
  {
      Expr        xpr;
      Expr       *arg;            /* input expression */
!     AttrNumber    fieldnum;        /* attribute number of field to extract */
      Oid            resulttype;        /* type of the field (result type of this
                                   * node) */
      int32        resulttypmod;    /* output typmod (usually -1) */
--- 497,503 ----
  {
      Expr        xpr;
      Expr       *arg;            /* input expression */
!     AttrNumber    fieldnum;        /* attribute number of field to extract */ /*XXX*/
      Oid            resulttype;        /* type of the field (result type of this
                                   * node) */
      int32        resulttypmod;    /* output typmod (usually -1) */
***************
*** 993,999 ****
  {
      Expr        xpr;
      Expr       *expr;            /* expression to evaluate */
!     AttrNumber    resno;            /* attribute number (see notes above) */
      char       *resname;        /* name of the column (could be NULL) */
      Index        ressortgroupref;/* nonzero if referenced by a sort/group
                                   * clause */
--- 993,999 ----
  {
      Expr        xpr;
      Expr       *expr;            /* expression to evaluate */
!     int            resno;            /* attribute number (see notes above) */
      char       *resname;        /* name of the column (could be NULL) */
      Index        ressortgroupref;/* nonzero if referenced by a sort/group
                                   * clause */
Index: src/include/parser/parsetree.h
===================================================================
RCS file: /home/hlinnaka/pgcvsrepository/pgsql/src/include/parser/parsetree.h,v
retrieving revision 1.36
diff -c -r1.36 parsetree.h
*** src/include/parser/parsetree.h    1 Jan 2008 19:45:58 -0000    1.36
--- src/include/parser/parsetree.h    3 Apr 2008 09:36:49 -0000
***************
*** 45,57 ****
   * Given an RTE and an attribute number, return the appropriate
   * variable name or alias for that attribute of that RTE.
   */
! extern char *get_rte_attribute_name(RangeTblEntry *rte, AttrNumber attnum);

  /*
   * Given an RTE and an attribute number, return the appropriate
   * type and typemod info for that attribute of that RTE.
   */
! extern void get_rte_attribute_type(RangeTblEntry *rte, AttrNumber attnum,
                         Oid *vartype, int32 *vartypmod);

  /*
--- 45,57 ----
   * Given an RTE and an attribute number, return the appropriate
   * variable name or alias for that attribute of that RTE.
   */
! extern char *get_rte_attribute_name(RangeTblEntry *rte, int attnum);

  /*
   * Given an RTE and an attribute number, return the appropriate
   * type and typemod info for that attribute of that RTE.
   */
! extern void get_rte_attribute_type(RangeTblEntry *rte, int attnum,
                         Oid *vartype, int32 *vartypmod);

  /*
***************
*** 59,65 ****
   * get_rte_attribute_type will fail on such an attr)
   */
  extern bool get_rte_attribute_is_dropped(RangeTblEntry *rte,
!                              AttrNumber attnum);


  /* ----------------
--- 59,65 ----
   * get_rte_attribute_type will fail on such an attr)
   */
  extern bool get_rte_attribute_is_dropped(RangeTblEntry *rte,
!                              int attnum);


  /* ----------------

pgsql-patches by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: psql command aliases support
Next
From: Gregory Stark
Date:
Subject: Re: psql command aliases support