• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3825
  • Last Modified:

Creating a View ERROR: column "name" specified more than once

I'm trying to create a view in postgresql so that my Zen dFramework app can query it.

I get the following error

ERROR:  column "name" specified more than once

I'm not quite sure what my options are to fix the problem.

CREATE VIEW "v_itemshort" AS SELECT "public"."t_item_types"."name",
 "public"."t_items"."id", "public"."t_items"."serial", "public"."t_items"."nickname",
 "public"."t_sites"."name", "public"."t_status"."name"
 FROM "public"."t_items" INNER JOIN "public"."t_status"
 ON ("public"."t_items"."status_id" = "public"."t_status"."id")
 INNER JOIN "public"."t_sites"
 ON ("public"."t_items"."site_id" = "public"."t_sites"."id")
 INNER JOIN "public"."t_item_types" ON ("public"."t_items"."type_id" = "public"."t_item_types"."id")

Open in new window

1 Solution
Hello Friend
The Error is Correct as you have specified the name column thrice while creating your view and therefore the error is, IN case of this you have to give an alias to the other two name columns you specify while creating your view, as the view you have shown may be the correct format should be as follows:
CREATE VIEW "v_itemshort" AS 
SELECT "public"."t_item_types"."name",
 "public"."t_items"."id", "public"."t_items"."serial", "public"."t_items"."nickname",
 "public"."t_sites"."name" As Name1, "public"."t_status"."name" As Name2
 FROM "public"."t_items"
 INNER JOIN "public"."t_status" ON ("public"."t_items"."status_id" = "public"."t_status"."id")
 INNER JOIN "public"."t_sites" ON ("public"."t_items"."site_id" = "public"."t_sites"."id")
 INNER JOIN "public"."t_item_types" ON ("public"."t_items"."type_id" = "public"."t_item_types"."id")

Open in new window

sean-keysAuthor Commented:
Thanks buddy.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now