Celestial Bodies Database

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

thank you this it

– PostgreSQL database dump

– 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;

DROP DATABASE universe;

– Name: universe; Type: DATABASE; Schema: -; Owner: freecodecamp

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;


– Name: galaxy; Type: TABLE; Schema: public; Owner: freecodecamp

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;


– Name: galaxy_galaxy_id_seq; Type: SEQUENCE; Schema: public; Owner: 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;


– Name: galaxy_galaxy_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: freecodecamp

ALTER SEQUENCE public.galaxy_galaxy_id_seq OWNED BY public.galaxy.galaxy_id;


– Name: iinformation; Type: TABLE; Schema: public; Owner: freecodecamp

CREATE TABLE public.iinformation (
information_id integer NOT NULL,
information_level integer,
gravity integer
);

ALTER TABLE public.iinformation OWNER TO freecodecamp;


– Name: iinformation_information_id_seq; Type: SEQUENCE; Schema: public; Owner: 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;


– Name: iinformation_information_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: freecodecamp

ALTER SEQUENCE public.iinformation_information_id_seq OWNED BY public.iinformation.information_id;


– Name: information; Type: TABLE; Schema: public; Owner: freecodecamp

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;


– Name: information_information_id_seq; Type: SEQUENCE; Schema: public; Owner: 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;


– Name: information_information_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: freecodecamp

ALTER SEQUENCE public.information_information_id_seq OWNED BY public.information.information_id;


– Name: moon; Type: TABLE; Schema: public; Owner: freecodecamp

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;


– Name: moon_moon_id_seq; Type: SEQUENCE; Schema: public; Owner: 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;


– Name: moon_moon_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: freecodecamp

ALTER SEQUENCE public.moon_moon_id_seq OWNED BY public.moon.moon_id;


– Name: planet; Type: TABLE; Schema: public; Owner: freecodecamp

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;


– Name: planet_planet_id_seq; Type: SEQUENCE; Schema: public; Owner: 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;


– Name: planet_planet_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: freecodecamp

ALTER SEQUENCE public.planet_planet_id_seq OWNED BY public.planet.planet_id;


– Name: star; Type: TABLE; Schema: public; Owner: freecodecamp

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;


– Name: star_star_id_seq; Type: SEQUENCE; Schema: public; Owner: 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;


– Name: star_star_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: freecodecamp

ALTER SEQUENCE public.star_star_id_seq OWNED BY public.star.star_id;


– Name: galaxy galaxy_id; Type: DEFAULT; Schema: public; Owner: freecodecamp

ALTER TABLE ONLY public.galaxy ALTER COLUMN galaxy_id SET DEFAULT nextval(‘public.galaxy_galaxy_id_seq’::regclass);


– Name: iinformation information_id; Type: DEFAULT; Schema: public; Owner: freecodecamp

ALTER TABLE ONLY public.iinformation ALTER COLUMN information_id SET DEFAULT nextval(‘public.iinformation_information_id_seq’::regclass);


– Name: information information_id; Type: DEFAULT; Schema: public; Owner: freecodecamp

ALTER TABLE ONLY public.information ALTER COLUMN information_id SET DEFAULT nextval(‘public.information_information_id_seq’::regclass);


– Name: moon moon_id; Type: DEFAULT; Schema: public; Owner: freecodecamp

ALTER TABLE ONLY public.moon ALTER COLUMN moon_id SET DEFAULT nextval(‘public.moon_moon_id_seq’::regclass);


– Name: planet planet_id; Type: DEFAULT; Schema: public; Owner: freecodecamp

ALTER TABLE ONLY public.planet ALTER COLUMN planet_id SET DEFAULT nextval(‘public.planet_planet_id_seq’::regclass);


– Name: star star_id; Type: DEFAULT; Schema: public; Owner: freecodecamp

ALTER TABLE ONLY public.star ALTER COLUMN star_id SET DEFAULT nextval(‘public.star_star_id_seq’::regclass);


– Data for Name: galaxy; Type: TABLE DATA; Schema: public; Owner: freecodecamp


– Data for Name: iinformation; Type: TABLE DATA; Schema: public; Owner: freecodecamp


