Skip to content
This repository was archived by the owner on Jul 12, 2025. It is now read-only.
This repository was archived by the owner on Jul 12, 2025. It is now read-only.

Set a ValueTranscoder from the same type errors #161

Open

Description

@jschaf

I'm trying to generate code to handle a composite type that contains a pgtype.Interval: jschaf/pggen#49. The main issue seems to be that pgtype doesn't support Set with the same type. This test case shows the error:

func TestPgtype_Interval(t *testing.T) {
	v1 := pgtype.Interval{Days: 2, Status: pgtype.Present}
	v2 := pgtype.Interval{Days: 2, Status: pgtype.Present}
	err := v1.Set(v2)
	require.NoError(t, err) // Received unexpected error: cannot convert {0 2 0 2} to Interval
}

Two questions:

  1. Is it reasonable to support Set from the same type? Get returns the same type so it'd have a nice symmetry.
  2. Would you take a PR for this feature?

Activity

  1. jackc commented on May 23, 2022

    @jackc
    Owner

    Seems reasonable.

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

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions