I am new to databases and am a novice to programming in general. But I have a problem and this is the only way it seems to me it will work. I plan on learning the rest later. After I've created this program. To give you guys an idea of how naive I am. Please know that a lot of this just went over my head.
@Daniele if I can't use %s what can I use? The "%l" that Adrian suggested?
@Daniele What do you mean escaping values into identifier names?
@Adrian - I am Python string formatting? Whatt kind of string formatting. Which query should I format? The "Add a new column" query or the "add a value to the column of the currently entered record" query located right after it.
@Adrian - I don't think I understand what you mean by the example of the format() function. Am I supposed to use it in psql? But my program is in Python... Is there some manual where I could get more info on this and where I could see a few examples of this function?
@Karsten - I know, I got the feeling that the design felt awry as well. The database will be on the local machine. And the client side will have the code to error check the column names being added and also if there already is a column by this name or not.
On Thu, Mar 10, 2016 at 03:30:14PM +0100, Karsten Hilbert wrote:
> While this is a nice solution to OPs problem I cannot resist > the urge to point out that to me the whole approach of adding > a column from within client code (outside a database > management application) does have at least a whiff of design > smell to it.
Like, what happens if the user enters something to be used as a column name which isn't suitable for an identifier ?
And then what if two different unsuitable user input values get normalized into the same column-name-suitable version ?