Skip to content

Support MACADDR in Postgres #163

Closed

Activity

  1. added
    enhancement
    good first issue
    db:postgres
    on Mar 26, 2020
  2. abonander commented on Mar 31, 2020

    @abonander
    Collaborator

    Type OID: 829
    Array type OID: 1040

    https://github.com/postgres/postgres/blob/master/src/include/catalog/pg_type.dat#L244-L248

    Binary format: i8 i8 i8 i8 i8 i8 (literally just 6 bytes, can pass this straight to MacAddress::new())
    https://github.com/postgres/postgres/blob/master/src/backend/utils/adt/mac.c#L161

    Use mac_address::MacAddress::from_str to parse the text format.

    We can also support the EUI format which is just 8 literal bytes:
    https://github.com/postgres/postgres/blob/master/src/include/catalog/pg_type.dat#L260-L264
    https://github.com/postgres/postgres/blob/master/src/backend/utils/adt/mac8.c#L295

    However, mac_address doesn't support the extended format so we can't do parsing of the text format. Maybe we should just implement our own wrappers instead; it wouldn't be that difficult.

  3. mehcode commented on Mar 31, 2020

    @mehcode
    ContributorAuthor
  4. abonander commented on Mar 31, 2020

    @abonander
    Collaborator

    The MacAddress type in that crate is still just the 48-bit addresses though.

  5. EverWinter23 commented on May 21, 2020

    @EverWinter23

    From @mehcode on discord:

    • Postgres supports both macaddr and macaddr8 type
    • rust-postgres driver however only supports macaddr type using the eui48 crate
    • eui48 and mac_address crates only support the 6-byte macaddr type

    Recommended way-- would be to implement support for macaddr using either eui48 or mac_address (no preference).

    If we want to support macaddr8, we should add support for the type to the crate that was used.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    E-easydb:postgresenhancementgood first issue

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions