SUBTASKS 1.1 :5 All tables should have a “name” column
I get this error when I have name column on all the tables I have been trying to fix it to no avail
SUBTASKS 1.1 :5 All tables should have a “name” column
I get this error when I have name column on all the tables I have been trying to fix it to no avail
post your sql dump here so we can check
– Dumped from database version 12.9 (Ubuntu 12.9-2.pgdg20.04+1)
– Dumped by pg_dump version 12.9 (Ubuntu 12.9-2.pgdg20.04+1)
SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET client_encoding = ‘UTF8’;
SET standard_conforming_strings = on;
SELECT pg_catalog.set_config(‘search_path’, ‘’, false);
SET check_function_bodies = false;
SET xmloption = content;
SET client_min_messages = warning;
SET row_security = off;
CREATE DATABASE universe WITH TEMPLATE = template0 ENCODING = ‘UTF8’ LC_COLLATE = ‘C.UTF-8’ LC_CTYPE = ‘C.UTF-8’;
ALTER DATABASE universe OWNER TO freecodecamp;
\connect universe
SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET client_encoding = ‘UTF8’;
SET standard_conforming_strings = on;
SELECT pg_catalog.set_config(‘search_path’, ‘’, false);
SET check_function_bodies = false;
SET xmloption = content;
SET client_min_messages = warning;
SET row_security = off;
SET default_tablespace = ‘’;
SET default_table_access_method = heap;
CREATE TABLE public.galaxy (
galaxy_id integer NOT NULL,
galaxy_type character varying(50),
name character varying(50) NOT NULL,
description text
);
ALTER TABLE public.galaxy OWNER TO freecodecamp;
CREATE SEQUENCE public.galaxy_galaxy_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.galaxy_galaxy_id_seq OWNER TO freecodecamp;
ALTER SEQUENCE public.galaxy_galaxy_id_seq OWNED BY public.galaxy.galaxy_id;
CREATE TABLE public.iinformation (
information_id integer NOT NULL,
information_level integer,
gravity integer
);
ALTER TABLE public.iinformation OWNER TO freecodecamp;
CREATE SEQUENCE public.iinformation_information_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.iinformation_information_id_seq OWNER TO freecodecamp;
ALTER SEQUENCE public.iinformation_information_id_seq OWNED BY public.iinformation.information_id;
CREATE TABLE public.information (
information_id integer NOT NULL,
information_level integer,
gravity integer,
name character varying(50)
);
ALTER TABLE public.information OWNER TO freecodecamp;
CREATE SEQUENCE public.information_information_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.information_information_id_seq OWNER TO freecodecamp;
ALTER SEQUENCE public.information_information_id_seq OWNED BY public.information.information_id;
CREATE TABLE public.moon (
moon_id integer NOT NULL,
name character varying(50) NOT NULL,
description text NOT NULL,
is_spherical boolean DEFAULT false,
planet_id integer NOT NULL
);
ALTER TABLE public.moon OWNER TO freecodecamp;
CREATE SEQUENCE public.moon_moon_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.moon_moon_id_seq OWNER TO freecodecamp;
ALTER SEQUENCE public.moon_moon_id_seq OWNED BY public.moon.moon_id;
CREATE TABLE public.planet (
planet_id integer NOT NULL,
name character varying(50) NOT NULL,
distance_from_earth numeric(6,3),
timetravel boolean DEFAULT false NOT NULL,
star_id integer NOT NULL
);
ALTER TABLE public.planet OWNER TO freecodecamp;
CREATE SEQUENCE public.planet_planet_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.planet_planet_id_seq OWNER TO freecodecamp;
ALTER SEQUENCE public.planet_planet_id_seq OWNED BY public.planet.planet_id;
CREATE TABLE public.star (
star_id integer NOT NULL,
radius integer NOT NULL,
name character varying(50),
color character varying(40) NOT NULL,
galaxy_id integer
);
ALTER TABLE public.star OWNER TO freecodecamp;
CREATE SEQUENCE public.star_star_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.star_star_id_seq OWNER TO freecodecamp;
ALTER SEQUENCE public.star_star_id_seq OWNED BY public.star.star_id;
ALTER TABLE ONLY public.galaxy ALTER COLUMN galaxy_id SET DEFAULT nextval(‘public.galaxy_galaxy_id_seq’::regclass);
ALTER TABLE ONLY public.iinformation ALTER COLUMN information_id SET DEFAULT nextval(‘public.iinformation_information_id_seq’::regclass);
ALTER TABLE ONLY public.information ALTER COLUMN information_id SET DEFAULT nextval(‘public.information_information_id_seq’::regclass);
ALTER TABLE ONLY public.moon ALTER COLUMN moon_id SET DEFAULT nextval(‘public.moon_moon_id_seq’::regclass);
ALTER TABLE ONLY public.planet ALTER COLUMN planet_id SET DEFAULT nextval(‘public.planet_planet_id_seq’::regclass);
ALTER TABLE ONLY public.star ALTER COLUMN star_id SET DEFAULT nextval(‘public.star_star_id_seq’::regclass);
SELECT pg_catalog.setval(‘public.galaxy_galaxy_id_seq’, 1, false);
SELECT pg_catalog.setval(‘public.iinformation_information_id_seq’, 1, false);
SELECT pg_catalog.setval(‘public.information_information_id_seq’, 1, false);
SELECT pg_catalog.setval(‘public.moon_moon_id_seq’, 1, false);
SELECT pg_catalog.setval(‘public.planet_planet_id_seq’, 1, false);
SELECT pg_catalog.setval(‘public.star_star_id_seq’, 1, false);
ALTER TABLE ONLY public.galaxy
ADD CONSTRAINT galaxy_pkey PRIMARY KEY (galaxy_id);
ALTER TABLE ONLY public.iinformation
ADD CONSTRAINT iinformation_pkey PRIMARY KEY (information_id);
ALTER TABLE ONLY public.information
ADD CONSTRAINT information_pkey PRIMARY KEY (information_id);
ALTER TABLE ONLY public.moon
ADD CONSTRAINT moon_description_key UNIQUE (description);
ALTER TABLE ONLY public.moon
ADD CONSTRAINT moon_pkey PRIMARY KEY (moon_id);
ALTER TABLE ONLY public.planet
ADD CONSTRAINT planet_pkey PRIMARY KEY (planet_id);
ALTER TABLE ONLY public.star
ADD CONSTRAINT star_pkey PRIMARY KEY (star_id);
ALTER TABLE ONLY public.star
ADD CONSTRAINT fk_galaxy FOREIGN KEY (galaxy_id) REFERENCES public.galaxy(galaxy_id);
ALTER TABLE ONLY public.moon
ADD CONSTRAINT fk_planet FOREIGN KEY (planet_id) REFERENCES public.planet(planet_id);
ALTER TABLE ONLY public.planet
ADD CONSTRAINT fk_star FOREIGN KEY (star_id) REFERENCES public.star(star_id);
this one doesn’t have a name column?
Try doing a \dt
to get a list of all the tables you have.
Then try doing a \d <table-name>
for each table in the list. This iinformation
seems to be the issue.
thanks so much I have deleted the table and I try to display the information table I am getting this error ERROR: catalog is missing 1 attribute(s) for relid 24662
universe=> what could be the problem
same for other tables and it shows I have it from \dt
Can someone help with my questions please
maybe restore from the dump and try again? The error suggests the database is corrupt but I don’t know how to help you troubleshoot.