[GENERAL] find out data types using sql or php

2007-10-26 Thread Tom Hart
Hey guys. This is probably a n00b question, but here goes anyway. I have a set of csv files that I COPY t o a number of import tables (same field layout as live tables, but with all datatypes 'text') then use an INSERT INTO ... SELECT FROM statement to transfer the rows over to the live table

Re: [GENERAL] find out data types using sql or php

2007-10-26 Thread Tom Hart
Replying to yourself is so depressing... Anyway, I managed to google myself into a solution, I just wanted to share it with the list in case anybody else was interested. Using the INFORMATION SCHEMA and a query like SELECT column_name, data_type FROM information_schema.columns WHERE

Re: [GENERAL] find out data types using sql or php

2007-10-26 Thread Webb Sprague
... to determine the field datatype (text, numeric, bool, etc.) I am not sure if this helps, but you can dig around in the system files (pg_catalog.*), and probably write a query that gets the types of every column in the data table you want to insert to. Not a big push, but maybe it will get

Re: [GENERAL] find out data types using sql or php

2007-10-26 Thread Michael Glaesemann
On Oct 26, 2007, at 16:06 , Tom Hart wrote: What I'd like to do is add a field is_ok and then use sql or php (or whatever else, if there's an easier way) to determine the field datatype (text, numeric, bool, etc.) and then use some regex or something along those lines to attempt to verify