postgres-github.git / summary / log / commit / refs

commit    21c69dc73f9d0af6a11f13ef61522577126a8674
Author:   Tom Lane <tgl@sss.pgh.pa.us>
Date:     Mon Apr 06 18:05:01 2026 +0000

    Disallow system columns in COPY FROM WHERE conditions.
    
    These columns haven't been computed yet when the filtering happens
    (since we've not written the candidate tuple into the table); so
    any check on them is wrong or useless.  Worse, since aa606b931 such a
    reference results in an access off the end of a TupleDesc, potentially
    causing a phony "generated columns are not supported in COPY FROM
    WHERE conditions" error; and since c98ad086a it throws an Assert
    instead.
    
    Actually we could allow tableoid, which has been set to the OID of the
    table named as the COPY target.  However, plausible uses for tests of
    tableoid would involve a partitioned target table, and the user would
    wish it to read as the OID of the destination partition.  There has
    been some discussion of changing things to make it work like that,
    but pending that happening we should just disallow tableoid along
    with other system columns.
    
    It seems best though to install this prohibition only in HEAD.
    In the back branches we'll just guard the unsafe TupleDesc access,
    and people will keep getting whatever semantics they got before.
    
    Reported-by: Alexander Lakhin <exclusion@gmail.com>
    Author: Tom Lane <tgl@sss.pgh.pa.us>
    Discussion: https://postgr.es/m/6f435023-8ab6-47c2-ba07-035d0c4212f9@gmail.com

[parent: f7da81f68b63]