Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;; Events Schema
- CREATE TABLE events
- (
- event_id serial ,
- title text NOT NULL,
- description text NOT NULL,
- photographers int[] ,
- tags int[] ,
- CONSTRAINT event_pk PRIMARY KEY(event_id)
- );
- ;; Notice that photographers and tags are integer ARRAY postgresql types.
- ;; Insert new event into 'events' table.
- (sql/insert! db
- :events {
- :title "My title"
- :description "A longer description here"
- :photographers [1 2 3]
- :tags ["tag1" "tag2" "tag3"]
- })
- ;; Another futile attempt, declaring a list, same error
- (sql/insert! db
- :events {
- :title "My title"
- :description "A longer description here"
- :photographers (list 1 2 3)
- :tags (list "tag1" "tag2" "tag3")
- })
- ;;org.postgresql.util.PSQLException: Can't infer the SQL type to use for an instance of clojure.lang.PersistentVector. Use setObject() with an explicit Types value to specify the type to use.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement