0

I configured PostgreSQL for Oracle SQL developer.

I just tried to run the command \dt; from the worksheet and received below error

Error starting at line : 1 in command -
\dt 
Error report -
SQL Error: ERROR: syntax error at or near "\"
  Position: 1

Could you please advise how to run the commonly used psql commands from worksheet in Oracle SQL developer. Edit1: Are there any alternative equivalent for such psql command for oracle sql developer please. Thanks.

2
  • 1
    \dt is a psql meta-command. It's not a SQL command, so it can only be used from within psql Commented Jul 6, 2020 at 15:03
  • Thank you @a_horse_with_no_name Commented Jul 6, 2020 at 15:05

2 Answers 2

1

Doesn't SQL Developer offer a GUI view that provides the same info as \dt does? That is its job, afterall, and the point of using a GUI.

You can start psql with the -E option, then it will show you the SQL it executes to get the data behind the various backslash commands. You can then capture and run those queries in something else, like (presumably, I haven't tried it) SQL Developer.

Sign up to request clarification or add additional context in comments.

1 Comment

thank you for your inputs. I was looking for quick query.I will explore the psql -E option thanks.
1

You cannot do that.

psql commands are only available in psql.

Consider using psql, it is superior.

8 Comments

thank you. The reason I am switching to oracle sql developer is on the command line in linux the data gets garbled. Also oracle sql developer gives me quick gui view which I am more comfortable with. Any way to make life easier on command line using psql please, thanks.
It is of course a matter of taste, but (different from sqlplus) psql doesn't garble the output. I cannot argue with the "quick overview", but I get along well with \dn, \dt, \df and friends.
when I say garble, I mean hard to read for me, if there are too many columns in the table. THanks
Oh, I see. If you are on an operating system different from Windows, set the environment variable PAGER to less -RS, then you can scroll left and right.
I was talking about an environment variable. From psql you could use \setenv to set it.
|

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.