Home > Software design >  Table and composite type with same name select problem
Table and composite type with same name select problem

Time:02-04

I have a composite data type with the same name as a table. When I select from the table with same name as composite type postgres shows an error that says " is a composite type". There by I cannot select from table. What can I do to tell postgres that I'm selecting from table and not composite data type?

CodePudding user response:

A table and a composite type cannot have the same name unless they are in different schemas, because they share a name space (indexes, views and sequences share the same namespace).

Since the type and the table must be in different schemas, you can reference the table by qualifying it with the schema name: schema_name.table_name

  •  Tags:  
  • Related