Thread: pgbash-1.1.1 release
Hi, With many cooperators, I have made a *bash built-in command* for PostgreSQL called "pgbash". The pgbash is the system which offers the 'direct SQL'/'embedded SQL' interface for PostgreSQL by being included in the bash-2.x shell. Features of pgbash ------------------- 1.The pgbash has a function which is equivalent to psql except for the interactive input processing function. 2.It is possible that pgbash carries out the interactive input processing using the hysteresis editing function ( history,!, fc command ) of bash. 3.An output of retrieval result and database information of pgbash uses PSprint() which improved PQprint(). By PSprint(),it is possible to output by plain table type, plain table + outer frame type and HTML table type. And, it ispossible to display NULL value string(like '-NULL-') and bit zero string(like '-0-'). 4.It is possible that pgbash manipulates multiple databases using CONNECT, DISCONNECT and SET CONNECTION (or -d option ). 5.The pgbash has a function which substitutes the retrieval result for the shell variable using FETCH INTO statement. 6.It is possible to set CGI mode. In CGI mode, the pgbash switches the output to HTML, and read the datat by GET/POST method,and read the data of HTTP_COOKIE. 7.The pgbash sets "error code", "error message", "number of tuples", etc to the shell variable. Therefore, it is possibleto know the condition after the SQL execution. Details is as follows. http://www.psn.co.jp/PostgreSQL/pgbash/index-e.html # I am very glad, if many people will use the pgbash. -- Regards. SAKAIDA Masaaki -- Osaka, Japan # Sorry, I am not good at English.
That's really cool ! I just install and played a little bit. I found a minor problem : I have to connect to any database to issue exec_sql -l database I have no my personal database Here is a log: bash-2.03$ exec_sql -l database (-402)FATAL 1: Database megera does not exist in pg_database bash-2.03$ exec_sql "connect to discovery" # PostgreSQL 6.5.2 on i586-pc-linux-gnulibc1, compiled by gcc 2.95.1 # CONNECT TO discovery:5432 AS discovery USER megera bash-2.03$ exec_sql -l database # Databases list datname |datdba|encoding|datpath ---------+------+--------+--------- template1| 505| 16|template1 apod | 11| 16|apod I don't understand this requirements just to list all databases Regards, Oleg On Fri, 1 Oct 1999, SAKAIDA wrote: > Date: Fri, 01 Oct 1999 17:24:57 +0900 > From: SAKAIDA <sakaida@psn.co.jp> > To: hackers@postgreSQL.org > Cc: pgsql-interfaces@postgreSQL.org > Subject: [HACKERS] pgbash-1.1.1 release > > Hi, > > With many cooperators, I have made a *bash built-in command* for > PostgreSQL called "pgbash". > > The pgbash is the system which offers the 'direct SQL'/'embedded > SQL' interface for PostgreSQL by being included in the bash-2.x > shell. > > > Features of pgbash > ------------------- > > 1.The pgbash has a function which is equivalent to psql except for > the interactive input processing function. > > 2.It is possible that pgbash carries out the interactive input > processing using the hysteresis editing function ( history, !, > fc command ) of bash. > > 3.An output of retrieval result and database information of pgbash > uses PSprint() which improved PQprint(). By PSprint(), it is > possible to output by plain table type, plain table + outer frame > type and HTML table type. And, it is possible to display NULL > value string(like '-NULL-') and bit zero string(like '-0-'). > > 4.It is possible that pgbash manipulates multiple databases using > CONNECT, DISCONNECT and SET CONNECTION (or -d option ). > > 5.The pgbash has a function which substitutes the retrieval result > for the shell variable using FETCH INTO statement. > > 6.It is possible to set CGI mode. In CGI mode, the pgbash switches > the output to HTML, and read the datat by GET/POST method, and > read the data of HTTP_COOKIE. > > 7.The pgbash sets "error code", "error message", "number of tuples", > etc to the shell variable. Therefore, it is possible to know the > condition after the SQL execution. > > > Details is as follows. > http://www.psn.co.jp/PostgreSQL/pgbash/index-e.html > > # I am very glad, if many people will use the pgbash. > > -- > Regards. > > SAKAIDA Masaaki -- Osaka, Japan$B!!(B > # Sorry, I am not good at English. > > > ************ > _____________________________________________________________ Oleg Bartunov, sci.researcher, hostmaster of AstroNet, Sternberg Astronomical Institute, Moscow University (Russia) Internet: oleg@sai.msu.su, http://www.sai.msu.su/~megera/ phone: +007(095)939-16-83, +007(095)939-23-83
> I have to connect to any database to issue > exec_sql -l database A database name is required to connect (by libpq? protocol?). This can be cured by using template1 as a default. However, the issue naturally develops into a more serious concern: are we going to have inter-database queries in any plausible future? Thanks, --Gene ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The idea of adding a database interface to sh, although I can immediately see its usefulness, srikes me funny. We are apparently looking to have an elisp interface soon (thanks to Eric Marsden); sooner or later, one will be finding the SQL code stashed everywhere throughout the system. Would it then be wrong to expect the whole backend embedded into the unix kernel? That would definitely swallow a share of IBM's server market ;-> Now think about this: after wrapping it up into the kernel, what will prevent you from building a Prolog on top of it? Next thing that comes to mind would be a neural network interface to the postgres-enabled prolog-backtracking unix kernel. The chances of winnning a Rube Godberg contest are already high and rising ... http://www.anl.gov/OPA/rube/rubeolive.html
This works like a charm. Thanks tons! ;) Clark On Fri, 1 Oct 1999, SAKAIDA wrote: > Hi, > > With many cooperators, I have made a *bash built-in command* for > PostgreSQL called "pgbash". > > The pgbash is the system which offers the 'direct SQL'/'embedded > SQL' interface for PostgreSQL by being included in the bash-2.x > shell. > > > Features of pgbash > ------------------- > > 1.The pgbash has a function which is equivalent to psql except for > the interactive input processing function. > > 2.It is possible that pgbash carries out the interactive input > processing using the hysteresis editing function ( history, !, > fc command ) of bash. > > 3.An output of retrieval result and database information of pgbash > uses PSprint() which improved PQprint(). By PSprint(), it is > possible to output by plain table type, plain table + outer frame > type and HTML table type. And, it is possible to display NULL > value string(like '-NULL-') and bit zero string(like '-0-'). > > 4.It is possible that pgbash manipulates multiple databases using > CONNECT, DISCONNECT and SET CONNECTION (or -d option ). > > 5.The pgbash has a function which substitutes the retrieval result > for the shell variable using FETCH INTO statement. > > 6.It is possible to set CGI mode. In CGI mode, the pgbash switches > the output to HTML, and read the datat by GET/POST method, and > read the data of HTTP_COOKIE. > > 7.The pgbash sets "error code", "error message", "number of tuples", > etc to the shell variable. Therefore, it is possible to know the > condition after the SQL execution. > > > Details is as follows. > http://www.psn.co.jp/PostgreSQL/pgbash/index-e.html > > # I am very glad, if many people will use the pgbash. > > -- > Regards. > > SAKAIDA Masaaki -- Osaka, Japan$B!!(B > # Sorry, I am not good at English. > > > ************ >