PostgreSQL

My PostgreSQL notes, both troubleshooting and SQL commands.

Alter table

Adding fields to a table. Also see the PostgreSQL manual (alter table)

alter table eventInstance
add externalId varchar
add scheduleId varchar;

Running a script

Often, you want to write an sql script that creates the entire schema etc, this can be easily done with:

$ psql -U myuser -d mydatabase < myscript.sql

~ /home 🏠 ~ talks 💬 ~ bash ~ craftsmanship ~ db ~ dongxi ~ emacs ~ escenic ~ iam ~ java ~ js ~ language ~ latex ~ ldap ~ life ~ linux ~ llm ~ mac-os-x ~ mt-foo ~ network ~ norsk ~ python ~ quotes ~ running ~ security ~ travel ~ unix ~ various ~ vcs ~ webdesign ~ windows ~ discoveries ~ cv 🧙 ~

Licensed under CC BY Creative Commons License ~ 📡 RSS feed ~ ✉ torstein.k.johansen @ gmail ~ 🐘 @skybert@hachyderm.io ~ 🎥 youtube.com/@skybert