# PGconn

**URL:** <https://www.ruby-forum.com/t/pgconn/160752>\
**Category:** Ruby\
**Created:** [February 19, 2009, 10:37am UTC](https://www.ruby-forum.com/t/pgconn/160752 "2009-02-19T10:37:40Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ashikalim](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/9dc877/32.png) [@ashikalim](https://www.ruby-forum.com/u/ashikalim)\
**Post date:** [February 19, 2009, 10:37am UTC](https://www.ruby-forum.com/t/pgconn/160752/1 "2009-02-19T10:37:40Z")

</div>

Can anyone tell me what are the 3rd and 4th argument of PGconn#connect  
method  
in ruby ? .

---

<div class="post-metadata">

**Author:** ![ashikalim](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/9dc877/32.png) [@ashikalim](https://www.ruby-forum.com/u/ashikalim)\
**Post date:** [February 19, 2009, 10:46am UTC](https://www.ruby-forum.com/t/pgconn/160752/2 "2009-02-19T10:46:57Z")

</div>

[http://phrogz.net/rubylibs/rdoc/classes/PGconn.html](http://phrogz.net/rubylibs/rdoc/classes/PGconn.html)

pgoptions and pgtty? I’ll give them one thing, they’re really useful  
names.

pgoptions: backend options (String)  
pgtty: tty to print backend debug message (ignored in newer versions of  
PostgreSQL) (String)

Cheers,  
Dan

Google’s really helpful 😉

---

<div class="post-metadata">

**Author:** ![ashikalim](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/9dc877/32.png) [@ashikalim](https://www.ruby-forum.com/u/ashikalim)\
**Post date:** [February 19, 2009, 12:41pm UTC](https://www.ruby-forum.com/t/pgconn/160752/3 "2009-02-19T12:41:19Z")

</div>

Dan W. wrote:

> [Class: PGconn](http://phrogz.net/rubylibs/rdoc/classes/PGconn.html)
> 
> pgoptions and pgtty? I’ll give them one thing, they’re really useful  
> names.
> 
> pgoptions: backend options (String)  
> pgtty: tty to print backend debug message (ignored in newer versions of  
> PostgreSQL) (String)
> 
> Cheers,  
> Dan
> 
> Google’s really helpful 😉

I had a look on this URL . I think that pgoptions is psql command line  
options . Because when the error comes to this methods it says hint as  
follows ,

Error: ./TransactionProcessor.rb:15:in `connect': FATAL: invalid command-line arguments for server process (PGError) HINT: Try "postgres --help" for more information. from ./TransactionProcessor.rb:15:in `initialize’  
from ./TransactionProcessor.rb:30:in `new’  
from ./TransactionProcessor.rb:30

coding : PGconn.connect(  
POSTGRES\_SERVER,POSTGRES\_PORT,“-x”,“”,POSTGRES\_DATABASE,POSTGRES\_USERNAME,POSTGRES\_PASSWORD  
)  
here ,  
-x means Turn on the expanded table formatting mode. This is  
equivalent to the \x command .

Can you tell me what is pgoptions ?

---

<div class="post-metadata">

**Author:** ![ashikalim](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/9dc877/32.png) [@ashikalim](https://www.ruby-forum.com/u/ashikalim)\
**Post date:** [February 19, 2009, 1:21pm UTC](https://www.ruby-forum.com/t/pgconn/160752/4 "2009-02-19T13:21:12Z")

</div>

Well I’ve just had a horrible flash back of getting the PG driver!

My PGconn code looks as such

pghost = ‘localhost’  
pgport = 5432  
pgtbl = ‘tweek’  
dbname = ‘postgres’

db = PGconn.connect(pghost, pgport,’’,’’,pgtbl,dbname,’’)

Have you tried the \x as the third option?  
Failing that, sign up to the postgres mailing list. They may be able to  
point you in the right direction.

Cheers,  
Dan
