Skip to content

pmonster/PostgresqlAutogeneration

 
 

Repository files navigation

PostgresqlAutogeneration

Function generator for PostgreSQL

This is a CRUD plpgsql generator.

You just copy-paste the table definition from pgAdmin and then press Generate.

For example, this one:

-- Table: proyectos.equipo
-- DROP TABLE proyectos.equipo;

CREATE TABLE proyectos.equipo
(
	id integer NOT NULL DEFAULT nextval('proyectos.equipo_id_seq'::regclass),
	idtipo integer NOT NULL,
	nombre character varying(250) COLLATE pg_catalog.""default"" NOT NULL,
	numero integer NOT NULL,
	usuario character varying(250) COLLATE pg_catalog.""default"" NOT NULL,
	cpu character varying(250) COLLATE pg_catalog.""default"" NOT NULL,
	CONSTRAINT equipo_pkey PRIMARY KEY (id),
	CONSTRAINT fk_equipo_idtipo FOREIGN KEY (idtipo)
		REFERENCES proyectos.equipo_tipo (id) MATCH SIMPLE
		ON UPDATE NO ACTION
		ON DELETE NO ACTION
)
WITH (OIDS = FALSE)
TABLESPACE pg_default;

ALTER TABLE proyectos.equipo OWNER to postgres;

The script to create the add, modify, delete and get functions will be ready to copy. You can then run it in the Query Tool of pgAdmin as it is or customize it.

There´s a mix of English and Spanish in code, but if you need we can translate it all to English.

Feel free to download and modify it!

About

Function generator for PostgreSQL

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 100.0%