<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
	<channel>
		<title><![CDATA[Latest posts for the topic "ERROR: 42P01: relation [x] does not exist"]]></title>
		<link>http://forums.visual-paradigm.com/posts/32.html</link>
		<description><![CDATA[Latest messages posted in the topic "ERROR: 42P01: relation [x] does not exist"]]></description>
		<generator>JForum - http://www.jforum.net</generator>
			<item>
				<title>ERROR: 42P01: relation [x] does not exist</title>
				<description><![CDATA[ Hello,<br> <br> I'm getting an exception in the ORM generated sample code when trying to <b>Save </b>operation in <b>CreateDbTestData </b>. I'm using PostgreSQL 8.2 with .NET 2.0 (solution needed conversion from .NET 1.1). My database name is "dbtest" with a single table "dummy". The <b>ListDbTestData </b>sample works properly, so my connection to the database is good.<br> <br> My .postgresql setup:<br> <table class="code-table-simple" align="center">
		<tr> 
		<td><span class="genmed"><b>Code:</b></span></td>
		</tr>
		</table>
		<table class="code-table" align="center">
		<tr>
		<td class="code">
		<pre>CREATE TABLE dummy &#40;
 	id	integer primary key,
 	smth	varchar&#40;30&#41;
 &#41;;</pre></td>
		</tr>
		</table><br> <br> I receive this exception:<br> <table class="code-table-simple" align="center">
		<tr> 
		<td><span class="genmed"><b>Code:</b></span></td>
		</tr>
		</table>
		<table class="code-table" align="center">
		<tr>
		<td class="code">
		<pre>{"ERROR: 42P01: relation \"public.dummy_id_seq\" does not exist"}	System.Exception {Npgsql.NpgsqlException}</pre></td>
		</tr>
		</table><br> <br> During the "Save" call in this code in ormsamples.CreateDbTestData:<br> <table class="code-table-simple" align="center">
		<tr> 
		<td><span class="genmed"><b>Code:</b></span></td>
		</tr>
		</table>
		<table class="code-table" align="center">
		<tr>
		<td class="code">
		<pre>				
 MyPackage.Dummy myPackageDummy = MyPackage.DummyFactory.CreateDummy&#40;&#41;;
 // Initialize the properties of the persistent object
 myPackageDummy.Smth = "Something";
 myPackageDummy.Save&#40;&#41;;</pre></td>
		</tr>
		</table><br> <br> I'm an experienced programmer, but new to ORM, dB, and Visual Paradigm.<br> <br> Thanks,<br> Eric]]></description>
				<guid isPermaLink="true">http://forums.visual-paradigm.com/posts/1848#8159.html</guid>
				<link>http://forums.visual-paradigm.com/posts/1848#8159.html</link>
				<pubDate><![CDATA[Wed, 3 Jan 2007 05:29:04]]></pubDate>
				<author><![CDATA[ bdubs]]></author>
			</item>
			<item>
				<title>Re:ERROR: 42P01: relation [x] does not exist</title>
				<description><![CDATA[ I've found a fix. I had to manually add a SEQUENCE to the database, named: <b><table>_<field>_seq</b>. <br> <br> It is possible to override the sequence generator. Go to the ERD and right click the primary key and select "Open Specification". ID generation is control by the "ID Generator" field. Some selections require you to enter a custom key. For example, if you select "sequence" you can manually enter "my_seq" as the key. This should correspond to a CREATE SEQUENCE command in your SQL setup code.<br> <br> Here is my new SQL setup code:<br> <table class="code-table-simple" align="center">
		<tr> 
		<td><span class="genmed"><b>Code:</b></span></td>
		</tr>
		</table>
		<table class="code-table" align="center">
		<tr>
		<td class="code">
		<pre>CREATE TABLE dummy &#40;
 	id	integer primary key,
 	smth	varchar&#40;30&#41;
 &#41;;
 
 -- workaround for VP DB-VA error:
 -- 	"ERROR 42P01: relation \"public.dummy_id_seq\" does not exist"
 CREATE SEQUENCE dummy_id_seq
    INCREMENT 1
    START 1;</pre></td>
		</tr>
		</table><br> <br> Is this the recommended way of setting up the dB primary key sequence generation? I'm assuming that the VP database generator does this automatically, and that I'm only seeing it because I'm handcrafting my dB. <br> <br> Thanks,<br> Eric]]></description>
				<guid isPermaLink="true">http://forums.visual-paradigm.com/posts/1848#8164.html</guid>
				<link>http://forums.visual-paradigm.com/posts/1848#8164.html</link>
				<pubDate><![CDATA[Wed, 3 Jan 2007 07:50:36]]></pubDate>
				<author><![CDATA[ bdubs]]></author>
			</item>
			<item>
				<title>Re:ERROR: 42P01: relation [x] does not exist</title>
				<description><![CDATA[ Hi bdubs,<br> <br> You are correct. Another method is "create table dummy (id serial not null, primary key (id));", it will auto generate "dummy_id_seq" sequence.<br> <br> Hope this helps.<br> <br> Best regards,<br> Jick]]></description>
				<guid isPermaLink="true">http://forums.visual-paradigm.com/posts/1848#8186.html</guid>
				<link>http://forums.visual-paradigm.com/posts/1848#8186.html</link>
				<pubDate><![CDATA[Wed, 3 Jan 2007 15:20:16]]></pubDate>
				<author><![CDATA[ Jick]]></author>
			</item>
			<item>
				<title>Re:ERROR: 42P01: relation [x] does not exist</title>
				<description><![CDATA[ Jick,<br> <br> Thanks for the response. Yes, this is very helpful. Your method is easier because "DROP TABLE dummy" will drop both the TABLE and the implicitly created SEQUENCE. This makes my mainenance/setup .postgresql files simpler.<br> <br> Thanks,<br> bdubs]]></description>
				<guid isPermaLink="true">http://forums.visual-paradigm.com/posts/1848#8197.html</guid>
				<link>http://forums.visual-paradigm.com/posts/1848#8197.html</link>
				<pubDate><![CDATA[Wed, 3 Jan 2007 21:19:58]]></pubDate>
				<author><![CDATA[ bdubs]]></author>
			</item>
	</channel>
</rss>