Thread: BUG #5757: PL/PGSQL composite variable field error reporting
The following bug has been logged online: Bug reference: 5757 Logged by: Andrey Galkin Email address: andvgal@gmail.com PostgreSQL version: 9.0.1 Operating system: Debian unstable Description: PL/PGSQL composite variable field error reporting Details: 1. Create a variable of composite type in PL/PGSQL function 2. Try to reference not existing field of the variable in some statement, like IF 3. Get "missing FROM-clause entry for table" error at runtime The error is not very helpful. If it's possible please detect the incorrectly referenced field at parsing/statement preparing time.
"Andrey Galkin" <andvgal@gmail.com> writes: > The following bug has been logged online: > Bug reference: 5757 > Logged by: Andrey Galkin > Email address: andvgal@gmail.com > PostgreSQL version: 9.0.1 > Operating system: Debian unstable > Description: PL/PGSQL composite variable field error reporting > Details: > 1. Create a variable of composite type in PL/PGSQL function > 2. Try to reference not existing field of the variable in some statement, > like IF > 3. Get "missing FROM-clause entry for table" error at runtime Please provide a complete test-case, not a vague description. regards, tom lane
Tm8gcHJvYmxlbSwgcGxlYXNlIGZpbmQgYSBzaW1wbGUgdGVzdCBjYXNlIHdp dGggaXRzIGV4ZWN1dGlvbiByZXN1bHQgYmVsb3c6CgotLSA9PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09ClNUQVJUIFRSQU5TQUNUSU9OOwoKQ1JF QVRFIFRZUEUgQ29tcG9zaXRlVHlwZSBBUyAoCsKgwqDCoCBleGlzdGluZ19m aWVsZCBURVhUCik7CgotLQpDUkVBVEUgRlVOQ1RJT04gQnVnXzU3NTdfdGVz dCgpCsKgwqDCoCBSRVRVUk5TIFZPSUQKQVMgJCQKREVDTEFSRQrCoMKgwqAg dl9jb21wIENvbXBvc2l0ZVR5cGU7CkJFR0lOCsKgwqDCoCBJRiB2X2NvbXAu bm9uX2V4aXN0aW5nX2ZpZWxkIFRIRU4KwqDCoMKgIMKgwqDCoCBOVUxMOwrC oMKgwqAgRU5EIElGOwpFTkQ7CiQkCkxBTkdVQUdFIHBscGdzc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3Np dGUgdmFyaWFibGUgZmllbGQgZXJyb3IgcmVwb3J0aW5nCj4gPiBEZXRhaWxz Ogo+Cj4gPiAxLiBDcmVhdGUgYSB2YXJpYWJsZSBvZiBjb21wb3NpdGUgdHlw ZSBpbiBQTC9QR1NRTCBmdW5jdGlvbgo+ID4gMi4gVHJ5IHRvIHJlZmVyZW5j ZSBub3QgZXhpc3RpbmcgZmllbGQgb2YgdGhlIHZhcmlhYmxlIGluIHNvbWUg c3RhdGVtZW50LAo+ID4gbGlrZSBJRgo+ID4gMy4gR2V0ICJtaXNzaW5nIEZS T00tY2xhdXNlIGVudHJ5IGZvciB0YWJsZSIgZXJyb3IgYXQgcnVudGltZQo+ Cj4gUGxlYXNlIHByb3ZpZGUgYSBjb21wbGV0ZSB0ZXN0LWNhc2UsIG5vdCBh IHZhZ3VlIGRlc2NyaXB0aW9uLgo+Cj4gwqAgwqAgwqAgwqAgwqAgwqAgwqAg wqAgwqAgwqAgwqAgwqByZWdhcmRzLCB0b20gbGFuZQo=
"Andrey G." <andvgal@gmail.com> writes: > CREATE FUNCTION Bug_5757_test() > RETURNS VOID > AS $$ > DECLARE > v_comp CompositeType; > BEGIN > IF v_comp.non_existing_field THEN > NULL; > END IF; > END; > $$ > LANGUAGE plpgsql; OK, I did something about that. Thanks for the report! regards, tom lane