postgres table query not getting all names

Bob Sneidar bobsneidar at iotecdigital.com
Sun Jul 16 15:25:43 EDT 2017


If there is a built in function for getting the schema of the particular database, I would use that. For instance you can query sqLite master database for a list of tables using:

SELECT * FROM my_db.sqlite_master

mySQL can be queried using SHOW TABLES

Googling this indicates that for postgres the syntax is:

SELECT table_name FROM information_schema.tables WHERE table_schema='public' AND table_type='BASE TABLE';

Bob S

> On Jul 14, 2017, at 16:13 , Mark Wieder via use-livecode <use-livecode at lists.runrev.com> wrote:
> 
> On 07/14/2017 03:48 PM, Dr. Hawkins via use-livecode wrote:
>> Sometime  ago, I wrote my own getTableNames() because
>> revDatabaseTableNames() would consistently fail to find them all.
>> Now, it to is filing.
>> It is, in essence,
>> *put* "SELECT table_name FROM information_schema.tables ;" \
>> & cr into dcmd
>> *put* revDataFromQuery(,cr,db,dcmd) into tabList
>> *return* tabList
>> I have another chunk of code which is now acting up:
>> *put* getTableNames(dhbkSrvrDb) into dhSrvTbls
>> *put* "dhStatTbl" into dhtbl_stat
>> *if* dhtbl_stat is not among the words of dhSrvTbls *then*
>> *put* "CREATE TABLE " & dhtbl_stat  . . . blah blah blah
>> table dhStatTbl already exists, yet the conditional is reached.  It
>> executes, and throws an error because this table is already there.
>> This is, to be mild, a brutal bug.
>> Might there be something I'm missing?
> 
> Just a guess, but the concept of 'word' is pretty slippery.
> You might try 'true words' or make a comma-separated list and look among the items or...
> 
> -- 
> Mark Wieder
> ahsoftware at gmail.com
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode





More information about the use-livecode mailing list