Re Database Toolbox: quicker way to determine read-only columns
1 view (last 30 days)
Show older comments
Hi! I'm writing an automated database application, including automated inserts and updates; I'm trying to anticipate and deal with "failure modes" before they happen, rather than after. :-) Accordingly, I'd like to ensure that the program doesn't try to insert to/update read-only columns (e.g., primary keys); I've figured out how to do this by creating a cursor, querying the column(s) in question, and then examining its (their) attributes, but this seems like a lot of overhead, especially w.r.t. its time requirement. Before I figured out that way to do it, I spent quite a bit of time unsuccessfully trying to figure out if there was some object, method, or property associated w/ the database object (or one of its children) which either already had or quickly generated a list of primary keys (or, more generally, read-only columns). However, not really knowing what there might be, let me pose the question rather generally: is there a quicker and/or more elegant way to either generate a global list of read-only columns and/or determine if any given column is read-only? Thanks!
0 Comments
Answers (1)
the cyclist
on 30 Dec 2011
I am by no means an expert in this, and I do not know the specific answer to your question. However, I know that in PostgreSQL, there are "metatables" that contain information about the tables in the database. Here is a web page that shows how to find various bits of information about a PostgreSQL database. It looks like some of the comments talk about finding primary keys.
Since your question doesn't really have anything to do with MATLAB, you might be better off finding a forum that covers database questions.
See Also
Categories
Find more on Database Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!