In Postgresql, is it possible to change the maximum number of columns a table can have? I'm tasked with keeping a postgres table in sync with a non-postgres table. The non-postgres table has more than 1600 columns. When I try to create the table in postgres, I get:


  ERROR:  tables can have at most 1600 columns


I want to know if it is possible to raise the maximum number of columns. Is there a configuration variable I can change? Do I have to compile postgres with special options? Is there a good reason why the maximum number of columns is 1600 instead of 1700?

I have searched for this answer on Google and all answers are essentially: "you should never have a table with 1600 columns".
There's no run-time configuration option that will let you have more than about 1600 columns in a table.  You can redefine values and compile PostgreSQL from source. That might turn out to be harder than it sounds in your case.

A quick look at the source code seems to say the number of columns depends on the values of MaxTupleAttributeNumber and MaxHeapAttributeNumber. These are defined in src/include/access/htup_details.h. 

So you might be able to increase the number of columns by 


redefining those values, while 
paying close attention to how their current values have been determined, then
recompiling.


Details are in source code comments.  Search for htup_details.h in the search dialog there. 

I suggest you try building from source without making any changes first. After you can do that well, then try making the changes above. Consider digging around in the source code to determine whether there are any other dependencies that are not as well documented as these two.