Re: Blank SQL insert statements

Поиск
Список
Период
Сортировка
От Allan Engelhardt
Тема Re: Blank SQL insert statements
Дата
Msg-id 3BCD53AB.9030404@cybaea.com
обсуждение исходный текст
Ответ на Blank SQL insert statements  ("Ashley @ Turton" <ashley@turton.com>)
Список pgsql-general
I'm not really recommending what you are trying to do [I prefer an INSERT with
all the values instead of UPDATE-ing the table multiple times...], but

  INSERT INTO x DEFAULT VALUES;

should more or less do what you want.  Of course the table must have default
values defined to satisfy any constraints or you can't sensibly insert an
'empty' column.

Allan.

Ashley @ Turton wrote:

> I am developing a system to take a generic data structure and store it in a
> PostgreSQL database.  The data structure contains several entries of the
> following:
>
> insert a record into table1
> field1  value1
> field2  value2
>
> insert a record into table2
> field1  value1
> field2  value2
>
> Data for different tables is stored in each 'data set'.  When I get this to
> the database I want to:
>
> insert a blank record into tablex
> populate fieldx of new record with valuex
>
> I could implement this with some if statements based on the table name, then
> INSERT INTO x (...) VALUES (...), but I would prefer to kept the structure
> as generic as possible.  Is it possible in PostgreSQL to construct a blank
> record without specifying a list of fields and values in an INSERT statement
> (so I can perform a collection for UPDATEs to populate the blank record)?
>
>
> Ashley
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
>     (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
>


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

Предыдущее
От: Allan Engelhardt
Дата:
Сообщение: Re: postgresql 7.1.3
Следующее
От: Allan Engelhardt
Дата:
Сообщение: What is the syntax for unicode characters?