Skip to content
This repository has been archived by the owner on Aug 31, 2022. It is now read-only.

Type double does not exist on Postgres #41

Closed
yaghmr opened this issue Feb 11, 2014 · 6 comments
Closed

Type double does not exist on Postgres #41

yaghmr opened this issue Feb 11, 2014 · 6 comments

Comments

@yaghmr
Copy link

yaghmr commented Feb 11, 2014

Hi,
I have a class like this

case class Geocoding(city: String, latitude: Double, longitude: Double)

and this SORM initialization:

object Db extends Instance (
  entities = Set(
    Entity[Geocoding](unique = Set() + Seq("city", "latitude", "longitude"), indexed = Set() + Seq("city") + Seq("latitude", "longitude")),
  url = "jdbc:postgresql://localhost:5432/common_data",
  initMode = InitMode.Create,
  poolSize = 20
)

using Postgresql (driver version: 9.1-901.jdbc4)
SORM try to create the table with this SQL code:

| CREATE TABLE "geocoding"  
|   ( "id" BIGSERIAL NOT NULL,
|     "longitude" DOUBLE NOT NULL,
|     "latitude" DOUBLE NOT NULL,
|     "city" VARCHAR(255) NOT NULL,
|     PRIMARY KEY ("id"),
|     UNIQUE ("city", "latitude", "longitude") )

with version <= 0.3.8 the geocoding table is not create silently
with version 0.3.13 i get

java.lang.ExceptionInInitializerError: null
...
Caused by: org.postgresql.util.PSQLException: ERROR: type "double" does not exist

The error is caused by "DOUBLE" type,
Postgres have instead "DOUBLE PRECISION" type.

nikita-volkov added a commit that referenced this issue Feb 11, 2014
* 0.3:
  release
  Fix Postgres Double support (#41)
  Bump version

Conflicts:
	README.md
	pom.xml
@nikita-volkov
Copy link
Contributor

Thanks for the report. Fixed in 0.3.15.

@zarinfam
Copy link

We use Slick 3.1 and it generate wrong create statements for Double PostgreSQL column, it generate DOUBLE instead of double precision !

@aguestuser
Copy link

seeing the same problem as @zarinfam any suggestions?

@aguestuser
Copy link

nevermind! resolved our issue.

@zarinfam: one possible gotcha that tricked us up and you might want to watch out for -- the source of our bug was namespace collisions between an import of slick's H2 DSL (import slick.driver.H2Driver.api._) and its Postgres driver (import slick.driver.PostgresDriver.api._) which caused calls to column[Double] in our Table declaration code to pick up on H2Driver.api's notion of Doubles rather than PostgresDriver.api's. Not sure if this might be the cause of your bug, but perhaps worth a quick sanity check just to make sure?

@zarinfam
Copy link

@aguestuser You were right and the bug was for namespace collisions. thanks.

@willemvermeer
Copy link

Thanks @aguestuser made the same mistake today - thanks for reporting back the root cause.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants