'How can I convert the postgres name type to a go type?

I am getting this error trying to scan in postgres rows.

can't scan into dest[0]: unknown oid 1003 cannot be scanned into string

This is the code I that throws that error.

sourceKeys := make([]string, 0, 1)
    targetSchema := ""
    targetTable := ""
    targetKeys := make([]string, 0, 1)

    fks := make([]ForeignKey, 0)
    for rows.Next() {
        err := rows.Scan(
            sourceKeys,
            &targetSchema,
            &targetTable,
            targetKeys,
        )
    }
   …….
}

When I look at postgres documentation (https://pkg.go.dev/github.com/lib/pq/oid) I can see that oid=1003 is for T__name types. How can I read in a name without using the pq library?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source