Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
Repo info
    What's new in 10 that's relevant?
    Andrzej Sołtysik
    Hi, does anyone know how to use aggregate functions like mode with a groupedBy query?
    mode().within expects ColumnOrdered but I have a Seq from the groupBy
    Andrzej Sołtysik

    In short I want to translate a sql like this:

    SELECT a.id, mode() WITHIN GROUP (ORDER BY b.id) 
    FROM a INNER JOIN b on a.id = b.a_id
    GROUP BY a.id

    into Slick

    Tom Wang
    @nafg I do not think there's anything in pg 10 that is relevant for slick-pg. It's just that slick-pg is tested with pg 10.
    But what's your concern
    Tom Wang
    My original concern was that the newest slick-pg would not work with pg 9.6. I think that concern has been addressed.
    Łukasz Dycjan
    Hi, do you know if there is a way of using date support while having value classes as column types rather than pure date types (case class extending AnyVal)?
    Tor Holm
    Hi, is it possible to have an array of jsonb elements?
    I use play-json for serde
    @holm.tor_gitlab did you have any particular trouble?
    Hmm I see, it seems array support is hardcoded for specific element types, although it looks easy to add more
    But why would you use array when you can you json array?
    @holm.tor_gitlab here is what I did:
      implicit val componentKindsMapping: SlickDriver.SimpleArrayJdbcType[ComponentKind] =
        new SimpleArrayJdbcType[String]("text").mapTo[ComponentKind](ComponentKind(_), _.name)
    Pyry-Samuli Lahti

    Howdy! I'm trying to write a join based on array using slick-pg:

    SELECT * FROM foos f JOIN bars b ON b.identifiers @> array[f.identifier]::text[]

    But I cannot find a way to do that array[f.identifier]::text[] part in Slick. Any tips?

    So in the example above, column bars.identifiers is of type text[], and column foos.identifier is type varchar(254).
    Gavin Bisesi
    you could always use sql if you don't need to compose Query objects
    Pyry-Samuli Lahti
    Yeah, that would be my fallback. But in my use-case I’m joining many tables. Would like to use type-safe approach, if at all possible.
    Francesco Levorato
    Hi everyone!
    I'm trying to upgrade my project to slick 3.3.0, so I set slick-pg to 0.17.2 but unfortunately in slick-pg 0.17.1 a few deps including json4s were upgraded to latest version. Alas json4s 3.6.x versions have a longstanding bug for case classes with type constructors (json4s/json4s#507). My project also dependes on json4s and thus breaks when upgrading. Is there anyway this dependency hell can be circumvented?
    Gavin Bisesi
    @flevour if slick-pg is using only things that are binary compatible with the old one, it should work to add an exclude to your build.sbt
    but also you might not need to bump slick-pg
    Francesco Levorato
    @Daenyth even if a bit late, I want to send you a wholehearted thanks for pointing towards SBT's exclude directive! That's what I needed to get this sorted out. Thanks a lot!
    Gavin Bisesi
    hey guys, is there any good documentation on how to get started with slick-pg?
    If i use the sample on the readme i get a lot of not defined types

    `import com.github.tminglei.slickpg._

    trait MyPostgresDriver
    extends ExPostgresProfile
    with PgArraySupport
    with PgDateSupportJoda
    with PgEnumSupport
    with PgRangeSupport
    with PgHStoreSupport
    with PgSearchSupport
    with PgPostGISSupport {

    override val api = new MyAPI {}

    trait MyAPI
    extends API
    with ArrayImplicits
    with DateTimeImplicits
    with RangeImplicits
    with HStoreImplicits
    with SearchImplicits
    with PostGISImplicits
    with SearchAssistants

    object MyPostgresDriver extends MyPostgresDriver`

    Bascially none of the PG types here are found.

    Gavin Bisesi
    Did you import MyPostgresDriver.api._ ?
    No i did not ... but the api is defined in this file itself no?
    Gavin Bisesi
    sure, but your db tables etc won't be
    queries, etc
    I see, I will import them in the tables.
    hey guys, so i used the examples form github and kinda got things to compile
    However, when actually querying, i run into a problem
    org.postgresql.util.PSQLException: ERROR: function st_dwithin(point, bytea, double precision) does not exist [info] Hint: No function matches the given name and argument types. You might need to add explicit type casts. [info] Position: 140
    Here is my call into slick-pg:
    def byDistance(point: Point, distance: Double): Future[Seq[House]] = db run { houses .filter(r => r.location.dWithin(point.bind, distance.bind)) .result .map(t => t) }
    Can anyone please help me figure out what is going on?
    Another error I am getting when writing to the db is shown below. Can anyone please point out if i am doing anything wrong:
    due to: org.postgresql.util.PSQLException: ERROR: column "location" is of type point but expression is of type bytea [info] Hint: You will need to rewrite or cast the expression. [info] Position: 157
    Is my column type in the database not supposed to be of type point?
    Nader Ghanbari
    Hi, thanks for creating this awesome project! I'm using it and everything works fine just a minor question. Is there a way to get ST_Distance(geom1, geom2, spheroid=true) with slick-pg? The distance function does not support the boolean flag.
    def distance[P2, R](geom: Rep[P2])(implicit om: o#to[Float, R]) = {
      om.column(GeomLibrary.Distance, n, geom.toNode)
    I coudln't find any GH issue related to this. If this is the case, is a PR welcome?
    Rutvik Patel
    Hey folks, need your help with tsquery/tsvector. My question is related to postgresql, than slick-pg. But I assume, you folks can help me with that as well. :)
    Rather than repeating myself here, I'll post my https://twitter.com/heyrutvik/status/1182521309991002112 which describes the problem of using <-> with hyphened string in to_tsquery function.
    Please take a look, thanks!
    does the makePoint() function use lat,lon or lon,lat ordering of the coordinates?
    hello, is there a way I use postgis ST_Extent?
    hi can I do with slick such query
    drop table if exists orders cascade;
    CREATE TABLE orders (
      info json NOT NULL
    INSERT INTO orders (info)
    ('{"interestedIn":[11],"countries":["IT", "UK"]}'),
    ('{"interestedIn":[12],"countries":["US", "UK"]}'),
    ('{"interestedIn":[14,15,16],"countries":["DE", "UK"]}');
    select *
    from orders
    where info::jsonb -> 'countries' ? 'US'
    Jethro Gillgren

    Hi All, we're trying to get upserts working with slick. Trying to use slick-pg to enable this, but we can't find how to access the new methods. We created our own profile that extends ExPostgresProfile, and it looks like it's configured OK in application.conf. We replaced import profile.api._ with import MySlickPostgresProfile.api._

    However, our methods that use testtable.insertOrUpdate still seems to use the old version, and .insertOrUpdateAll isn't found. Is there some weird implicit scala thing we need to do?

    Ivano Pagano
    Hello to everyone here, I'm trying to check if anyone can confirm that generating the slick's database model with the codegen tool might fail to compile when using custom postgres [slick-pg-supported] types
    I's thinking of defining a custom sbt task using a modified version of the generator that would be based on the pg-driver class... but I'm not yet convinced that this might solve the issue, or if the issue is even related to that...