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

Add primary key config to tableInfo #173

Merged
merged 1 commit into from
Sep 1, 2020
Merged

Add primary key config to tableInfo #173

merged 1 commit into from
Sep 1, 2020

Conversation

asdine
Copy link
Collaborator

@asdine asdine commented Aug 30, 2020

This PR fixes how the pk() function works with __genji_tables.
It adds information about the primary key of that table, so that pk can pick it up correctly.

Before:

genji> create table foo;
genji> create table bar(a integer);
genji> SELECT pk(), * from __genji_tables;
json: error calling MarshalJSON for type document.jsonDocument: cannot decode buffer to uint64

After:

genji> create table foo;
genji> create table bar(a integer);
genji> SELECT pk(), * from __genji_tables;
{
  "pk()": "bar",
  "table_name": "bar",
  "store_id": "dF9LVloqBA==",
  "field_constraints": [
    {
      "path": [
        "a"
      ],
      "type": 16,
      "is_primary_key": false,
      "is_not_null": false
    }
  ],
  "read_only": false
}
{
  "pk()": "foo",
  "table_name": "foo",
  "store_id": "dF9LVlljTQ==",
  "field_constraints": [],
  "read_only": false
}

@asdine asdine added the bug Something isn't working label Aug 30, 2020
@asdine asdine added this to the v0.7.1 milestone Aug 30, 2020
@asdine asdine requested a review from yaziine August 30, 2020 07:37
@asdine asdine merged commit 5bb6b1f into master Sep 1, 2020
@asdine asdine deleted the fix-table-info-pk branch September 1, 2020 16:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant