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

Decimal / Numeric Postgres fields return null value in operations #1381

Closed
a11dev opened this issue Apr 24, 2024 · 1 comment
Closed

Decimal / Numeric Postgres fields return null value in operations #1381

a11dev opened this issue Apr 24, 2024 · 1 comment

Comments

@a11dev
Copy link

a11dev commented Apr 24, 2024

Description

When attempting to access the value of a numeric (decimal) field with Prisma Data store / Postgres, the field always returns null in all operation types. If the returned field is the table pk the output is an array of null.

Same as [Decimal / Numeric Postgres fields return null value in operations] #1166).

Reproduction

Create a postgres table:

CREATE TABLE "TasksRemap" (
    key Numeric PRIMARY KEY,
    field1 VARCHAR(255),
    field2 DATE,
    field3 NUMERIC
);

insert some value

INSERT INTO TasksRemap (field1, field2, field3) VALUES
(1,'String1', '2024-04-01', 100),
(2,'String2', '2024-04-02', 200),
(3,'String3', '2024-04-03', 300),
(4,'String4', '2024-04-04', 400),
(5,'String5', '2024-04-05', 500);

from the wundergraph nextjs example:

defining the datasource into .wundergraph\wundergraph.config.ts
mine:

const dbpg = introspect.postgresql({
	apiNamespace: 'dbpg',
	databaseURL: 'postgresql://user:password@address:5432/dbname?schema=public',
	introspection: {
		disableCache: true,
	  },
	  replaceCustomScalarTypeFields: [
		
		{
			entityName: 'TasksRemap',
			fieldName: 'field3',
			responseTypeReplacement: 'Float', // or 'String'
		  }
			
	  ]
});
npm run build:wundergraph

define a TaskList.graphql operation like:

query {
    dbpg_findManyTasksRemap {
        key
        field1
        field2 
        field3
    }
}

run the application and the server:

npm run start 

( "start": "run-p dev wundergraph open")

Copy link

stale bot commented Jun 23, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the meta: stale label Jun 23, 2024
@stale stale bot closed this as completed Jul 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant