Actually I would use psql with the \e option. This would allow you to do what you suggest but also
allow you to stay within psql while you debug your statements. Then when you are all done and
you have used the appropriate amount of COMMENT ON statements, you can just do a pg_dump -s
and you are good to go.
Sincerely,
Joshua D. Drake
Mike Cox wrote:
Has anyone created something like that for Postgresql? It would be really handy to encrypt credit card numbers and other information so it stays secure.
If no one has created anything such as this, I am going to code up something quite soon, but if it already exists, there is no need for me to reinvent the wheel, so speak up! It is a law in places such as the EU that many types of data must be encrypted if the database is compromised.
I will put up my solution in a few days if one does not exist. But before I do that, I want to give a quick tutorial on how to create a file that will create tables, views and other such essentials. Most people who use PostgreSQL just type in the commands in PostgreSQL, but that is not as easily portable or backed up as what I'm about to show you!
1. open vi with a file. 2. Comments can be made as long as you add to slashes before the line: --this is a comment. 3. Next just type in the SQL commands you want! 4. after you are done, save the file. 5. then just do this to create the database you made in the file: psql database_name < my_vi_file 6.That is it!
Here is a very simple sample of a file:
--This is a sample file. Use at your own risk. No Warranties --Written by Mike Cox, author of the *nix "hm" command.
create table first( MYNUMBER INTEGER);
create VIEW myview AS select * from first;
--Ok this is the end. As you can see it is very simple and portable. --Try it out. Here's how: psql your_database < this_file
---------------------------(end of broadcast)--------------------------- TIP 6: Have you searched our list archives?
http://archives.postgresql.org
-- Command Prompt, Inc., home of Mammoth PostgreSQL - S/ODBC and S/JDBC Postgresql support, programming shared hosting and dedicated hosting. +1-503-667-4564 - jd@commandprompt.com - http://www.commandprompt.com PostgreSQL Replicator -- production quality replication for PostgreSQL
---------------------------(end of broadcast)--------------------------- TIP 7: don't forget to increase your free space map settings