Hi,
First, I think this is an very good library and I have to thank you for releasing it. The documentation is exceptionally good, congratulations for your effort.
Second, I noticed that the ~ infix operator from PostgreSQL for regular expressions is not included in the def-infix-ops (file s-sql.lisp). I suppose that this is because it conflicts with the bitwise NOT operator with the same name, which is defined after a few lines.
For the time being, I just changed the bitwise NOT to :~~ and added the :~ to the def-infix-ops forms. Is this something you overlooked or is there another way to access regular expressions functionality?
Third, since I see you care about the documentation, I think you should point out in the documentation that the deftable form must define the table columns in the same order with its PostgreSQL counterpart, since you use the * abbreviation in the get-dao select statement. Otherwise, the get-dao does not work.
Finally, is there a way to access the constraints of an SQL table from the Lisp side? I have not managed to find anything related yet.
That's all for the time being. Once more, thank you very much for the library. Best regards,
Giorgos Pontikakis
Hello,
For the time being, I just changed the bitwise NOT to :~~ and added
the :~ to the def-infix-ops forms. Is this something you overlooked or is there another way to access regular expressions functionality?
Good question. I never really use the regexp functionality, so I didn't really think about this. It looks like regular expression matching always takes two arguments, while bitwise NOT only takes one, so I think a good solution would be to make that operator behave like minus and allow both binary infix and unary prefix application. I'll add the other regexp operators (~*, !~, and !~*) too, while I'm at it.
Third, since I see you care about the documentation, I think you
should point out in the documentation that the deftable form must define the table columns in the same order with its PostgreSQL counterpart, since you use the * abbreviation in the get-dao select statement. Otherwise, the get-dao does not work.
You have a point there. I assumed people would create their tables from the lisp definition, in which case everything works fine. This will probably also be an issue when you end up adding or dropping rows in tables -- the best solution is probably to fix dao-loading so that it takes column names into account. This might make it a bit slower, but right now it's just confusing. I'll try to fix this this week.
Finally, is there a way to access the constraints of an SQL table from
the Lisp side? I have not managed to find anything related yet.
No, though this is something that I definitely want to add. Unfortunately I'm a bit tied up with other work at the moment, so it might take a while. If you feel up to it, a patch would be welcome.
Regards, Marijn
I released verion .21, which should solve your first two problems. Haven't quite decided on the syntax for foreign keys, maybe :create-table can look like defclass too:
(:create-table 'my-table ((slot-a :type integer :foreign-key (my-other-table id) :default 55) (slot-b :type (or null (string 24))) (:primary-key slot-a) (:foreign-key (slot-a slot-b) (yet-another-table a b) (:unique-index slot-b)) ;; Not really part of CREATE TABLE, but hey, why not?
Then deftable doesn't have to do as much transforming on the definition and can remain simple.
Also, I'm not sure how to handle the creation of a set of tables that contain foreign keys -- since they have to be created in the right order. Altering them is even more tricky. Maybe I'll default to deferrable foreign keys, and turn on deferring when messing with the table scheme.
Let me know what you think.
Marijn
postmodern-devel@common-lisp.net