– Data for Name: information; Type: TABLE DATA; Schema: public; Owner: freecodecamp


– Data for Name: moon; Type: TABLE DATA; Schema: public; Owner: freecodecamp


– Data for Name: planet; Type: TABLE DATA; Schema: public; Owner: freecodecamp


– Data for Name: star; Type: TABLE DATA; Schema: public; Owner: freecodecamp


– Name: galaxy_galaxy_id_seq; Type: SEQUENCE SET; Schema: public; Owner: freecodecamp

SELECT pg_catalog.setval(‘public.galaxy_galaxy_id_seq’, 1, false);


– Name: iinformation_information_id_seq; Type: SEQUENCE SET; Schema: public; Owner: freecodecamp

SELECT pg_catalog.setval(‘public.iinformation_information_id_seq’, 1, false);


– Name: information_information_id_seq; Type: SEQUENCE SET; Schema: public; Owner: freecodecamp

SELECT pg_catalog.setval(‘public.information_information_id_seq’, 1, false);


– Name: moon_moon_id_seq; Type: SEQUENCE SET; Schema: public; Owner: freecodecamp

SELECT pg_catalog.setval(‘public.moon_moon_id_seq’, 1, false);


– Name: planet_planet_id_seq; Type: SEQUENCE SET; Schema: public; Owner: freecodecamp

SELECT pg_catalog.setval(‘public.planet_planet_id_seq’, 1, false);


– Name: star_star_id_seq; Type: SEQUENCE SET; Schema: public; Owner: freecodecamp

SELECT pg_catalog.setval(‘public.star_star_id_seq’, 1, false);


– Name: galaxy galaxy_pkey; Type: CONSTRAINT; Schema: public; Owner: freecodecamp

ALTER TABLE ONLY public.galaxy
ADD CONSTRAINT galaxy_pkey PRIMARY KEY (galaxy_id);


– Name: iinformation iinformation_pkey; Type: CONSTRAINT; Schema: public; Owner: freecodecamp

ALTER TABLE ONLY public.iinformation
ADD CONSTRAINT iinformation_pkey PRIMARY KEY (information_id);


– Name: information information_pkey; Type: CONSTRAINT; Schema: public; Owner: freecodecamp

ALTER TABLE ONLY public.information
ADD CONSTRAINT information_pkey PRIMARY KEY (information_id);


– Name: moon moon_description_key; Type: CONSTRAINT; Schema: public; Owner: freecodecamp

ALTER TABLE ONLY public.moon
ADD CONSTRAINT moon_description_key UNIQUE (description);


– Name: moon moon_pkey; Type: CONSTRAINT; Schema: public; Owner: freecodecamp

ALTER TABLE ONLY public.moon
ADD CONSTRAINT moon_pkey PRIMARY KEY (moon_id);


– Name: planet planet_pkey; Type: CONSTRAINT; Schema: public; Owner: freecodecamp

ALTER TABLE ONLY public.planet
ADD CONSTRAINT planet_pkey PRIMARY KEY (planet_id);


– Name: star star_pkey; Type: CONSTRAINT; Schema: public; Owner: freecodecamp

ALTER TABLE ONLY public.star
ADD CONSTRAINT star_pkey PRIMARY KEY (star_id);


– Name: star fk_galaxy; Type: FK CONSTRAINT; Schema: public; Owner: freecodecamp

ALTER TABLE ONLY public.star
ADD CONSTRAINT fk_galaxy FOREIGN KEY (galaxy_id) REFERENCES public.galaxy(galaxy_id);


– Name: moon fk_planet; Type: FK CONSTRAINT; Schema: public; Owner: freecodecamp

ALTER TABLE ONLY public.moon
ADD CONSTRAINT fk_planet FOREIGN KEY (planet_id) REFERENCES public.planet(planet_id);


– Name: planet fk_star; Type: FK CONSTRAINT; Schema: public; Owner: freecodecamp

ALTER TABLE ONLY public.planet
ADD CONSTRAINT fk_star FOREIGN KEY (star_id) REFERENCES public.star(star_id);


– PostgreSQL database dump complete

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.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.