Skip to content

Datetime type storing empty string for "0001-01-01T00:00:00Z" #5364

@arijitAD

Description

@arijitAD

What version of Dgraph are you using?

master

Have you tried reproducing the issue with the latest release?

Yes

What is the hardware spec (RAM, OS)?

32 GB Ubuntu Linux

Steps to reproduce the issue (command/config used to run Dgraph).

Mutation

{
  "set": [
    {
      "created_at": "0000-01-01T00:00:00Z"
    },
    {
      "created_at": "0001-01-01T00:00:00Z"
    },
    {
      "created_at": "0002-01-01T00:00:00Z"
    },
    {
      "created_at": "0003-01-01T00:00:00Z"
    },
    {
      "created_at": "0001-02-02T00:00:00Z"
    }
    ]
}

Query

{
  q(func: has(created_at)) {
    uid
    created_at
  }
}

Expected behavior and actual result.

Expected:

{
    "data": {
		"q": [
		  {
			"uid": "0x18",
			"created_at": "0000-01-01T00:00:00Z"
		  },
		  {
			"uid": "0x19",
			"created_at": "0001-01-01T00:00:00Z"
		  },
		  {
			"uid": "0x1a",
			"created_at": "0002-01-01T00:00:00Z"
		  },
		  {
			"uid": "0x1b",
			"created_at": "0003-01-01T00:00:00Z"
		  },
		  {
			"uid": "0x1c",
			"created_at": "0001-02-02T00:00:00Z"
		  }
		]
    }
}

Actual:

{
    "data": {
		"q": [
		  {
			"uid": "0x18",
			"created_at": "0000-01-01T00:00:00Z"
		  },
		  {
			"uid": "0x19",
			"created_at": ""
		  },
		  {
			"uid": "0x1a",
			"created_at": "0002-01-01T00:00:00Z"
		  },
		  {
			"uid": "0x1b",
			"created_at": "0003-01-01T00:00:00Z"
		  },
		  {
			"uid": "0x1c",
			"created_at": "0001-02-02T00:00:00Z"
		  }
		]
    }
}

Reference:
https://discuss.dgraph.io/t/datetime-type-storing-empty-string-for-0001-01-01t0000z/6276/3

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugSomething is broken.status/acceptedWe accept to investigate/work on it.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions