Macro substitution in Postgres

Поиск
Список
Период
Сортировка
От Louise Cofield
Тема Macro substitution in Postgres
Дата
Msg-id 000d01c377da$2438bd60$7801a8c0@Louise
обсуждение исходный текст
Список pgsql-novice

Greetings -

 

I am trying to create a table, using variables and/or array elements for all required elements of a simple create table statement.  For example, m_array[4][1] holds the value "MyTable", m_array[4][2] holds "col1" m_array[4][3] holds "varchar2", and m_array[4][4] holds "2".

 

I want to be able to create the following: 

"CREATE TABLE" || <value of m_array[1]>  "(" || <value of m_array[2]> || "  "

      || <value of m_array[3] || "(" || <value of m_array[4] || "))"

 

Generated, would be:  "create table MyTable(col1 varchar(2))"

 

Making the macro substitution for the "value of " to work syntactically in the statement that has me scratching my head. 

(The array will be read in a C program, using LIBPQ as the interface.)

 

Thanks!   :-)

В списке pgsql-novice по дате отправления:

Предыдущее
От: Bruno Wolff III
Дата:
Сообщение: Re: phone number list
Следующее
От: Stuart Woodward
Дата:
Сообщение: Re: how many records