473,838 Members | 1,637 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Any way to SELECT a list of table names?

Is there any way in Postgres to SELECT a list of table names from inside of
a C program using ECPG?
Something similar to SELECT current_user that will give you all of the
tables in the database you are connected to.

_______________ _______________ _______________ _______________ _____
High-speed users—be more efficient online with the new MSN Premium Internet
Software. http://join.msn.com/?pgmarket=en-us&page=byoa/prem&ST=1
---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

Nov 12 '05 #1
4 37779

Eric Freeman schrieb:
Is there any way in Postgres to SELECT a list of table names from inside
of a C program using ECPG?
Something similar to SELECT current_user that will give you all of the
tables in the database you are connected to.


I guess you are looking for the information stored in pg_tables:

http://www.postgresql.org/docs/curre...pg-tables.html

Thomas


---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html

Nov 12 '05 #2
On Sat, 10 Jan 2004, Eric Freeman wrote:
Is there any way in Postgres to SELECT a list of table names from inside of
a C program using ECPG?
Something similar to SELECT current_user that will give you all of the
tables in the database you are connected to.


If you are running 7.4 and have the information_sch ema you can use that to
find out just about anything.
---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to ma*******@postg resql.org

Nov 12 '05 #3
> On Sat, 10 Jan 2004, Eric Freeman wrote:

Is there any way in Postgres to SELECT a list of table names from inside of
a C program using ECPG?
Something similar to SELECT current_user that will give you all of the
tables in the database you are connected to.


Not sure if this is what you're trying to do but.......

"SELECT tablename FROM pg_tables where tablename not like 'pg_%'"

Will get a list of tables in the db you're connected to.
---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match

Nov 12 '05 #4
From: "Ken Godee" <ke*@perfect-image.com>
Not sure if this is what you're trying to do but.......

"SELECT tablename FROM pg_tables where tablename not like 'pg_%'"

Will get a list of tables in the db you're connected to.

You can do that, but if by any chance, the pg_catalog schema changes, you
may find your app broken. The pg_catalog schema is not really intended to
be a client interface, so if you go that way, you may want to wrap it in a
function :-)

Now, if you are using PostgreSQL 7.4, use this query instead:

select table_name, table_schema from information_sch ema.tables where
table_schema NOT IN ('pg_catalog', 'information_sc hema');

Best wishes,
Chris Travers
---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match

Nov 22 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
10231
by: Jan | last post by:
I store sql-commands in a database table. In the first step I get the sql command out of the database table with embedded sql. In the second step I try to execute the command, which i got from the database table, using dynamic sql. Executing 'EXEC SQL DESCRIBE SELECT LIST FOR S INTO select_dp;' the error code -2149 is returned That means "Specified partition does not exist". Does anybody know if it is a database problem or a problem of
9
1915
by: Karen Hayter | last post by:
I have a problem returning information from a table to a multi-select list box.
3
2895
by: syounger | last post by:
Hi. I have a report in Access 2000 that is based on selection made from a series of interdependent list boxes. The boxes I have right now are Source, Table, Column, Date. The user chooses Source first, then the Table list box populates only tables from that source. Once a table is chosen, only the columns for that table appear in the Column list box. In the date box, the only dates that appear are those that are stored against the...
1
6432
by: JohnM | last post by:
Hi, I want to use a combo box to select from tables in a database. (Specifically, tables with a certain string in the name ... e.g MarkBk7l, Markbk8R etc.) How do I get a list of table into a combo box? I presume I can limit it to these with a 'WHERE' statement? Thanks in advance
5
2607
by: EiEiO | last post by:
Hi All, I am trying to create an Import Form to "Map Fields" for importing many different tables into 1. The form I created has 2 columns of comboboxes ( A - AA) thru (J - JJ). The rowsource for comboboxes with the double letters "AA" is the table I am importing into and the Row Source Type is Field List.
4
23911
by: Steven Smith | last post by:
Hello all, I have a vb6 (not .NET) program using MS Access as the backend. As part of an import form, I need to allow the user to select the table containing the data to be imported. How can I populate a combo with this information? Then, once this value is selected, how can I populate other combos with the column names of the selected table? Thanks,
3
1978
by: David C. Barber | last post by:
Using SQL Server 2000 and moving to a new computer. We did a full backup of the existing database to tape, brought up the new computer with a clean install using the same server name and IP address, and did a full restore. Not only were some permissions messed up, but Crystal Reports 10 and some Access Data Projects refused to run. I finally discovered while running an SP_WHO that the individual database names that we'd created (meaning...
23
1605
by: MikeB | last post by:
I'm learning PHP and MySQL. In the samples I work with, the SQL table names are "escaped" in accent grave (`) marks, not in single or double quotes. Can anyone explain that? For instance, I have the following: $sql_command = "SELECT * from `7-1_List`";
2
4182
by: rkartheek | last post by:
I want to generate a list of table names into a file in the order of FK dependencies. The purpose is to truncate all tables in a given database/schema by using the generated file in a "for loop". I use "Load from /dev/null..." or "Import.." command to truncate the tables. The database is IBM DB2 V 9 on an AIX platform. The below query gave me a list of tables that aren't parents, in other words list of Children that aren't parents. I need help...
0
9854
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9696
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10584
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10290
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7827
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7015
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4482
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4063
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3131
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.