Have you looked at DBI and DBD::Pg? Do they allow you to do the database stuff you need without spawning a shell process?
True laziness is hard work
| [reply] |
You are getting the Postgres shell, not a Perl shell. You cannot use Perl at the Postgres shell.
I'm wrong, you're just at the postgres user's shell. Maybe you want to use psql to use Postgres.
| [reply] [d/l] [select] |
If you're being asked to write code and work with databases on Unix but don't know how to use a Unix shell, then you need to ask your boss for some training. | [reply] |
How about checking your PATH environment ?
You logged in unix system with postgres super user account and you run perl script on the console but it didn't work as your ordinary account get worked it well, is this your situation?
In that case, which command and PATH env will help you, I guess. Good luck.
| [reply] |
when i run the command "su postgres"
to do what?...
want to run few commands here but system,exec,backticks wont run
Well, first of all because these are perl commands, but you are in a shell that is a different program. If you want to run perl from here then use a perl script (or perl one liners). Second question, of course you had login in the shell as the plain user postgres, not as superuser root. This user don't have superpowers normally outside postgres databases, so if you use system for example, you have the powers of postgresql user, no more, and some system calls and commands (that are exclusive of root) will fail. To try to use postgres for things unrelated with postgres DB management is probably unwise and if "su" don't ask for a password in "su postgres" you are doing wrong.
if you still think that you need a graphic desktop for postgres user take a look to "adduser", (not necessary and not recommended, but if this make you feel better at the start, you can use it). If you need a graphic access to the database use i.e. pgadmin3, (but psql is perfect for me) | [reply] |