Thread: [Help] Modifying get_columns.sql template

[Help] Modifying get_columns.sql template

From
Yosry Muhammad
Date:
Hi hackers!

I was wondering if modifying the query in: get_columns.sql @ pgadmin/tools/sqleditor/templates/sql/default/ 
to also SELECT attnum (attribute number) in addition to the already SELECTed columns will break any code or tests?

I know this template is used in multiple places throughout the code and tests and I don't completely understand all the parts it is used in. 

Can someone guide in terms of whether or not this will break anything? If so, what parts of the code do I need to update?

Thanks.

Re: [Help] Modifying get_columns.sql template

From
Dave Page
Date:
Hi Yosry,

On Fri, Aug 2, 2019 at 7:51 AM Yosry Muhammad <yosrym93@gmail.com> wrote:
Hi hackers!

I was wondering if modifying the query in: get_columns.sql @ pgadmin/tools/sqleditor/templates/sql/default/ 
to also SELECT attnum (attribute number) in addition to the already SELECTed columns will break any code or tests?

It shouldn't, as the code shouldn't be dependent on column ordering (if it is, I consider that a bug). Adding it at the end of the select list would be safest of course.
 

I know this template is used in multiple places throughout the code and tests and I don't completely understand all the parts it is used in. 

Can someone guide in terms of whether or not this will break anything? If so, what parts of the code do I need to update?

Well we have tests, so make your changes and see if anything breaks :-). 
 
--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

Re: [Help] Modifying get_columns.sql template

From
Yosry Muhammad
Date:
Alright, thanks a lot ! 

On Fri, Aug 2, 2019, 10:01 AM Dave Page <dpage@pgadmin.org> wrote:
Hi Yosry,

On Fri, Aug 2, 2019 at 7:51 AM Yosry Muhammad <yosrym93@gmail.com> wrote:
Hi hackers!

I was wondering if modifying the query in: get_columns.sql @ pgadmin/tools/sqleditor/templates/sql/default/ 
to also SELECT attnum (attribute number) in addition to the already SELECTed columns will break any code or tests?

It shouldn't, as the code shouldn't be dependent on column ordering (if it is, I consider that a bug). Adding it at the end of the select list would be safest of course.
 

I know this template is used in multiple places throughout the code and tests and I don't completely understand all the parts it is used in. 

Can someone guide in terms of whether or not this will break anything? If so, what parts of the code do I need to update?

Well we have tests, so make your changes and see if anything breaks :-). 
 
--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company