Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Postgres types are not recognized? #38

Open
pyrossh opened this issue Oct 20, 2015 · 10 comments
Open

Postgres types are not recognized? #38

pyrossh opened this issue Oct 20, 2015 · 10 comments

Comments

@pyrossh
Copy link

pyrossh commented Oct 20, 2015

This is my column data

{ tableName: 'users',
  columnName: 'id',
  ordinalPosition: 1,
  isNullable: 'NO',
  dataType: 'character varying',
  udtName: 'varchar',
  columnKey: 'PRI',
  columnType: null }

And this is the error I get

nhandled rejection Error: Type "character varying" not recognized
    at getType (/home/playlyfer-4/.nvm/v0.10.40/lib/node_modules/sql-to-graphql/steps/column-to-object.js:127:19)
@rexxars
Copy link
Owner

rexxars commented Oct 20, 2015

Thanks for the report. Postgres adapter has a few issues right now, indeed. I'll see if I can look into it later today.

@pyrossh
Copy link
Author

pyrossh commented Oct 20, 2015

Man That was fast.. 🐎

@pyrossh
Copy link
Author

pyrossh commented Oct 20, 2015

Fixed the character varying type but then,
Ok I use custom domains for column types like

CREATE DOMAIN Name      VARCHAR(100)   NOT NULL;

This might be harder than I thought

{ tableName: 'users',
  columnName: 'name',
  ordinalPosition: 2,
  isNullable: 'YES',
  dataType: 'name',
  udtName: 'name',
  columnKey: null,
  columnType: null }
Unhandled rejection Error: Type "name" not recognized

needs a little research..

@heri
Copy link

heri commented Nov 3, 2015

I was looking to use this but "json" type is also not supported

@tjwebb
Copy link

tjwebb commented Feb 28, 2016

@heri the authors wrote thousands and thousands of lines of code for this project and published it for you for free. Maybe you can take some time to add support for the json type in postgres.

@heri
Copy link

heri commented Feb 28, 2016

Hi @tjwebb I'll look into it and see what I can do -- however I have already transformed my db into graphql by hand.

@sheki
Copy link

sheki commented Mar 11, 2016

This fails with, "timestamp with time zone" I am assuming the postgres support is not great.

@rexxars
Copy link
Owner

rexxars commented Mar 11, 2016

@sheki This is true. I don't have any personal projects using Postgres, so there are probably several issues related to Postgres.

I'd be willing to take a look at a basic fix for data types if someone can provide me with:

  • A simple schema with the data type
  • A few rows of sample data for it
  • Some thoughts on the preferred way of exposing this through GraphQL - whether it be a custom data type, cooerce to a primitive etc.

@daniellmorris
Copy link

daniellmorris commented Apr 5, 2017

One more type I would recommend for postgreSQL is to add the type 'timestamp without time zone'. I fixed it locally on my system by adding the line
case 'timestamp without time zone':
Just after the line
case 'timestamp with time zone':
in steps/column-to-object.js

@shaunc
Copy link

shaunc commented Jul 22, 2018

NB -- citext also causes a problem:

$ sql2graphql ...
SELECT enum_range(NULL::citext) AS citext - function enum_range(citext) does not exist

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

No branches or pull requests

7 participants