Truthfully,I've always done it with CF so I don't know what the fully  
query would be with postgres.

You can run the following query to get the table names and primary  
key names (where they are defined)

select table_name, column_name from  
information_schema.constraint_column_usage ;

Then just loop the query.

HTH,
Jon

On Jan 12, 2007, at 3:38 PM, Matt Quackenbush wrote:

> Jon,
>
> Thanks for the reply.  Indeed I did miss it.  I was hoping to write  
> one long
> ..sql script and run it from my query editor and update all tables  
> in a
> single connection.  Are you aware of a way to do that?  If not,  
> I'll use
> your CF solution :-)
>
>
> Matt
>
>
> On 1/12/07, Jon Clausen <[EMAIL PROTECTED]> wrote:
>>
>> Matt,
>>
>> I sent in a previous e-mail but you may have missed it:
>>
>> SELECT pg_catalog.setval(pg_catalog.pg_get_serial_sequence
>> ('#table#','#table_id#'), (SELECT max(#table_id#) FROM #table#),  
>> true);
>>
>> That way you don't have  to provide the sequence name.
>>
>> HTH,
>> Jon
>>
>> On Jan 12, 2007, at 2:41 PM, Matt Quackenbush wrote:
>>
>>> I don't know why i wrote the '+1' in there when I wrote the email.
>>> I'm not
>>> using it in the actual statement.  The specific syntax error is
>>> that the (
>>> is invalid.
>>>
>>> On 1/12/07, Matt Quackenbush <[EMAIL PROTECTED]> wrote:
>>>>
>>>> Okay, so far I'm *really* liking Pg.  I have successfully imported
>>>> all of
>>>> my tables and data, and have everything fixed with one exception:
>>>> updating
>>>> the currval() of the sequence for the 'auto_number' fields.  I  
>>>> can go
>>>> through each sequence one at a time with the GUI and update it,
>>>> but I'd
>>>> obviously prefer to do so via script.  Here's what I've tried, but
>>>> it throws
>>>> a syntax error:
>>>>
>>>> ALTER SEQUENCE seq_name RESTART WITH (SELECT max(id) + 1 FROM
>>>> table_name);
>>>>
>>>> Apparently it does not like the query to be used as the value.
>>>> I'm still
>>>> reading through the docs to see if I can find where/how to do what
>>>> I'm
>>>> trying to do, but figured I'd cheat and post back to you guys as
>>>> well.
>>>>
>>>>
>>>> Thanks,
>>>>
>>>> Matt
>>>>
>>>>
>>>
>>>
>>>
>>
>>
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Create robust enterprise, web RIAs.
Upgrade & integrate Adobe Coldfusion MX7 with Flex 2
http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:266458
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to